Browse Source

Merge the jack-session branch to svn trunk.

Requested by Stephane

git-svn-id: http://subversion.jackaudio.org/jack/jack2/trunk/jackmp@4057 0c269be4-1314-0410-8aa9-9f06e86f4224
tags/1.9.7
nedko 15 years ago
parent
commit
60dbbdb2ee
70 changed files with 2285 additions and 18813 deletions
  1. +134
    -8
      common/JackAPI.cpp
  2. +24
    -4
      common/JackChannel.h
  3. +103
    -9
      common/JackClient.cpp
  4. +14
    -1
      common/JackClient.h
  5. +13
    -5
      common/JackClientControl.h
  6. +3
    -0
      common/JackConstants.h
  7. +5
    -5
      common/JackControlAPI.cpp
  8. +10
    -10
      common/JackDebugClient.cpp
  9. +3
    -3
      common/JackDebugClient.h
  10. +189
    -12
      common/JackEngine.cpp
  11. +18
    -2
      common/JackEngine.h
  12. +2
    -2
      common/JackExternalClient.cpp
  13. +2
    -2
      common/JackExternalClient.h
  14. +6
    -6
      common/JackInternalClient.cpp
  15. +5
    -5
      common/JackInternalClient.h
  16. +9
    -4
      common/JackInternalClientChannel.h
  17. +5
    -5
      common/JackLibAPI.cpp
  18. +3
    -3
      common/JackLibClient.cpp
  19. +2
    -2
      common/JackLibClient.h
  20. +41
    -4
      common/JackLockedEngine.h
  21. +296
    -306
      common/JackNetOneDriver.cpp
  22. +1
    -0
      common/JackNotification.h
  23. +375
    -74
      common/JackRequest.h
  24. +6
    -6
      common/JackServer.cpp
  25. +3
    -3
      common/JackServer.h
  26. +6
    -6
      common/JackServerAPI.cpp
  27. +1
    -0
      common/JackThread.h
  28. +10
    -0
      common/JackTools.cpp
  29. +4
    -0
      common/JackTools.h
  30. +229
    -0
      common/jack/session.h
  31. +47
    -43
      common/jack/types.h
  32. +13
    -6
      common/varargs.h
  33. +5
    -9
      common/wscript
  34. +184
    -0
      example-clients/session_notify.c
  35. +202
    -0
      example-clients/simple_session_client.c
  36. +2
    -0
      example-clients/wscript
  37. +0
    -250
      macosx/JackMacEngineRPC.cpp
  38. +0
    -47
      macosx/JackMacLibClientRPC.cpp
  39. +0
    -334
      macosx/JackMachClientChannel.cpp
  40. +0
    -99
      macosx/JackMachClientChannel.h
  41. +0
    -67
      macosx/JackMachNotifyChannel.cpp
  42. +0
    -53
      macosx/JackMachNotifyChannel.h
  43. +0
    -295
      macosx/JackMachPort.cpp
  44. +0
    -88
      macosx/JackMachPort.h
  45. +0
    -174
      macosx/JackMachServerChannel.cpp
  46. +0
    -76
      macosx/JackMachServerChannel.h
  47. +0
    -70
      macosx/JackMachServerNotifyChannel.cpp
  48. +0
    -55
      macosx/JackMachServerNotifyChannel.h
  49. +20
    -13
      macosx/JackPlatformPlug_os.h
  50. +24
    -148
      macosx/Jackdmp.xcodeproj/project.pbxproj
  51. +0
    -47
      macosx/RPC/JackRPCClient.defs
  52. +0
    -194
      macosx/RPC/JackRPCClient.h
  53. +0
    -1373
      macosx/RPC/JackRPCClientServer.c
  54. +0
    -466
      macosx/RPC/JackRPCClientUser.c
  55. +0
    -181
      macosx/RPC/JackRPCEngine.defs
  56. +0
    -1040
      macosx/RPC/JackRPCEngine.h
  57. +0
    -6817
      macosx/RPC/JackRPCEngineServer.c
  58. +0
    -6302
      macosx/RPC/JackRPCEngineUser.c
  59. +0
    -25
      macosx/RPC/Jackdefs.h
  60. +6
    -1
      posix/JackPosixThread.cpp
  61. +2
    -1
      posix/JackPosixThread.h
  62. +2
    -2
      posix/JackSocket.cpp
  63. +66
    -8
      posix/JackSocketClientChannel.cpp
  64. +19
    -9
      posix/JackSocketClientChannel.h
  65. +71
    -5
      posix/JackSocketServerChannel.cpp
  66. +4
    -4
      posix/JackSocketServerChannel.h
  67. +18
    -8
      windows/JackWinNamedPipeClientChannel.cpp
  68. +4
    -4
      windows/JackWinNamedPipeClientChannel.h
  69. +69
    -12
      windows/JackWinNamedPipeServerChannel.cpp
  70. +5
    -0
      windows/JackWinThread.cpp

+ 134
- 8
common/JackAPI.cpp View File

@@ -108,8 +108,8 @@ extern "C"
JackPortConnectCallback
connect_callback, void *arg);
EXPORT int jack_set_port_rename_callback (jack_client_t *,
JackPortRenameCallback
rename_callback, void *arg);
JackPortRenameCallback
rename_callback, void *arg);
EXPORT int jack_set_graph_order_callback (jack_client_t *,
JackGraphOrderCallback graph_callback,
void *);
@@ -217,7 +217,7 @@ extern "C"
EXPORT int jack_client_create_thread (jack_client_t* client,
pthread_t *thread,
int priority,
int realtime, // boolean
int realtime, // boolean
thread_routine routine,
void *arg);
EXPORT int jack_drop_real_time_scheduling (pthread_t thread);
@@ -1686,7 +1686,7 @@ EXPORT int jack_acquire_real_time_scheduling(pthread_t thread, int priority)
EXPORT int jack_client_create_thread(jack_client_t* client,
pthread_t *thread,
int priority,
int realtime, /* boolean */
int realtime, /* boolean */
thread_routine routine,
void *arg)
{
@@ -1766,8 +1766,8 @@ EXPORT jack_intclient_t jack_internal_client_handle(jack_client_t* ext_client, c
return 0;
} else {
jack_status_t my_status;
if (status == NULL) /* no status from caller? */
status = &my_status; /* use local status word */
if (status == NULL) /* no status from caller? */
status = &my_status; /* use local status word */
*status = (jack_status_t)0;
return client->InternalClientHandle(client_name, status);
}
@@ -1786,8 +1786,8 @@ EXPORT jack_intclient_t jack_internal_client_load_aux(jack_client_t* ext_client,
jack_varargs_t va;
jack_status_t my_status;

if (status == NULL) /* no status from caller? */
status = &my_status; /* use local status word */
if (status == NULL) /* no status from caller? */
status = &my_status; /* use local status word */
*status = (jack_status_t)0;

/* validate parameters */
@@ -1859,3 +1859,129 @@ EXPORT void jack_free(void* ptr)
free(ptr);
}
}

// session.h
EXPORT int jack_set_session_callback(jack_client_t* ext_client, JackSessionCallback session_callback, void* arg)
{
#ifdef __CLIENTDEBUG__
JackGlobals::CheckContext("jack_set_session_callback");
#endif
JackClient* client = (JackClient*)ext_client;
jack_log("jack_set_session_callback ext_client %x client %x ", ext_client, client);
if (client == NULL) {
jack_error("jack_set_session_callback called with a NULL client");
return -1;
} else {
return client->SetSessionCallback(session_callback, arg);
}
}

EXPORT jack_session_command_t *jack_session_notify(jack_client_t* ext_client, const char* target, jack_session_event_type_t ev_type, const char *path)
{
#ifdef __CLIENTDEBUG__
JackGlobals::CheckContext("jack_session_notify");
#endif
JackClient* client = (JackClient*)ext_client;
jack_log("jack_session_notify ext_client %x client %x ", ext_client, client);
if (client == NULL) {
jack_error("jack_session_notify called with a NULL client");
return NULL;
} else {
return client->SessionNotify(target, ev_type, path);
}
}

EXPORT int jack_session_reply(jack_client_t *ext_client, jack_session_event_t *event)
{
#ifdef __CLIENTDEBUG__
JackGlobals::CheckContext("jack_session_reply");
#endif
JackClient* client = (JackClient*)ext_client;
jack_log("jack_session_reply ext_client %x client %x ", ext_client, client);
if (client == NULL) {
jack_error("jack_session_reply called with a NULL client");
return -1;
} else {
return client->SessionReply(event);
}
}

EXPORT void jack_session_event_free(jack_session_event_t* ev)
{
if (ev) {
if (ev->session_dir)
free((void *)ev->session_dir);
if (ev->client_uuid)
free((void *)ev->client_uuid);
if (ev->command_line)
free(ev->command_line);
free(ev);
}
}

EXPORT char *jack_get_uuid_for_client_name( jack_client_t *ext_client, const char *client_name )
{
#ifdef __CLIENTDEBUG__
JackGlobals::CheckContext("jack_get_uuid_for_client_name");
#endif
JackClient* client = (JackClient*)ext_client;
jack_log("jack_get_uuid_for_client_name ext_client %x client %x ", ext_client, client);
if (client == NULL) {
jack_error("jack_get_uuid_for_client_name called with a NULL client");
return NULL;
} else {
return client->GetUUIDForClientName(client_name);
}
}

EXPORT char *jack_get_client_name_by_uuid( jack_client_t *ext_client, const char *client_uuid )
{
#ifdef __CLIENTDEBUG__
JackGlobals::CheckContext("jack_get_client_name_by_uuid");
#endif
JackClient* client = (JackClient*)ext_client;
jack_log("jack_get_uuid_for_client_name ext_client %x client %x ", ext_client, client);
if (client == NULL) {
jack_error("jack_get_client_name_by_uuid called with a NULL client");
return NULL;
} else {
return client->GetClientNameForUUID(client_uuid);
}
}

EXPORT int jack_reserve_client_name( jack_client_t *ext_client, const char *name, const char *uuid )
{
#ifdef __CLIENTDEBUG__
JackGlobals::CheckContext("jack_reserve_client_name");
#endif
JackClient* client = (JackClient*)ext_client;
jack_log("jack_reserve_client_name ext_client %x client %x ", ext_client, client);
if (client == NULL) {
jack_error("jack_reserve_client_name called with a NULL client");
return -1;
} else {
return client->ReserveClientName(name, uuid);
}
}

EXPORT void jack_session_commands_free( jack_session_command_t *cmds )
{
if (!cmds)
return;

int i=0;
while(1) {
if (cmds[i].client_name)
free ((char *)cmds[i].client_name);
if (cmds[i].command)
free ((char *)cmds[i].command);
if (cmds[i].uuid)
free ((char *)cmds[i].uuid);
else
break;

i += 1;
}

free(cmds);
}

+ 24
- 4
common/JackChannel.h View File

@@ -21,6 +21,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define __JackChannel__

#include "types.h"
#include "session.h"

namespace Jack
{
@@ -49,7 +50,7 @@ class JackClientChannelInterface
{}

// Open the Server/Client connection
virtual int Open(const char* server_name, const char* name, char* name_res, JackClient* obj, jack_options_t options, jack_status_t* status)
virtual int Open(const char* server_name, const char* name, int uuid, char* name_res, JackClient* obj, jack_options_t options, jack_status_t* status)
{
return 0;
}
@@ -73,9 +74,9 @@ class JackClientChannelInterface
return -1;
}

virtual void ClientCheck(const char* name, char* name_res, int protocol, int options, int* status, int* result)
virtual void ClientCheck(const char* name, int uuid, char* name_res, int protocol, int options, int* status, int* result)
{}
virtual void ClientOpen(const char* name, int pid, int* shared_engine, int* shared_client, int* shared_graph, int* result)
virtual void ClientOpen(const char* name, int pid, int uuid, int* shared_engine, int* shared_client, int* shared_graph, int* result)
{}
virtual void ClientOpen(const char* name, int* ref, JackEngineControl** shared_engine, JackGraphManager** shared_manager, JackClientInterface* client, int* result)
{}
@@ -120,12 +121,31 @@ class JackClientChannelInterface
virtual void InternalClientHandle(int refnum, const char* client_name, int* status, int* int_ref, int* result)
{}

virtual void InternalClientLoad(int refnum, const char* client_name, const char* so_name, const char* objet_data, int options, int* status, int* int_ref, int* result)
virtual void InternalClientLoad(int refnum, const char* client_name, const char* so_name, const char* objet_data, int options, int* status, int* int_ref, int uuid, int* result)
{}

virtual void InternalClientUnload(int refnum, int int_ref, int* status, int* result)
{}
virtual void SessionNotify(int refnum, const char* target, jack_session_event_type_t type, const char *path, jack_session_command_t **result)
{}

virtual void SessionReply(int refnum, int *result)
{}

virtual void GetUUIDForClientName(int refnum, const char *client_name, char *uuid_res, int *result)
{}

virtual void GetClientNameForUUID(int refnum, const char *uuid, char *name_res, int *result)
{}

virtual void ReserveClientName(int refnum, const char *client_name, const char *uuid, int *result)
{}

virtual bool IsChannelThread()
{
return false;
}
};

}


+ 103
- 9
common/JackClient.cpp View File

@@ -112,9 +112,9 @@ pthread_t JackClient::GetThreadID()
}

/*!
In "async" mode, the server does not synchronize itself on the output drivers, thus it would never "consume" the activations.
The synchronization primitives for drivers are setup in "flush" mode that to not keep unneeded activations.
Drivers synchro are setup in "flush" mode if server is "async" and NOT freewheel.
In "async" mode, the server does not synchronize itself on the output drivers, thus it would never "consume" the activations.
The synchronization primitives for drivers are setup in "flush" mode that to not keep unneeded activations.
Drivers synchro are setup in "flush" mode if server is "async" and NOT freewheel.
*/
void JackClient::SetupDriverSync(bool freewheel)
{
@@ -170,7 +170,7 @@ int JackClient::ClientNotify(int refnum, const char* name, int notify, int sync,

case kAddClient:
jack_log("JackClient::kAddClient fName = %s name = %s", GetClientControl()->fName, name);
if (fClientRegistration && strcmp(GetClientControl()->fName, name) != 0) { // Don't call the callback for the registering client itself
if (fClientRegistration && strcmp(GetClientControl()->fName, name) != 0) { // Don't call the callback for the registering client itself
fClientRegistration(name, 1, fClientRegistrationArg);
}
break;
@@ -272,6 +272,23 @@ int JackClient::ClientNotify(int refnum, const char* name, int notify, int sync,
fInfoShutdown = NULL;
}
break;

case kSessionCallback:
jack_log("JackClient::kSessionCallback");
if (fSession) {
jack_session_event_t *event = (jack_session_event_t *) malloc( sizeof(jack_session_event_t) );
char uuid_buf[JACK_UUID_SIZE];
event->type = (jack_session_event_type_t) value1;
event->session_dir = strdup( message );
event->command_line = NULL;
event->flags = (jack_session_flags_t) 0;
snprintf( uuid_buf, sizeof(uuid_buf), "%d", GetClientControl()->fSessionID );
event->client_uuid = strdup( uuid_buf );
fImmediateSessionReply = false;
fSession(event, fSessionArg);
res = (fImmediateSessionReply) ? 1 : 2;
}
break;
}
}

@@ -280,7 +297,7 @@ int JackClient::ClientNotify(int refnum, const char* name, int notify, int sync,

/*!
\brief We need to start thread before activating in the server, otherwise the FW driver
connected to the client may not be activated.
connected to the client may not be activated.
*/
int JackClient::Activate()
{
@@ -410,7 +427,7 @@ inline void JackClient::ExecuteThread()
while (true) {
CycleWaitAux();
CycleSignalAux(CallProcessCallback());
}
}
}

inline jack_nframes_t JackClient::CycleWaitAux()
@@ -981,6 +998,19 @@ int JackClient::SetProcessThread(JackThreadCallback fun, void *arg)
}
}

int JackClient::SetSessionCallback(JackSessionCallback callback, void *arg)
{
if (IsActive()) {
jack_error("You cannot set callbacks on an active client");
return -1;
} else {
GetClientControl()->fCallback[kSessionCallback] = (callback != NULL);
fSessionArg = arg;
fSession = callback;
return 0;
}
}

//------------------
// Internal clients
//------------------
@@ -1027,9 +1057,8 @@ int JackClient::InternalClientLoad(const char* client_name, jack_options_t optio
return 0;
}

int int_ref = 0;
int result = -1;
fChannel->InternalClientLoad(GetClientControl()->fRefNum, client_name, va->load_name, va->load_init, options, (int*)status, &int_ref, &result);
int int_ref, result = -1;
fChannel->InternalClientLoad(GetClientControl()->fRefNum, client_name, va->load_name, va->load_init, options, (int*)status, &int_ref, -1, &result);
return int_ref;
}

@@ -1039,6 +1068,71 @@ void JackClient::InternalClientUnload(int ref, jack_status_t* status)
fChannel->InternalClientUnload(GetClientControl()->fRefNum, ref, (int*)status, &result);
}

//------------------
// Session API
//------------------

jack_session_command_t *JackClient::SessionNotify( const char* target, jack_session_event_type_t type, const char* path )
{
jack_session_command_t *res;
fChannel->SessionNotify( GetClientControl()->fRefNum, target, type, path, &res );
return res;
}

int JackClient::SessionReply( jack_session_event_t *ev )
{
if (ev->command_line) {
strncpy( GetClientControl()->fSessionCommand, ev->command_line, sizeof(GetClientControl()->fSessionCommand) );
} else {
GetClientControl()->fSessionCommand[0] = '\0';
}

GetClientControl()->fSessionFlags = ev->flags;

jack_log( "JackClient::SessionReply... we are here" );
if (fChannel->IsChannelThread()) {
jack_log( "JackClient::SessionReply... in callback reply" );
fImmediateSessionReply = true;
return 0;
}

jack_log( "JackClient::SessionReply... out of cb" );

int res;
fChannel->SessionReply( GetClientControl()->fRefNum, &res);
return res;
}

char* JackClient::GetUUIDForClientName(const char* client_name)
{
char uuid_res[JACK_UUID_SIZE];
int result = -1;
fChannel->GetUUIDForClientName( GetClientControl()->fRefNum, client_name, uuid_res, &result);

if (result)
return NULL;

return strdup(uuid_res);
}

char* JackClient::GetClientNameForUUID(const char* uuid)
{
char name_res[JACK_CLIENT_NAME_SIZE + 1];
int result = -1;
fChannel->GetClientNameForUUID(GetClientControl()->fRefNum, uuid, name_res, &result);

if (result)
return NULL;

return strdup(name_res);
}

int JackClient::ReserveClientName(const char *name, const char* uuid)
{
int result = -1;
fChannel->ReserveClientName( GetClientControl()->fRefNum, name, uuid, &result);
return result;
}

} // end of namespace


+ 14
- 1
common/JackClient.h View File

@@ -28,6 +28,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "JackPlatformPlug.h"
#include "JackChannel.h"
#include "types.h"
#include "session.h"
#include "varargs.h"
#include <list>

@@ -66,6 +67,7 @@ class JackClient : public JackClientInterface, public JackRunnableInterface
JackTimebaseCallback fTimebase;
JackSyncCallback fSync;
JackThreadCallback fThreadFun;
JackSessionCallback fSession;

void* fProcessArg;
void* fGraphOrderArg;
@@ -83,12 +85,15 @@ class JackClient : public JackClientInterface, public JackRunnableInterface
void* fTimebaseArg;
void* fSyncArg;
void* fThreadFunArg;
void* fSessionArg;
char fServerName[64];

JackThread fThread; /*! Thread to execute the Process function */
detail::JackClientChannelInterface* fChannel;
JackSynchro* fSynchroTable;
std::list<jack_port_id_t> fPortList;

bool fImmediateSessionReply;
int StartThread();
void SetupDriverSync(bool freewheel);
@@ -118,7 +123,7 @@ class JackClient : public JackClientInterface, public JackRunnableInterface
JackClient(JackSynchro* table);
virtual ~JackClient();

virtual int Open(const char* server_name, const char* name, jack_options_t options, jack_status_t* status) = 0;
virtual int Open(const char* server_name, const char* name, int uuid, jack_options_t options, jack_status_t* status) = 0;
virtual int Close();

virtual JackGraphManager* GetGraphManager() const = 0;
@@ -173,6 +178,7 @@ class JackClient : public JackClientInterface, public JackRunnableInterface
virtual int SetPortRegistrationCallback(JackPortRegistrationCallback callback, void* arg);
virtual int SetPortConnectCallback(JackPortConnectCallback callback, void *arg);
virtual int SetPortRenameCallback(JackPortRenameCallback callback, void *arg);
virtual int SetSessionCallback(JackSessionCallback callback, void *arg);

// Internal clients
virtual char* GetInternalClientName(int ref);
@@ -184,6 +190,13 @@ class JackClient : public JackClientInterface, public JackRunnableInterface
void CycleSignal(int status);
int SetProcessThread(JackThreadCallback fun, void *arg);

// Session api
virtual jack_session_command_t *SessionNotify(const char *target, jack_session_event_type_t type, const char *path);
virtual int SessionReply(jack_session_event_t *ev);
char* GetUUIDForClientName(const char* client_name);
char* GetClientNameForUUID(const char* uuid);
int ReserveClientName(const char *name, const char* uuid);

// JackRunnableInterface interface
bool Init();
bool Execute();


+ 13
- 5
common/JackClientControl.h View File

@@ -26,6 +26,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "JackSynchro.h"
#include "JackNotification.h"

#include "jack/session.h"

namespace Jack
{

@@ -44,22 +46,26 @@ struct JackClientControl : public JackShmMemAble
int fPID;
bool fActive;

JackClientControl(const char* name, int pid, int refnum)
int fSessionID;
char fSessionCommand[JACK_SESSION_COMMAND_SIZE];
jack_session_flags_t fSessionFlags;

JackClientControl(const char* name, int pid, int refnum, int uuid)
{
Init(name, pid, refnum);
Init(name, pid, refnum, uuid);
}

JackClientControl(const char* name)
{
Init(name, 0, -1);
Init(name, 0, -1, -1);
}

JackClientControl()
{
Init("", 0, -1);
Init("", 0, -1, -1);
}

void Init(const char* name, int pid, int refnum)
void Init(const char* name, int pid, int refnum, int uuid)
{
strcpy(fName, name);
for (int i = 0; i < kMaxNotification; i++)
@@ -77,6 +83,8 @@ struct JackClientControl : public JackShmMemAble
fTransportSync = false;
fTransportTimebase = false;
fActive = false;

fSessionID = uuid;
}

} POST_PACKED_STRUCTURE;


+ 3
- 0
common/JackConstants.h View File

@@ -33,6 +33,8 @@

#define JACK_CLIENT_NAME_SIZE 64
#define JACK_MESSAGE_SIZE 256
#define JACK_UUID_SIZE 32
#define JACK_SESSION_COMMAND_SIZE 256

#ifndef PORT_NUM
#define PORT_NUM 2048
@@ -71,6 +73,7 @@
#define FREEWHEEL_DRIVER_TIMEOUT 10 // in sec
#define DRIVER_TIMEOUT_FACTOR 10


#define NO_PORT 0xFFFE

#define EMPTY 0xFFFD


+ 5
- 5
common/JackControlAPI.cpp View File

@@ -450,21 +450,21 @@ sigset_t
jackctl_setup_signals(
unsigned int flags)
{
if ((waitEvent = CreateEvent(NULL, FALSE, FALSE, NULL)) == NULL) {
if ((waitEvent = CreateEvent(NULL, FALSE, FALSE, NULL)) == NULL) {
jack_error("CreateEvent fails err = %ld", GetLastError());
return 0;
}

(void) signal(SIGINT, do_nothing_handler);
(void) signal(SIGINT, do_nothing_handler);
(void) signal(SIGABRT, do_nothing_handler);
(void) signal(SIGTERM, do_nothing_handler);

return (sigset_t)waitEvent;
return (sigset_t)waitEvent;
}

void jackctl_wait_signals(sigset_t signals)
{
if (WaitForSingleObject(waitEvent, INFINITE) != WAIT_OBJECT_0) {
if (WaitForSingleObject(waitEvent, INFINITE) != WAIT_OBJECT_0) {
jack_error("WaitForSingleObject fails err = %ld", GetLastError());
}
}
@@ -1179,7 +1179,7 @@ EXPORT bool jackctl_server_load_internal(
{
int status;
if (server_ptr->engine != NULL) {
server_ptr->engine->InternalClientLoad(internal->desc_ptr->name, internal->desc_ptr->name, internal->set_parameters, JackNullOption, &internal->refnum, &status);
server_ptr->engine->InternalClientLoad(internal->desc_ptr->name, internal->desc_ptr->name, internal->set_parameters, JackNullOption, &internal->refnum, -1, &status);
return (internal->refnum > 0);
} else {
return false;


+ 10
- 10
common/JackDebugClient.cpp View File

@@ -36,8 +36,8 @@ namespace Jack

JackDebugClient::JackDebugClient(JackClient * client)
{
fTotalPortNumber = 1; // The total number of port opened and maybe closed. Historical view.
fOpenPortNumber = 0; // The current number of opened port.
fTotalPortNumber = 1; // The total number of port opened and maybe closed. Historical view.
fOpenPortNumber = 0; // The current number of opened port.
fIsActivated = 0;
fIsDeactivated = 0;
fIsClosed = 0;
@@ -78,9 +78,9 @@ JackDebugClient::~JackDebugClient()
delete fClient;
}

int JackDebugClient::Open(const char* server_name, const char* name, jack_options_t options, jack_status_t* status)
int JackDebugClient::Open(const char* server_name, const char* name, int uuid, jack_options_t options, jack_status_t* status)
{
int res = fClient->Open(server_name, name, options, status);
int res = fClient->Open(server_name, name, uuid, options, status);
char provstr[256];
char buffer[256];
time_t curtime;
@@ -210,8 +210,8 @@ int JackDebugClient::PortUnRegister(jack_port_id_t port_index)
int res = fClient->PortUnRegister(port_index);
fOpenPortNumber--;
int i;
for (i = (fTotalPortNumber - 1); i >= 0; i--) { // We search the record into the history
if (fPortList[i].idport == port_index) { // We found the last record
for (i = (fTotalPortNumber - 1); i >= 0; i--) { // We search the record into the history
if (fPortList[i].idport == port_index) { // We found the last record
if (fPortList[i].IsUnregistered != 0)
*fStream << "!!! ERROR !!! : '" << fClientName << "' id deregistering port '" << fPortList[i].name << "' that have already been unregistered !" << endl;
fPortList[i].IsUnregistered++;
@@ -233,8 +233,8 @@ int JackDebugClient::PortConnect(const char* src, const char* dst)
*fStream << "!!! ERROR !!! Trying to connect a port ( " << src << " to " << dst << ") while the client has not been activated !" << endl;
int i;
int res = fClient->PortConnect( src, dst);
for (i = (fTotalPortNumber - 1); i >= 0; i--) { // We search the record into the history
if (strcmp(fPortList[i].name, src) == 0) { // We found the last record in sources
for (i = (fTotalPortNumber - 1); i >= 0; i--) { // We search the record into the history
if (strcmp(fPortList[i].name, src) == 0) { // We found the last record in sources
if (fPortList[i].IsUnregistered != 0)
*fStream << "!!! ERROR !!! Connecting port " << src << " previoulsy unregistered !" << endl;
fPortList[i].IsConnected++;
@@ -293,8 +293,8 @@ int JackDebugClient::PortDisconnect(jack_port_id_t src)
*fStream << "!!! ERROR !!! : Trying to disconnect port " << src << " while that client has not been activated !" << endl;
int res = fClient->PortDisconnect(src);
int i;
for (i = (fTotalPortNumber - 1); i >= 0; i--) { // We search the record into the history
if (fPortList[i].idport == src) { // We found the record in sources
for (i = (fTotalPortNumber - 1); i >= 0; i--) { // We search the record into the history
if (fPortList[i].idport == src) { // We found the record in sources
if (fPortList[i].IsUnregistered != 0)
*fStream << "!!! ERROR !!! : Disconnecting port " << src << " previoulsy unregistered !" << endl;
fPortList[i].IsConnected--;


+ 3
- 3
common/JackDebugClient.h View File

@@ -53,8 +53,8 @@ class JackDebugClient : public JackClient
JackClient* fClient;
std::ofstream* fStream;
PortFollower fPortList[MAX_PORT_HISTORY]; // Arbitrary value... To be tuned...
int fTotalPortNumber; // The total number of port opened and maybe closed. Historical view.
int fOpenPortNumber; // The current number of opened port.
int fTotalPortNumber; // The total number of port opened and maybe closed. Historical view.
int fOpenPortNumber; // The current number of opened port.
int fIsActivated;
int fIsDeactivated;
int fIsClosed;
@@ -68,7 +68,7 @@ class JackDebugClient : public JackClient
JackDebugClient(JackClient* fTheClient);
virtual ~JackDebugClient();

virtual int Open(const char* server_name, const char* name, jack_options_t options, jack_status_t* status);
virtual int Open(const char* server_name, const char* name, int uuid, jack_options_t options, jack_status_t* status);
int Close();

virtual JackGraphManager* GetGraphManager() const;


+ 189
- 12
common/JackEngine.cpp View File

@@ -44,12 +44,15 @@ JackEngine::JackEngine(JackGraphManager* manager,
fEngineControl = control;
for (int i = 0; i < CLIENT_NUM; i++)
fClientTable[i] = NULL;
fLastSwitchUsecs = 0;
fMaxUUID = 0;
fSessionPendingReplies = 0;
fSessionTransaction = NULL;
fSessionResult = NULL;
}

JackEngine::~JackEngine()
{
jack_log("JackEngine::~JackEngine");
}
{}

int JackEngine::Open()
{
@@ -134,7 +137,7 @@ void JackEngine::ReleaseRefnum(int ref)
void JackEngine::ProcessNext(jack_time_t cur_cycle_begin)
{
fLastSwitchUsecs = cur_cycle_begin;
if (fGraphManager->RunNextGraph()) // True if the graph actually switched to a new state
if (fGraphManager->RunNextGraph()) // True if the graph actually switched to a new state
fChannel.Notify(ALL_CLIENTS, kGraphOrderCallback, 0);
fSignal.Signal(); // Signal for threads waiting for next cycle
}
@@ -386,7 +389,7 @@ int JackEngine::InternalClientUnload(int refnum, int* status)
// Client management
//-------------------

int JackEngine::ClientCheck(const char* name, char* name_res, int protocol, int options, int* status)
int JackEngine::ClientCheck(const char* name, int uuid, char* name_res, int protocol, int options, int* status)
{
// Clear status
*status = 0;
@@ -400,7 +403,11 @@ int JackEngine::ClientCheck(const char* name, char* name_res, int protocol, int
return -1;
}

if (ClientCheckName(name)) {
std::map<int,std::string>::iterator res = fReservationMap.find(uuid);

if (res != fReservationMap.end()) {
strncpy( name_res, res->second.c_str(), JACK_CLIENT_NAME_SIZE );
} else if (ClientCheckName(name)) {

*status |= JackNameNotUnique;

@@ -426,7 +433,7 @@ bool JackEngine::GenerateUniqueName(char* name)

if (length > JACK_CLIENT_NAME_SIZE - 4) {
jack_error("%s exists and is too long to make unique", name);
return true; /* failure */
return true; /* failure */
}

/* generate a unique name by appending "-01".."-99" */
@@ -460,9 +467,32 @@ bool JackEngine::ClientCheckName(const char* name)
return true;
}

for (std::map<int,std::string>::iterator i=fReservationMap.begin(); i!=fReservationMap.end(); i++) {
if (i->second == name)
return true;
}

return false;
}

int JackEngine::GetNewUUID()
{
return fMaxUUID++;
}

void JackEngine::EnsureUUID(int uuid)
{
if (uuid > fMaxUUID)
fMaxUUID = uuid+1;

for (int i = 0; i < CLIENT_NUM; i++) {
JackClientInterface* client = fClientTable[i];
if (client && (client->GetClientControl()->fSessionID==uuid)) {
client->GetClientControl()->fSessionID = GetNewUUID();
}
}
}

int JackEngine::GetClientPID(const char* name)
{
for (int i = 0; i < CLIENT_NUM; i++) {
@@ -486,9 +516,26 @@ int JackEngine::GetClientRefNum(const char* name)
}

// Used for external clients
int JackEngine::ClientExternalOpen(const char* name, int pid, int* ref, int* shared_engine, int* shared_client, int* shared_graph_manager)
int JackEngine::ClientExternalOpen(const char* name, int pid, int uuid, int* ref, int* shared_engine, int* shared_client, int* shared_graph_manager)
{
jack_log("JackEngine::ClientExternalOpen: name = %s ", name);
char real_name[JACK_CLIENT_NAME_SIZE+1];

if (uuid < 0) {
uuid = GetNewUUID();
strncpy( real_name, name, JACK_CLIENT_NAME_SIZE );
} else {
std::map<int,std::string>::iterator res = fReservationMap.find(uuid);
if (res != fReservationMap.end()) {
strncpy( real_name, res->second.c_str(), JACK_CLIENT_NAME_SIZE );
fReservationMap.erase(uuid);
} else {
strncpy( real_name, name, JACK_CLIENT_NAME_SIZE );
}

EnsureUUID(uuid);
}

jack_log("JackEngine::ClientExternalOpen: uuid=%d, name = %s ", uuid, real_name);

int refnum = AllocateRefnum();
if (refnum < 0) {
@@ -498,12 +545,12 @@ int JackEngine::ClientExternalOpen(const char* name, int pid, int* ref, int* sha

JackExternalClient* client = new JackExternalClient();

if (!fSynchroTable[refnum].Allocate(name, fEngineControl->fServerName, 0)) {
if (!fSynchroTable[refnum].Allocate(real_name, fEngineControl->fServerName, 0)) {
jack_error("Cannot allocate synchro");
goto error;
}

if (client->Open(name, pid, refnum, shared_client) < 0) {
if (client->Open(real_name, pid, refnum, uuid, shared_client) < 0) {
jack_error("Cannot open client");
goto error;
}
@@ -516,7 +563,7 @@ int JackEngine::ClientExternalOpen(const char* name, int pid, int* ref, int* sha

fClientTable[refnum] = client;

if (NotifyAddClient(client, name, refnum) < 0) {
if (NotifyAddClient(client, real_name, refnum) < 0) {
jack_error("Cannot notify add client");
goto error;
}
@@ -863,5 +910,135 @@ int JackEngine::PortRename(int refnum, jack_port_id_t port, const char* name)
return 0;
}

void JackEngine::SessionNotify(int refnum, const char *target, jack_session_event_type_t type, const char *path, JackChannelTransaction *socket)
{
if (fSessionPendingReplies != 0) {
JackSessionNotifyResult res(-1);
res.Write(socket);
jack_log("JackEngine::SessionNotify ... busy");
return;
}

for (int i = 0; i < CLIENT_NUM; i++) {
JackClientInterface* client = fClientTable[i];
if (client && (client->GetClientControl()->fSessionID < 0)) {
client->GetClientControl()->fSessionID = GetNewUUID();
}
}
fSessionResult = new JackSessionNotifyResult();

for (int i = 0; i < CLIENT_NUM; i++) {
JackClientInterface* client = fClientTable[i];
if (client && client->GetClientControl()->fCallback[kSessionCallback]) {

// check if this is a notification to a specific client.
if (target!=NULL && strlen(target)!=0) {
if (strcmp(target, client->GetClientControl()->fName)) {
continue;
}
}

char path_buf[JACK_PORT_NAME_SIZE];
snprintf( path_buf, sizeof(path_buf), "%s%s%c", path, client->GetClientControl()->fName, DIR_SEPARATOR );
int res = JackTools::MkDir(path_buf);
if (res)
jack_error( "JackEngine::SessionNotify: can not create session directory '%s'", path_buf );
int result = client->ClientNotify(i, client->GetClientControl()->fName, kSessionCallback, true, path_buf, (int) type, 0);

if (result == 2) {
fSessionPendingReplies += 1;
} else if (result == 1) {
char uuid_buf[JACK_UUID_SIZE];
snprintf( uuid_buf, sizeof(uuid_buf), "%d", client->GetClientControl()->fSessionID );
fSessionResult->fCommandList.push_back( JackSessionCommand( uuid_buf,
client->GetClientControl()->fName,
client->GetClientControl()->fSessionCommand,
client->GetClientControl()->fSessionFlags ));
}
}
}

if (fSessionPendingReplies == 0) {
fSessionResult->Write(socket);
delete fSessionResult;
fSessionResult = NULL;
} else {
fSessionTransaction = socket;
}
}

void JackEngine::SessionReply(int refnum)
{
JackClientInterface* client = fClientTable[refnum];
char uuid_buf[JACK_UUID_SIZE];
snprintf( uuid_buf, sizeof(uuid_buf), "%d", client->GetClientControl()->fSessionID );
fSessionResult->fCommandList.push_back( JackSessionCommand( uuid_buf,
client->GetClientControl()->fName,
client->GetClientControl()->fSessionCommand,
client->GetClientControl()->fSessionFlags ));
fSessionPendingReplies -= 1;

if (fSessionPendingReplies == 0) {
fSessionResult->Write(fSessionTransaction);
delete fSessionResult;
fSessionResult = NULL;
}
}

void JackEngine::GetUUIDForClientName(const char *client_name, char *uuid_res, int *result)
{
for (int i = 0; i < CLIENT_NUM; i++) {
JackClientInterface* client = fClientTable[i];

if (client && (strcmp(client_name, client->GetClientControl()->fName)==0)) {
snprintf(uuid_res, JACK_UUID_SIZE, "%d", client->GetClientControl()->fSessionID);
*result = 0;
return;
}
}
// did not find name.
*result = -1;
return;
}

void JackEngine::GetClientNameForUUID(const char *uuid, char *name_res, int *result)
{
for (int i = 0; i < CLIENT_NUM; i++) {
JackClientInterface* client = fClientTable[i];

if (!client)
continue;

char uuid_buf[JACK_UUID_SIZE];
snprintf(uuid_buf, JACK_UUID_SIZE, "%d", client->GetClientControl()->fSessionID);

if (strcmp(uuid,uuid_buf) == 0) {
strncpy(name_res, client->GetClientControl()->fName, JACK_CLIENT_NAME_SIZE);
*result = 0;
return;
}
}
// did not find uuid.
*result = -1;
return;
}

void JackEngine::ReserveClientName(const char *name, const char *uuid, int *result)
{
jack_log( "JackEngine::ReserveClientName ( name = %s, uuid = %s )", name, uuid );

if (ClientCheckName(name)) {
*result = -1;
jack_log( "name already taken" );
return;
}

EnsureUUID(atoi(uuid));
fReservationMap[atoi(uuid)] = name;
*result = 0;
}

} // end of namespace


+ 18
- 2
common/JackEngine.h View File

@@ -52,6 +52,12 @@ class SERVER_EXPORT JackEngine : public JackLockAble
JackProcessSync fSignal;
jack_time_t fLastSwitchUsecs;

int fSessionPendingReplies;
JackChannelTransaction *fSessionTransaction;
JackSessionNotifyResult *fSessionResult;
std::map<int,std::string> fReservationMap;
int fMaxUUID;

int ClientCloseAux(int refnum, JackClientInterface* client, bool wait);
void CheckXRun(jack_time_t callback_usecs);

@@ -74,6 +80,9 @@ class SERVER_EXPORT JackEngine : public JackLockAble
void NotifyPortConnect(jack_port_id_t src, jack_port_id_t dst, bool onoff);
void NotifyPortRename(jack_port_id_t src, const char* old_name);
void NotifyActivate(int refnum);
int GetNewUUID();
void EnsureUUID(int uuid);
bool CheckClient(int refnum)
{
@@ -89,8 +98,8 @@ class SERVER_EXPORT JackEngine : public JackLockAble
int Close();
// Client management
int ClientCheck(const char* name, char* name_res, int protocol, int options, int* status);
int ClientExternalOpen(const char* name, int pid, int* ref, int* shared_engine, int* shared_client, int* shared_graph_manager);
int ClientCheck(const char* name, int uuid, char* name_res, int protocol, int options, int* status);
int ClientExternalOpen(const char* name, int pid, int uuid, int* ref, int* shared_engine, int* shared_client, int* shared_graph_manager);
int ClientInternalOpen(const char* name, int* ref, JackEngineControl** shared_engine, JackGraphManager** shared_manager, JackClientInterface* client, bool wait);

int ClientExternalClose(int refnum);
@@ -131,6 +140,13 @@ class SERVER_EXPORT JackEngine : public JackLockAble
void NotifySampleRate(jack_nframes_t sample_rate);
void NotifyFreewheel(bool onoff);
void NotifyQuit();

void SessionNotify( int refnum, const char *target, jack_session_event_type_t type, const char *path, JackChannelTransaction *socket );
void SessionReply( int refnum );
void GetUUIDForClientName(const char *client_name, char *uuid_res, int *result);
void GetClientNameForUUID(const char *uuid, char *name_res, int *result);
void ReserveClientName(const char *name, const char *uuid, int *result);
};




+ 2
- 2
common/JackExternalClient.cpp View File

@@ -41,7 +41,7 @@ int JackExternalClient::ClientNotify(int refnum, const char* name, int notify, i
return result;
}

int JackExternalClient::Open(const char* name, int pid, int refnum, int* shared_client)
int JackExternalClient::Open(const char* name, int pid, int refnum, int uuid, int* shared_client)
{
try {

@@ -53,7 +53,7 @@ int JackExternalClient::Open(const char* name, int pid, int refnum, int* shared_
// Use "placement new" to allocate object in shared memory
JackShmMemAble* shared_mem = static_cast<JackShmMemAble*>(JackShmMem::operator new(sizeof(JackClientControl)));
shared_mem->Init();
fClientControl = new(shared_mem) JackClientControl(name, pid, refnum);
fClientControl = new(shared_mem) JackClientControl(name, pid, refnum, uuid);
if (!fClientControl) {
jack_error("Cannot allocate client shared memory segment");


+ 2
- 2
common/JackExternalClient.h View File

@@ -39,14 +39,14 @@ class JackExternalClient : public JackClientInterface
private:

JackNotifyChannel fChannel; /*! Server/client communication channel */
JackClientControl* fClientControl; /*! Client control in shared memory */
JackClientControl* fClientControl; /*! Client control in shared memory */

public:

JackExternalClient();
virtual ~JackExternalClient();

int Open(const char* name, int pid, int refnum, int* shared_client);
int Open(const char* name, int pid, int refnum, int uuid, int* shared_client);
int Close();

int ClientNotify(int refnum, const char* name, int notify, int sync, const char* message, int value1, int value2);


+ 6
- 6
common/JackInternalClient.cpp View File

@@ -63,7 +63,7 @@ JackInternalClient::~JackInternalClient()
delete fChannel;
}

int JackInternalClient::Open(const char* server_name, const char* name, jack_options_t options, jack_status_t* status)
int JackInternalClient::Open(const char* server_name, const char* name, int uuid, jack_options_t options, jack_status_t* status)
{
int result;
char name_res[JACK_CLIENT_NAME_SIZE + 1];
@@ -71,7 +71,7 @@ int JackInternalClient::Open(const char* server_name, const char* name, jack_opt

strncpy(fServerName, server_name, sizeof(fServerName));

fChannel->ClientCheck(name, name_res, JACK_PROTOCOL_VERSION, (int)options, (int*)status, &result);
fChannel->ClientCheck(name, uuid, name_res, JACK_PROTOCOL_VERSION, (int)options, (int*)status, &result);
if (result < 0) {
int status1 = *status;
if (status1 & JackVersionError)
@@ -198,11 +198,11 @@ JackLoadableInternalClient::~JackLoadableInternalClient()
UnloadJackModule(fHandle);
}

int JackLoadableInternalClient1::Open(const char* server_name, const char* name, jack_options_t options, jack_status_t* status)
int JackLoadableInternalClient1::Open(const char* server_name, const char* name, int uuid, jack_options_t options, jack_status_t* status)
{
int res = -1;
if (JackInternalClient::Open(server_name, name, options, status) == 0) {
if (JackInternalClient::Open(server_name, name, uuid, options, status) == 0) {
if (fInitialize((jack_client_t*)this, fObjectData) == 0) {
res = 0;
} else {
@@ -214,11 +214,11 @@ int JackLoadableInternalClient1::Open(const char* server_name, const char* name,
return res;
}

int JackLoadableInternalClient2::Open(const char* server_name, const char* name, jack_options_t options, jack_status_t* status)
int JackLoadableInternalClient2::Open(const char* server_name, const char* name, int uuid, jack_options_t options, jack_status_t* status)
{
int res = -1;
if (JackInternalClient::Open(server_name, name, options, status) == 0) {
if (JackInternalClient::Open(server_name, name, uuid, options, status) == 0) {
if (fInitialize((jack_client_t*)this, fParameters) == 0) {
res = 0;
} else {


+ 5
- 5
common/JackInternalClient.h View File

@@ -46,14 +46,14 @@ class JackInternalClient : public JackClient
JackInternalClient(JackServer* server, JackSynchro* table);
virtual ~JackInternalClient();

int Open(const char* server_name, const char* name, jack_options_t options, jack_status_t* status);
int Open(const char* server_name, const char* name, int uuid, jack_options_t options, jack_status_t* status);

JackGraphManager* GetGraphManager() const;
JackEngineControl* GetEngineControl() const;
JackClientControl* GetClientControl() const;

static JackGraphManager* fGraphManager; /*! Shared memory Port manager */
static JackEngineControl* fEngineControl; /*! Shared engine cotrol */
static JackGraphManager* fGraphManager; /*! Shared memory Port manager */
static JackEngineControl* fEngineControl; /*! Shared engine cotrol */
};

/*!
@@ -100,7 +100,7 @@ class JackLoadableInternalClient1 : public JackLoadableInternalClient
{}

int Init(const char* so_name);
int Open(const char* server_name, const char* name, jack_options_t options, jack_status_t* status);
int Open(const char* server_name, const char* name, int uuid, jack_options_t options, jack_status_t* status);

};

@@ -119,7 +119,7 @@ class JackLoadableInternalClient2 : public JackLoadableInternalClient
{}

int Init(const char* so_name);
int Open(const char* server_name, const char* name, jack_options_t options, jack_status_t* status);
int Open(const char* server_name, const char* name, int uuid, jack_options_t options, jack_status_t* status);

};



+ 9
- 4
common/JackInternalClientChannel.h View File

@@ -50,9 +50,9 @@ class JackInternalClientChannel : public detail::JackClientChannelInterface
return 0;
}

void ClientCheck(const char* name, char* name_res, int protocol, int options, int* status, int* result)
void ClientCheck(const char* name, int uuid, char* name_res, int protocol, int options, int* status, int* result)
{
*result = fEngine->ClientCheck(name, name_res, protocol, options, status);
*result = fEngine->ClientCheck(name, uuid, name_res, protocol, options, status);
}
void ClientOpen(const char* name, int* ref, JackEngineControl** shared_engine, JackGraphManager** shared_manager, JackClientInterface* client, int* result)
{
@@ -112,6 +112,11 @@ class JackInternalClientChannel : public detail::JackClientChannelInterface
*result = fServer->SetFreewheel(onoff);
}

void SessionNotify( int refnum, const char *target, jack_session_event_type_t type, const char *path, jack_session_command_t **result )
{
*result = NULL;
}

void ReleaseTimebase(int refnum, int* result)
{
*result = fServer->ReleaseTimebase(refnum);
@@ -132,9 +137,9 @@ class JackInternalClientChannel : public detail::JackClientChannelInterface
*result = fEngine->InternalClientHandle(client_name, status, int_ref);
}

void InternalClientLoad(int refnum, const char* client_name, const char* so_name, const char* objet_data, int options, int* status, int* int_ref, int* result)
void InternalClientLoad(int refnum, const char* client_name, const char* so_name, const char* objet_data, int options, int* status, int* int_ref, int uuid, int* result)
{
*result = fServer->InternalClientLoad(client_name, so_name, objet_data, options, int_ref, status);
*result = fServer->InternalClientLoad(client_name, so_name, objet_data, options, int_ref, uuid, status);
}

void InternalClientUnload(int refnum, int int_ref, int* status, int* result)


+ 5
- 5
common/JackLibAPI.cpp View File

@@ -57,7 +57,7 @@ int JackLibGlobals::fClientCount = 0;

jack_client_t* jack_client_new_aux(const char* client_name, jack_options_t options, jack_status_t* status)
{
jack_varargs_t va; /* variable arguments */
jack_varargs_t va; /* variable arguments */
jack_status_t my_status;
JackClient* client;
@@ -68,8 +68,8 @@ jack_client_t* jack_client_new_aux(const char* client_name, jack_options_t optio

jack_log("jack_client_new %s", client_name);
if (status == NULL) /* no status from caller? */
status = &my_status; /* use local status word */
if (status == NULL) /* no status from caller? */
status = &my_status; /* use local status word */
*status = (jack_status_t)0;

/* validate parameters */
@@ -96,7 +96,7 @@ jack_client_t* jack_client_new_aux(const char* client_name, jack_options_t optio
client = new JackLibClient(GetSynchroTable());
}

int res = client->Open(va.server_name, client_name, options, status);
int res = client->Open(va.server_name, client_name, va.session_id, options, status);
if (res < 0) {
delete client;
JackLibGlobals::Destroy(); // jack library destruction
@@ -149,7 +149,7 @@ jack_client_t* jack_client_open_aux(const char* client_name, jack_options_t opti
client = new JackLibClient(GetSynchroTable());
}

int res = client->Open(va.server_name, client_name, options, status);
int res = client->Open(va.server_name, client_name, va.session_id, options, status);
if (res < 0) {
delete client;
JackLibGlobals::Destroy(); // jack library destruction


+ 3
- 3
common/JackLibClient.cpp View File

@@ -67,7 +67,7 @@ JackLibClient::~JackLibClient()
delete fChannel;
}

int JackLibClient::Open(const char* server_name, const char* name, jack_options_t options, jack_status_t* status)
int JackLibClient::Open(const char* server_name, const char* name, int uuid, jack_options_t options, jack_status_t* status)
{
int shared_engine, shared_client, shared_graph, result;
jack_log("JackLibClient::Open name = %s", name);
@@ -76,7 +76,7 @@ int JackLibClient::Open(const char* server_name, const char* name, jack_options_

// Open server/client channel
char name_res[JACK_CLIENT_NAME_SIZE + 1];
if (fChannel->Open(server_name, name, name_res, this, options, status) < 0) {
if (fChannel->Open(server_name, name, uuid, name_res, this, options, status) < 0) {
jack_error("Cannot connect to the server");
goto error;
}
@@ -88,7 +88,7 @@ int JackLibClient::Open(const char* server_name, const char* name, jack_options_
}

// Require new client
fChannel->ClientOpen(name_res, JackTools::GetPID(), &shared_engine, &shared_client, &shared_graph, &result);
fChannel->ClientOpen(name_res, JackTools::GetPID(), uuid, &shared_engine, &shared_client, &shared_graph, &result);
if (result < 0) {
jack_error("Cannot open %s client", name_res);
goto error;


+ 2
- 2
common/JackLibClient.h View File

@@ -37,14 +37,14 @@ class JackLibClient : public JackClient

private:

JackShmReadWritePtr1<JackClientControl> fClientControl; /*! Shared client control */
JackShmReadWritePtr1<JackClientControl> fClientControl; /*! Shared client control */

public:

JackLibClient(JackSynchro* table);
virtual ~JackLibClient();

int Open(const char* server_name, const char* name, jack_options_t options, jack_status_t* status);
int Open(const char* server_name, const char* name, int uuid, jack_options_t options, jack_status_t* status);

int ClientNotifyImp(int refnum, const char* name, int notify, int sync, const char* message, int value1, int value2);



+ 41
- 4
common/JackLockedEngine.h View File

@@ -96,18 +96,18 @@ class SERVER_EXPORT JackLockedEngine
}
// Client management
int ClientCheck(const char* name, char* name_res, int protocol, int options, int* status)
int ClientCheck(const char* name, int uuid, char* name_res, int protocol, int options, int* status)
{
TRY_CALL
JackLock lock(&fEngine);
return fEngine.ClientCheck(name, name_res, protocol, options, status);
return fEngine.ClientCheck(name, uuid, name_res, protocol, options, status);
CATCH_EXCEPTION_RETURN
}
int ClientExternalOpen(const char* name, int pid, int* ref, int* shared_engine, int* shared_client, int* shared_graph_manager)
int ClientExternalOpen(const char* name, int pid, int uuid, int* ref, int* shared_engine, int* shared_client, int* shared_graph_manager)
{
TRY_CALL
JackLock lock(&fEngine);
return fEngine.ClientExternalOpen(name, pid, ref, shared_engine, shared_client, shared_graph_manager);
return fEngine.ClientExternalOpen(name, pid, uuid, ref, shared_engine, shared_client, shared_graph_manager);
CATCH_EXCEPTION_RETURN
}
int ClientInternalOpen(const char* name, int* ref, JackEngineControl** shared_engine, JackGraphManager** shared_manager, JackClientInterface* client, bool wait)
@@ -306,7 +306,44 @@ class SERVER_EXPORT JackLockedEngine
return fEngine.NotifyQuit();
CATCH_EXCEPTION
}

void SessionNotify(int refnum, const char* target, jack_session_event_type_t type, const char *path, JackChannelTransaction *socket)
{
TRY_CALL
JackLock lock(&fEngine);
fEngine.SessionNotify(refnum, target, type, path, socket);
CATCH_EXCEPTION
}
void SessionReply(int refnum)
{
TRY_CALL
JackLock lock(&fEngine);
fEngine.SessionReply(refnum);
CATCH_EXCEPTION
}
void GetUUIDForClientName(const char *client_name, char *uuid_res, int *result)
{
TRY_CALL
JackLock lock(&fEngine);
fEngine.GetUUIDForClientName(client_name, uuid_res, result);
CATCH_EXCEPTION
}
void GetClientNameForUUID(const char *uuid, char *name_res, int *result)
{
TRY_CALL
JackLock lock(&fEngine);
fEngine.GetClientNameForUUID(uuid, name_res, result);
CATCH_EXCEPTION
}
void ReserveClientName(const char *name, const char *uuid, int *result)
{
TRY_CALL
JackLock lock(&fEngine);
fEngine.ReserveClientName(name, uuid, result);
CATCH_EXCEPTION
}
};

} // end of namespace


+ 296
- 306
common/JackNetOneDriver.cpp View File

@@ -54,36 +54,36 @@ namespace Jack
{
jack_log ( "JackNetOneDriver::JackNetOneDriver port %d", port );

#ifdef WIN32
WSADATA wsa;
int rc = WSAStartup(MAKEWORD(2,0),&wsa);
#endif
netjack_init( & (this->netj),
NULL, // client
name,
capture_ports,
playback_ports,
midi_input_ports,
midi_output_ports,
sample_rate,
period_size,
port,
transport_sync,
resample_factor,
0,
bitdepth,
use_autoconfig,
latency,
redundancy,
dont_htonl_floats,
always_deadline,
jitter_val);
#ifdef WIN32
WSADATA wsa;
int rc = WSAStartup(MAKEWORD(2,0),&wsa);
#endif
netjack_init( & (this->netj),
NULL, // client
name,
capture_ports,
playback_ports,
midi_input_ports,
midi_output_ports,
sample_rate,
period_size,
port,
transport_sync,
resample_factor,
0,
bitdepth,
use_autoconfig,
latency,
redundancy,
dont_htonl_floats,
always_deadline,
jitter_val);
}

JackNetOneDriver::~JackNetOneDriver()
{
// No destructor yet.
// No destructor yet.
}

//open, close, attach and detach------------------------------------------------------
@@ -135,49 +135,49 @@ namespace Jack

int JackNetOneDriver::AllocPorts()
{
jack_port_id_t port_id;
char buf[64];
unsigned int chn;
jack_port_id_t port_id;
char buf[64];
unsigned int chn;

//if (netj.handle_transport_sync)
// jack_set_sync_callback(netj.client, (JackSyncCallback) net_driver_sync_cb, NULL);
//if (netj.handle_transport_sync)
// jack_set_sync_callback(netj.client, (JackSyncCallback) net_driver_sync_cb, NULL);

for (chn = 0; chn < netj.capture_channels_audio; chn++) {
snprintf (buf, sizeof(buf) - 1, "system:capture_%u", chn + 1);
for (chn = 0; chn < netj.capture_channels_audio; chn++) {
snprintf (buf, sizeof(buf) - 1, "system:capture_%u", chn + 1);

if ( ( port_id = fGraphManager->AllocatePort ( fClientControl.fRefNum, buf, JACK_DEFAULT_AUDIO_TYPE,
CaptureDriverFlags, fEngineControl->fBufferSize ) ) == NO_PORT )
{
jack_error ( "driver: cannot register port for %s", buf );
return -1;
if ( ( port_id = fGraphManager->AllocatePort ( fClientControl.fRefNum, buf, JACK_DEFAULT_AUDIO_TYPE,
CaptureDriverFlags, fEngineControl->fBufferSize ) ) == NO_PORT )
{
jack_error ( "driver: cannot register port for %s", buf );
return -1;
}
//port = fGraphManager->GetPort ( port_id );

netj.capture_ports =
jack_slist_append (netj.capture_ports, (void *)(intptr_t)port_id);

if( netj.bitdepth == CELT_MODE ) {
#if HAVE_CELT
#if HAVE_CELT_API_0_7
celt_int32 lookahead;
CELTMode *celt_mode = celt_mode_create( netj.sample_rate, netj.period_size, NULL );
netj.capture_srcs = jack_slist_append(netj.capture_srcs, celt_decoder_create( celt_mode, 1, NULL ) );
#else
celt_int32_t lookahead;
CELTMode *celt_mode = celt_mode_create( netj.sample_rate, 1, netj.period_size, NULL );
netj.capture_srcs = jack_slist_append(netj.capture_srcs, celt_decoder_create( celt_mode ) );
#endif
celt_mode_info( celt_mode, CELT_GET_LOOKAHEAD, &lookahead );
netj.codec_latency = 2*lookahead;
#endif
} else {
#if HAVE_SAMPLERATE
netj.capture_srcs = jack_slist_append(netj.capture_srcs, (void *)src_new(SRC_LINEAR, 1, NULL));
#endif
}
//port = fGraphManager->GetPort ( port_id );

netj.capture_ports =
jack_slist_append (netj.capture_ports, (void *)(intptr_t)port_id);

if( netj.bitdepth == CELT_MODE ) {
#if HAVE_CELT
#if HAVE_CELT_API_0_7
celt_int32 lookahead;
CELTMode *celt_mode = celt_mode_create( netj.sample_rate, netj.period_size, NULL );
netj.capture_srcs = jack_slist_append(netj.capture_srcs, celt_decoder_create( celt_mode, 1, NULL ) );
#else
celt_int32_t lookahead;
CELTMode *celt_mode = celt_mode_create( netj.sample_rate, 1, netj.period_size, NULL );
netj.capture_srcs = jack_slist_append(netj.capture_srcs, celt_decoder_create( celt_mode ) );
#endif
celt_mode_info( celt_mode, CELT_GET_LOOKAHEAD, &lookahead );
netj.codec_latency = 2*lookahead;
#endif
} else {
#if HAVE_SAMPLERATE
netj.capture_srcs = jack_slist_append(netj.capture_srcs, (void *)src_new(SRC_LINEAR, 1, NULL));
#endif
}
}
for (chn = netj.capture_channels_audio; chn < netj.capture_channels; chn++) {
snprintf (buf, sizeof(buf) - 1, "system:capture_%u", chn + 1);
}
for (chn = netj.capture_channels_audio; chn < netj.capture_channels; chn++) {
snprintf (buf, sizeof(buf) - 1, "system:capture_%u", chn + 1);

if ( ( port_id = fGraphManager->AllocatePort ( fClientControl.fRefNum, buf, JACK_DEFAULT_MIDI_TYPE,
CaptureDriverFlags, fEngineControl->fBufferSize ) ) == NO_PORT )
@@ -187,12 +187,12 @@ namespace Jack
}
//port = fGraphManager->GetPort ( port_id );

netj.capture_ports =
jack_slist_append (netj.capture_ports, (void *)(intptr_t)port_id);
}
netj.capture_ports =
jack_slist_append (netj.capture_ports, (void *)(intptr_t)port_id);
}

for (chn = 0; chn < netj.playback_channels_audio; chn++) {
snprintf (buf, sizeof(buf) - 1, "system:playback_%u", chn + 1);
for (chn = 0; chn < netj.playback_channels_audio; chn++) {
snprintf (buf, sizeof(buf) - 1, "system:playback_%u", chn + 1);

if ( ( port_id = fGraphManager->AllocatePort ( fClientControl.fRefNum, buf, JACK_DEFAULT_AUDIO_TYPE,
PlaybackDriverFlags, fEngineControl->fBufferSize ) ) == NO_PORT )
@@ -202,27 +202,27 @@ namespace Jack
}
//port = fGraphManager->GetPort ( port_id );

netj.playback_ports =
jack_slist_append (netj.playback_ports, (void *)(intptr_t)port_id);
if( netj.bitdepth == CELT_MODE ) {
#if HAVE_CELT
#if HAVE_CELT_API_0_7
CELTMode *celt_mode = celt_mode_create( netj.sample_rate, netj.period_size, NULL );
netj.playback_srcs = jack_slist_append(netj.playback_srcs, celt_encoder_create( celt_mode, 1, NULL ) );
#else
CELTMode *celt_mode = celt_mode_create( netj.sample_rate, 1, netj.period_size, NULL );
netj.playback_srcs = jack_slist_append(netj.playback_srcs, celt_encoder_create( celt_mode ) );
#endif
#endif
} else {
#if HAVE_SAMPLERATE
netj.playback_srcs = jack_slist_append(netj.playback_srcs, (void *)src_new(SRC_LINEAR, 1, NULL));
#endif
}
}
for (chn = netj.playback_channels_audio; chn < netj.playback_channels; chn++) {
snprintf (buf, sizeof(buf) - 1, "system:playback_%u", chn + 1);
netj.playback_ports =
jack_slist_append (netj.playback_ports, (void *)(intptr_t)port_id);
if( netj.bitdepth == CELT_MODE ) {
#if HAVE_CELT
#if HAVE_CELT_API_0_7
CELTMode *celt_mode = celt_mode_create( netj.sample_rate, netj.period_size, NULL );
netj.playback_srcs = jack_slist_append(netj.playback_srcs, celt_encoder_create( celt_mode, 1, NULL ) );
#else
CELTMode *celt_mode = celt_mode_create( netj.sample_rate, 1, netj.period_size, NULL );
netj.playback_srcs = jack_slist_append(netj.playback_srcs, celt_encoder_create( celt_mode ) );
#endif
#endif
} else {
#if HAVE_SAMPLERATE
netj.playback_srcs = jack_slist_append(netj.playback_srcs, (void *)src_new(SRC_LINEAR, 1, NULL));
#endif
}
}
for (chn = netj.playback_channels_audio; chn < netj.playback_channels; chn++) {
snprintf (buf, sizeof(buf) - 1, "system:playback_%u", chn + 1);

if ( ( port_id = fGraphManager->AllocatePort ( fClientControl.fRefNum, buf, JACK_DEFAULT_MIDI_TYPE,
PlaybackDriverFlags, fEngineControl->fBufferSize ) ) == NO_PORT )
@@ -232,10 +232,10 @@ namespace Jack
}
//port = fGraphManager->GetPort ( port_id );

netj.playback_ports =
jack_slist_append (netj.playback_ports, (void *)(intptr_t)port_id);
}
return 0;
netj.playback_ports =
jack_slist_append (netj.playback_ports, (void *)(intptr_t)port_id);
}
return 0;
}

//init and restart--------------------------------------------------------------------
@@ -243,16 +243,16 @@ namespace Jack
{
jack_log ( "JackNetOneDriver::Init()" );

if( global_packcache != NULL ) {
FreePorts();
netjack_release( &netj );
}
if( global_packcache != NULL ) {
FreePorts();
netjack_release( &netj );
}

//display some additional infos
jack_info ( "NetOne driver started" );
if( netjack_startup( &netj ) ) {
return false;
}
if( netjack_startup( &netj ) ) {
return false;
}

//register jack ports
if ( AllocPorts() != 0 )
@@ -261,7 +261,6 @@ namespace Jack
return false;
}


//monitor
//driver parametering
JackAudioDriver::SetBufferSize ( netj.period_size );
@@ -281,161 +280,160 @@ namespace Jack
//driver processes--------------------------------------------------------------------
int JackNetOneDriver::Read()
{
int delay;
delay = netjack_wait( &netj );
if( delay ) {
NotifyXRun(fBeginDateUst, (float) delay);
jack_error( "netxruns... duration: %dms", delay/1000 );
}
int delay;
delay = netjack_wait( &netj );
if( delay ) {
NotifyXRun(fBeginDateUst, (float) delay);
jack_error( "netxruns... duration: %dms", delay/1000 );
}

if( (netj.num_lost_packets * netj.period_size / netj.sample_rate) > 2 )
JackTools::ThrowJackNetException();
if( (netj.num_lost_packets * netj.period_size / netj.sample_rate) > 2 )
JackTools::ThrowJackNetException();

//netjack_read( &netj, netj.period_size );
//netjack_read( &netj, netj.period_size );
JackDriver::CycleTakeBeginTime();

jack_position_t local_trans_pos;
jack_transport_state_t local_trans_state;
jack_position_t local_trans_pos;
jack_transport_state_t local_trans_state;

unsigned int *packet_buf, *packet_bufX;
unsigned int *packet_buf, *packet_bufX;

if( ! netj.packet_data_valid ) {
if( ! netj.packet_data_valid ) {
jack_log( "data not valid" );
render_payload_to_jack_ports (netj.bitdepth, NULL, netj.net_period_down, netj.capture_ports, netj.capture_srcs, netj.period_size, netj.dont_htonl_floats );
return 0;
}
packet_buf = netj.rx_buf;
render_payload_to_jack_ports (netj.bitdepth, NULL, netj.net_period_down, netj.capture_ports, netj.capture_srcs, netj.period_size, netj.dont_htonl_floats );
return 0;
}
packet_buf = netj.rx_buf;

jacknet_packet_header *pkthdr = (jacknet_packet_header *)packet_buf;
jacknet_packet_header *pkthdr = (jacknet_packet_header *)packet_buf;

packet_bufX = packet_buf + sizeof(jacknet_packet_header) / sizeof(jack_default_audio_sample_t);
packet_bufX = packet_buf + sizeof(jacknet_packet_header) / sizeof(jack_default_audio_sample_t);

netj.reply_port = pkthdr->reply_port;
netj.latency = pkthdr->latency;
netj.reply_port = pkthdr->reply_port;
netj.latency = pkthdr->latency;

// Special handling for latency=0
if( netj.latency == 0 )
netj.resync_threshold = 0;
else
netj.resync_threshold = MIN( 15, pkthdr->latency-1 );
// Special handling for latency=0
if( netj.latency == 0 )
netj.resync_threshold = 0;
else
netj.resync_threshold = MIN( 15, pkthdr->latency-1 );

// check whether, we should handle the transport sync stuff, or leave trnasports untouched.
if (netj.handle_transport_sync) {
#if 1
unsigned int compensated_tranport_pos = (pkthdr->transport_frame + (pkthdr->latency * netj.period_size) + netj.codec_latency);
// check whether, we should handle the transport sync stuff, or leave trnasports untouched.
if (netj.handle_transport_sync) {
#if 1
unsigned int compensated_tranport_pos = (pkthdr->transport_frame + (pkthdr->latency * netj.period_size) + netj.codec_latency);

// read local transport info....
//local_trans_state = jack_transport_query(netj.client, &local_trans_pos);
// read local transport info....
//local_trans_state = jack_transport_query(netj.client, &local_trans_pos);

local_trans_state = fEngineControl->fTransport.Query ( &local_trans_pos );

// Now check if we have to start or stop local transport to sync to remote...
switch (pkthdr->transport_state) {
case JackTransportStarting:
// the master transport is starting... so we set our reply to the sync_callback;
if (local_trans_state == JackTransportStopped) {
fEngineControl->fTransport.SetCommand ( TransportCommandStart );
//jack_transport_start(netj.client);
//last_transport_state = JackTransportStopped;
netj.sync_state = 0;
jack_info("locally stopped... starting...");
}
if (local_trans_pos.frame != compensated_tranport_pos)
{
jack_position_t new_pos = local_trans_pos;
new_pos.frame = compensated_tranport_pos + 2*netj.period_size;
new_pos.valid = (jack_position_bits_t) 0;
fEngineControl->fTransport.RequestNewPos ( &new_pos );
//jack_transport_locate(netj.client, compensated_tranport_pos);
//last_transport_state = JackTransportRolling;
netj.sync_state = 0;
jack_info("starting locate to %d", compensated_tranport_pos );
}
break;
case JackTransportStopped:
netj.sync_state = 1;
if (local_trans_pos.frame != (pkthdr->transport_frame)) {
jack_position_t new_pos = local_trans_pos;
new_pos.frame = pkthdr->transport_frame;
new_pos.valid = (jack_position_bits_t)0;
fEngineControl->fTransport.RequestNewPos ( &new_pos );
//jack_transport_locate(netj.client, (pkthdr->transport_frame));
jack_info("transport is stopped locate to %d", pkthdr->transport_frame);
}
if (local_trans_state != JackTransportStopped)
//jack_transport_stop(netj.client);
fEngineControl->fTransport.SetCommand ( TransportCommandStop );
break;
case JackTransportRolling:
netj.sync_state = 1;
// if(local_trans_pos.frame != (pkthdr->transport_frame + (pkthdr->latency) * netj.period_size)) {
// jack_transport_locate(netj.client, (pkthdr->transport_frame + (pkthdr->latency + 2) * netj.period_size));
// jack_info("running locate to %d", pkthdr->transport_frame + (pkthdr->latency)*netj.period_size);
// }
if (local_trans_state != JackTransportRolling)
fEngineControl->fTransport.SetState ( JackTransportRolling );
break;
case JackTransportLooping:
break;
}
// Now check if we have to start or stop local transport to sync to remote...
switch (pkthdr->transport_state) {
case JackTransportStarting:
// the master transport is starting... so we set our reply to the sync_callback;
if (local_trans_state == JackTransportStopped) {
fEngineControl->fTransport.SetCommand ( TransportCommandStart );
//jack_transport_start(netj.client);
//last_transport_state = JackTransportStopped;
netj.sync_state = 0;
jack_info("locally stopped... starting...");
}
if (local_trans_pos.frame != compensated_tranport_pos)
{
jack_position_t new_pos = local_trans_pos;
new_pos.frame = compensated_tranport_pos + 2*netj.period_size;
new_pos.valid = (jack_position_bits_t) 0;
fEngineControl->fTransport.RequestNewPos ( &new_pos );
//jack_transport_locate(netj.client, compensated_tranport_pos);
//last_transport_state = JackTransportRolling;
netj.sync_state = 0;
jack_info("starting locate to %d", compensated_tranport_pos );
}
break;
case JackTransportStopped:
netj.sync_state = 1;
if (local_trans_pos.frame != (pkthdr->transport_frame)) {
jack_position_t new_pos = local_trans_pos;
new_pos.frame = pkthdr->transport_frame;
new_pos.valid = (jack_position_bits_t)0;
fEngineControl->fTransport.RequestNewPos ( &new_pos );
//jack_transport_locate(netj.client, (pkthdr->transport_frame));
jack_info("transport is stopped locate to %d", pkthdr->transport_frame);
}
if (local_trans_state != JackTransportStopped)
//jack_transport_stop(netj.client);
fEngineControl->fTransport.SetCommand ( TransportCommandStop );
break;
case JackTransportRolling:
netj.sync_state = 1;
// if(local_trans_pos.frame != (pkthdr->transport_frame + (pkthdr->latency) * netj.period_size)) {
// jack_transport_locate(netj.client, (pkthdr->transport_frame + (pkthdr->latency + 2) * netj.period_size));
// jack_info("running locate to %d", pkthdr->transport_frame + (pkthdr->latency)*netj.period_size);
// }
if (local_trans_state != JackTransportRolling)
fEngineControl->fTransport.SetState ( JackTransportRolling );
break;
case JackTransportLooping:
break;
}
#endif
}
}

render_payload_to_jack_ports (netj.bitdepth, packet_bufX, netj.net_period_down, netj.capture_ports, netj.capture_srcs, netj.period_size, netj.dont_htonl_floats );
packet_cache_release_packet(global_packcache, netj.expected_framecnt );
return 0;
render_payload_to_jack_ports (netj.bitdepth, packet_bufX, netj.net_period_down, netj.capture_ports, netj.capture_srcs, netj.period_size, netj.dont_htonl_floats );
packet_cache_release_packet(global_packcache, netj.expected_framecnt );
return 0;
}

int JackNetOneDriver::Write()
{
int syncstate = netj.sync_state | ((fEngineControl->fTransport.GetState() == JackTransportNetStarting) ? 1 : 0 );
uint32_t *packet_buf, *packet_bufX;

int packet_size = get_sample_size(netj.bitdepth) * netj.playback_channels * netj.net_period_up + sizeof(jacknet_packet_header);
jacknet_packet_header *pkthdr;
int syncstate = netj.sync_state | ((fEngineControl->fTransport.GetState() == JackTransportNetStarting) ? 1 : 0 );
uint32_t *packet_buf, *packet_bufX;

packet_buf = (uint32_t *) alloca(packet_size);
pkthdr = (jacknet_packet_header *)packet_buf;
int packet_size = get_sample_size(netj.bitdepth) * netj.playback_channels * netj.net_period_up + sizeof(jacknet_packet_header);
jacknet_packet_header *pkthdr;

if( netj.running_free ) {
return 0;
}
packet_buf = (uint32_t *) alloca(packet_size);
pkthdr = (jacknet_packet_header *)packet_buf;

// offset packet_bufX by the packetheader.
packet_bufX = packet_buf + sizeof(jacknet_packet_header) / sizeof(jack_default_audio_sample_t);
if( netj.running_free ) {
return 0;
}

pkthdr->sync_state = syncstate;;
pkthdr->latency = netj.time_to_deadline;
//printf( "time to deadline = %d goodness=%d\n", (int)netj.time_to_deadline, netj.deadline_goodness );
pkthdr->framecnt = netj.expected_framecnt;
// offset packet_bufX by the packetheader.
packet_bufX = packet_buf + sizeof(jacknet_packet_header) / sizeof(jack_default_audio_sample_t);

pkthdr->sync_state = syncstate;;
pkthdr->latency = netj.time_to_deadline;
//printf( "time to deadline = %d goodness=%d\n", (int)netj.time_to_deadline, netj.deadline_goodness );
pkthdr->framecnt = netj.expected_framecnt;

render_jack_ports_to_payload(netj.bitdepth, netj.playback_ports, netj.playback_srcs, netj.period_size, packet_bufX, netj.net_period_up, netj.dont_htonl_floats );
render_jack_ports_to_payload(netj.bitdepth, netj.playback_ports, netj.playback_srcs, netj.period_size, packet_bufX, netj.net_period_up, netj.dont_htonl_floats );

packet_header_hton(pkthdr);
if (netj.srcaddress_valid)
{
unsigned int r;
packet_header_hton(pkthdr);
if (netj.srcaddress_valid)
{
unsigned int r;

#ifdef __APPLE__
static const int flag = 0;
#else
static const int flag = 0;
#endif
#ifdef __APPLE__
static const int flag = 0;
#else
static const int flag = 0;
#endif

if (netj.reply_port)
netj.syncsource_address.sin_port = htons(netj.reply_port);
if (netj.reply_port)
netj.syncsource_address.sin_port = htons(netj.reply_port);

for( r=0; r<netj.redundancy; r++ )
netjack_sendto(netj.sockfd, (char *)packet_buf, packet_size,
flag, (struct sockaddr*)&(netj.syncsource_address), sizeof(struct sockaddr_in), netj.mtu);
}
return 0;
for( r=0; r<netj.redundancy; r++ )
netjack_sendto(netj.sockfd, (char *)packet_buf, packet_size,
flag, (struct sockaddr*)&(netj.syncsource_address), sizeof(struct sockaddr_in), netj.mtu);
}
return 0;
}

void
@@ -444,21 +442,21 @@ JackNetOneDriver::FreePorts ()
JSList *node = netj.capture_ports;

while( node != NULL ) {
JSList *this_node = node;
jack_port_id_t port_id = (jack_port_id_t)(intptr_t) node->data;
node = jack_slist_remove_link( node, this_node );
jack_slist_free_1( this_node );
fGraphManager->ReleasePort( fClientControl.fRefNum, port_id );
JSList *this_node = node;
jack_port_id_t port_id = (jack_port_id_t)(intptr_t) node->data;
node = jack_slist_remove_link( node, this_node );
jack_slist_free_1( this_node );
fGraphManager->ReleasePort( fClientControl.fRefNum, port_id );
}
netj.capture_ports = NULL;

node = netj.playback_ports;
while( node != NULL ) {
JSList *this_node = node;
jack_port_id_t port_id = (jack_port_id_t)(intptr_t) node->data;
node = jack_slist_remove_link( node, this_node );
jack_slist_free_1( this_node );
fGraphManager->ReleasePort( fClientControl.fRefNum, port_id );
JSList *this_node = node;
jack_port_id_t port_id = (jack_port_id_t)(intptr_t) node->data;
node = jack_slist_remove_link( node, this_node );
jack_slist_free_1( this_node );
fGraphManager->ReleasePort( fClientControl.fRefNum, port_id );
}
netj.playback_ports = NULL;

@@ -523,7 +521,7 @@ JackNetOneDriver::render_payload_to_jack_ports_float ( void *packet_payload, jac
uint32_t *packet_bufX = (uint32_t *)packet_payload;

if( !packet_payload )
return;
return;

while (node != NULL)
{
@@ -532,9 +530,8 @@ JackNetOneDriver::render_payload_to_jack_ports_float ( void *packet_payload, jac
#if HAVE_SAMPLERATE
SRC_DATA src;
#endif

jack_port_id_t port_id = (jack_port_id_t)(intptr_t) node->data;
JackPort *port = fGraphManager->GetPort( port_id );
jack_port_id_t port_id = (jack_port_id_t)(intptr_t) node->data;
JackPort *port = fGraphManager->GetPort( port_id );

jack_default_audio_sample_t* buf =
(jack_default_audio_sample_t*)fGraphManager->GetBuffer(port_id, fEngineControl->fBufferSize);
@@ -569,19 +566,19 @@ JackNetOneDriver::render_payload_to_jack_ports_float ( void *packet_payload, jac
else
#endif
{
if( dont_htonl_floats )
{
memcpy( buf, packet_bufX, net_period_down*sizeof(jack_default_audio_sample_t));
}
else
{
for (i = 0; i < net_period_down; i++)
{
val.i = packet_bufX[i];
val.i = ntohl (val.i);
buf[i] = val.f;
}
}
if( dont_htonl_floats )
{
memcpy( buf, packet_bufX, net_period_down*sizeof(jack_default_audio_sample_t));
}
else
{
for (i = 0; i < net_period_down; i++)
{
val.i = packet_bufX[i];
val.i = ntohl (val.i);
buf[i] = val.f;
}
}
}
}
else if (strncmp (porttype, JACK_DEFAULT_MIDI_TYPE, jack_port_type_size()) == 0)
@@ -616,8 +613,8 @@ JackNetOneDriver::render_jack_ports_to_payload_float (JSList *playback_ports, JS
#endif
unsigned int i;
int_float_t val;
jack_port_id_t port_id = (jack_port_id_t)(intptr_t) node->data;
JackPort *port = fGraphManager->GetPort( port_id );
jack_port_id_t port_id = (jack_port_id_t)(intptr_t) node->data;
JackPort *port = fGraphManager->GetPort( port_id );

jack_default_audio_sample_t* buf =
(jack_default_audio_sample_t*)fGraphManager->GetBuffer(port_id, fEngineControl->fBufferSize);
@@ -652,19 +649,19 @@ JackNetOneDriver::render_jack_ports_to_payload_float (JSList *playback_ports, JS
else
#endif
{
if( dont_htonl_floats )
{
memcpy( packet_bufX, buf, net_period_up*sizeof(jack_default_audio_sample_t) );
}
else
{
for (i = 0; i < net_period_up; i++)
{
val.f = buf[i];
val.i = htonl (val.i);
packet_bufX[i] = val.i;
}
}
if( dont_htonl_floats )
{
memcpy( packet_bufX, buf, net_period_up*sizeof(jack_default_audio_sample_t) );
}
else
{
for (i = 0; i < net_period_up; i++)
{
val.f = buf[i];
val.i = htonl (val.i);
packet_bufX[i] = val.i;
}
}
}
}
else if (strncmp(porttype, JACK_DEFAULT_MIDI_TYPE, jack_port_type_size()) == 0)
@@ -694,26 +691,24 @@ JackNetOneDriver::render_payload_to_jack_ports_celt (void *packet_payload, jack_

while (node != NULL)
{
jack_port_id_t port_id = (jack_port_id_t) (intptr_t)node->data;
JackPort *port = fGraphManager->GetPort( port_id );
jack_port_id_t port_id = (jack_port_id_t) (intptr_t)node->data;
JackPort *port = fGraphManager->GetPort( port_id );

jack_default_audio_sample_t* buf =
(jack_default_audio_sample_t*)fGraphManager->GetBuffer(port_id, fEngineControl->fBufferSize);

const char *portname = port->GetType();


if (strncmp(portname, JACK_DEFAULT_AUDIO_TYPE, jack_port_type_size()) == 0)
{
// audio port, decode celt data.
CELTDecoder *decoder = (CELTDecoder *)src_node->data;
if( !packet_payload )
celt_decode_float( decoder, NULL, net_period_down, buf );
else
celt_decode_float( decoder, packet_bufX, net_period_down, buf );

CELTDecoder *decoder = (CELTDecoder *)src_node->data;
if( !packet_payload )
celt_decode_float( decoder, NULL, net_period_down, buf );
else
celt_decode_float( decoder, packet_bufX, net_period_down, buf );

src_node = jack_slist_next (src_node);
src_node = jack_slist_next (src_node);
}
else if (strncmp(portname, JACK_DEFAULT_MIDI_TYPE, jack_port_type_size()) == 0)
{
@@ -722,7 +717,7 @@ JackNetOneDriver::render_payload_to_jack_ports_celt (void *packet_payload, jack_
unsigned int buffer_size_uint32 = net_period_down / 2;
uint32_t * buffer_uint32 = (uint32_t*) packet_bufX;
if( packet_payload )
decode_midi_buffer (buffer_uint32, buffer_size_uint32, buf);
decode_midi_buffer (buffer_uint32, buffer_size_uint32, buf);
}
packet_bufX = (packet_bufX + net_period_down);
node = jack_slist_next (node);
@@ -741,8 +736,8 @@ JackNetOneDriver::render_jack_ports_to_payload_celt (JSList *playback_ports, JSL

while (node != NULL)
{
jack_port_id_t port_id = (jack_port_id_t) (intptr_t) node->data;
JackPort *port = fGraphManager->GetPort( port_id );
jack_port_id_t port_id = (jack_port_id_t) (intptr_t) node->data;
JackPort *port = fGraphManager->GetPort( port_id );

jack_default_audio_sample_t* buf =
(jack_default_audio_sample_t*)fGraphManager->GetBuffer(port_id, fEngineControl->fBufferSize);
@@ -800,8 +795,6 @@ JackNetOneDriver::render_jack_ports_to_payload (int bitdepth, JSList *playback_p
render_jack_ports_to_payload_float (playback_ports, playback_srcs, nframes, packet_payload, net_period_up, dont_htonl_floats);
}



//driver loader-----------------------------------------------------------------------

#ifdef __cplusplus
@@ -982,28 +975,26 @@ JackNetOneDriver::render_jack_ports_to_payload (int bitdepth, JSList *playback_p

SERVER_EXPORT Jack::JackDriverClientInterface* driver_initialize ( Jack::JackLockedEngine* engine, Jack::JackSynchro* table, const JSList* params )
{
jack_nframes_t sample_rate = 48000;
jack_nframes_t resample_factor = 1;
jack_nframes_t period_size = 1024;
unsigned int capture_ports = 2;
unsigned int playback_ports = 2;
unsigned int capture_ports_midi = 1;
unsigned int playback_ports_midi = 1;
unsigned int listen_port = 3000;
unsigned int resample_factor_up = 0;
unsigned int bitdepth = 0;
unsigned int handle_transport_sync = 1;
unsigned int use_autoconfig = 1;
unsigned int latency = 5;
unsigned int redundancy = 1;
unsigned int mtu = 1400;
int dont_htonl_floats = 0;
int always_deadline = 0;
int jitter_val = 0;
const JSList * node;
const jack_driver_param_t * param;


jack_nframes_t sample_rate = 48000;
jack_nframes_t resample_factor = 1;
jack_nframes_t period_size = 1024;
unsigned int capture_ports = 2;
unsigned int playback_ports = 2;
unsigned int capture_ports_midi = 1;
unsigned int playback_ports_midi = 1;
unsigned int listen_port = 3000;
unsigned int bitdepth = 0;
unsigned int handle_transport_sync = 1;
unsigned int use_autoconfig = 1;
unsigned int latency = 5;
unsigned int redundancy = 1;
unsigned int mtu = 1400;
unsigned int resample_factor_up = 1;
int dont_htonl_floats = 0;
int always_deadline = 0;
int jitter_val = 0;
const JSList * node;
const jack_driver_param_t * param;

for ( node = params; node; node = jack_slist_next ( node ) )
{
@@ -1102,7 +1093,6 @@ JackNetOneDriver::render_jack_ports_to_payload (int bitdepth, JSList *playback_p

try
{

Jack::JackDriverClientInterface* driver =
new Jack::JackWaitThreadedDriver (
new Jack::JackNetOneDriver ( "system", "net_pcm", engine, table, listen_port, mtu,


+ 1
- 0
common/JackNotification.h View File

@@ -45,6 +45,7 @@ enum NotificationType {
kRealTimeCallback = 14,
kShutDownCallback = 15,
kQUIT = 16,
kSessionCallback = 17,
kMaxNotification
};



+ 375
- 74
common/JackRequest.h View File

@@ -26,6 +26,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "types.h"
#include <string.h>
#include <stdio.h>
#include <list>

namespace Jack
{
@@ -65,7 +66,12 @@ struct JackRequest
kInternalClientLoad = 29,
kInternalClientUnload = 30,
kPortRename = 31,
kNotification = 32
kNotification = 32,
kSessionNotify = 33,
kSessionReply = 34,
kGetClientByUUID = 35,
kReserveClientName = 36,
kGetUUIDByClient = 37
};

RequestType fType;
@@ -98,7 +104,7 @@ struct JackRequest
struct JackResult
{

int fResult;
int fResult;

JackResult(): fResult( -1)
{}
@@ -129,31 +135,34 @@ struct JackClientCheckRequest : public JackRequest
char fName[JACK_CLIENT_NAME_SIZE + 1];
int fProtocol;
int fOptions;
int fUUID;

JackClientCheckRequest()
{}
JackClientCheckRequest(const char* name, int protocol, int options)
: JackRequest(JackRequest::kClientCheck), fProtocol(protocol), fOptions(options)
JackClientCheckRequest(const char* name, int protocol, int options, int uuid)
: JackRequest(JackRequest::kClientCheck), fProtocol(protocol), fOptions(options), fUUID(uuid)
{
snprintf(fName, sizeof(fName), "%s", name);
}

int Read(JackChannelTransaction* trans)
{
CheckRes(trans->Read(&fName, JACK_CLIENT_NAME_SIZE + 1));
CheckRes(trans->Read(&fName, sizeof(fName)));
CheckRes(trans->Read(&fProtocol, sizeof(int)));
return trans->Read(&fOptions, sizeof(int));
CheckRes(trans->Read(&fOptions, sizeof(int)));
return trans->Read(&fUUID, sizeof(int));
}

int Write(JackChannelTransaction* trans)
{
CheckRes(JackRequest::Write(trans));
CheckRes(trans->Write(&fName, JACK_CLIENT_NAME_SIZE + 1));
CheckRes(trans->Write(&fName, sizeof(fName)));
CheckRes(trans->Write(&fProtocol, sizeof(int)));
return trans->Write(&fOptions, sizeof(int));
CheckRes(trans->Write(&fOptions, sizeof(int)));
return trans->Write(&fUUID, sizeof(int));
}
} POST_PACKED_STRUCTURE;
};

/*!
\brief CheckClient result.
@@ -176,7 +185,7 @@ struct JackClientCheckResult : public JackResult
int Read(JackChannelTransaction* trans)
{
CheckRes(JackResult::Read(trans));
CheckRes(trans->Read(&fName, JACK_CLIENT_NAME_SIZE + 1));
CheckRes(trans->Read(&fName, sizeof(fName)));
CheckRes(trans->Read(&fStatus, sizeof(int)));
return 0;
}
@@ -184,12 +193,12 @@ struct JackClientCheckResult : public JackResult
int Write(JackChannelTransaction* trans)
{
CheckRes(JackResult::Write(trans));
CheckRes(trans->Write(&fName, JACK_CLIENT_NAME_SIZE + 1));
CheckRes(trans->Write(&fName, sizeof(fName)));
CheckRes(trans->Write(&fStatus, sizeof(int)));
return 0;
}
} POST_PACKED_STRUCTURE;
};

/*!
\brief NewClient request.
@@ -199,30 +208,34 @@ struct JackClientOpenRequest : public JackRequest
{

int fPID;
int fUUID;
char fName[JACK_CLIENT_NAME_SIZE + 1];
JackClientOpenRequest()
{}
JackClientOpenRequest(const char* name, int pid): JackRequest(JackRequest::kClientOpen)
JackClientOpenRequest(const char* name, int pid, int uuid): JackRequest(JackRequest::kClientOpen)
{
snprintf(fName, sizeof(fName), "%s", name);
fPID = pid;
fUUID = uuid;
}

int Read(JackChannelTransaction* trans)
{
CheckRes(trans->Read(&fPID, sizeof(int)));
return trans->Read(&fName, JACK_CLIENT_NAME_SIZE + 1);
CheckRes(trans->Read(&fUUID, sizeof(int)));
return trans->Read(&fName, sizeof(fName));
}

int Write(JackChannelTransaction* trans)
{
CheckRes(JackRequest::Write(trans));
CheckRes(trans->Write(&fPID, sizeof(int)));
return trans->Write(&fName, JACK_CLIENT_NAME_SIZE + 1);
CheckRes(trans->Write(&fUUID, sizeof(int)));
return trans->Write(&fName, sizeof(fName));
}
} POST_PACKED_STRUCTURE;
};

/*!
\brief NewClient result.
@@ -260,7 +273,7 @@ struct JackClientOpenResult : public JackResult
return 0;
}
} POST_PACKED_STRUCTURE;
};

/*!
\brief CloseClient request.
@@ -287,7 +300,7 @@ struct JackClientCloseRequest : public JackRequest
return trans->Write(&fRefNum, sizeof(int));
}
} POST_PACKED_STRUCTURE;
};

/*!
\brief Activate request.
@@ -318,7 +331,7 @@ struct JackActivateRequest : public JackRequest
return trans->Write(&fIsRealTime, sizeof(int));
}

} POST_PACKED_STRUCTURE;
};

/*!
\brief Deactivate request.
@@ -345,7 +358,7 @@ struct JackDeactivateRequest : public JackRequest
return trans->Write(&fRefNum, sizeof(int));
}

} POST_PACKED_STRUCTURE;
};

/*!
\brief PortRegister request.
@@ -372,8 +385,8 @@ struct JackPortRegisterRequest : public JackRequest
int Read(JackChannelTransaction* trans)
{
CheckRes(trans->Read(&fRefNum, sizeof(int)));
CheckRes(trans->Read(&fName, JACK_PORT_NAME_SIZE + 1));
CheckRes(trans->Read(&fPortType, JACK_PORT_TYPE_SIZE + 1));
CheckRes(trans->Read(&fName, sizeof(fName)));
CheckRes(trans->Read(&fPortType, sizeof(fPortType)));
CheckRes(trans->Read(&fFlags, sizeof(unsigned int)));
CheckRes(trans->Read(&fBufferSize, sizeof(unsigned int)));
return 0;
@@ -383,14 +396,14 @@ struct JackPortRegisterRequest : public JackRequest
{
CheckRes(JackRequest::Write(trans));
CheckRes(trans->Write(&fRefNum, sizeof(int)));
CheckRes(trans->Write(&fName, JACK_PORT_NAME_SIZE + 1));
CheckRes(trans->Write(&fPortType, JACK_PORT_TYPE_SIZE + 1));
CheckRes(trans->Write(&fName, sizeof(fName)));
CheckRes(trans->Write(&fPortType, sizeof(fPortType)));
CheckRes(trans->Write(&fFlags, sizeof(unsigned int)));
CheckRes(trans->Write(&fBufferSize, sizeof(unsigned int)));
return 0;
}
} POST_PACKED_STRUCTURE;
};

/*!
\brief PortRegister result.
@@ -416,7 +429,7 @@ struct JackPortRegisterResult : public JackResult
return trans->Write(&fPortIndex, sizeof(jack_port_id_t));
}
} POST_PACKED_STRUCTURE;
};

/*!
\brief PortUnregister request.
@@ -449,7 +462,7 @@ struct JackPortUnRegisterRequest : public JackRequest
return 0;
}
} POST_PACKED_STRUCTURE;
};

/*!
\brief PortConnectName request.
@@ -474,8 +487,8 @@ struct JackPortConnectNameRequest : public JackRequest
int Read(JackChannelTransaction* trans)
{
CheckRes(trans->Read(&fRefNum, sizeof(int)));
CheckRes(trans->Read(&fSrc, JACK_PORT_NAME_SIZE + 1));
CheckRes(trans->Read(&fDst, JACK_PORT_NAME_SIZE + 1));
CheckRes(trans->Read(&fSrc, sizeof(fSrc)));
CheckRes(trans->Read(&fDst, sizeof(fDst)));
return 0;

}
@@ -484,12 +497,12 @@ struct JackPortConnectNameRequest : public JackRequest
{
CheckRes(JackRequest::Write(trans));
CheckRes(trans->Write(&fRefNum, sizeof(int)));
CheckRes(trans->Write(&fSrc, JACK_PORT_NAME_SIZE + 1));
CheckRes(trans->Write(&fDst, JACK_PORT_NAME_SIZE + 1));
CheckRes(trans->Write(&fSrc, sizeof(fSrc)));
CheckRes(trans->Write(&fDst, sizeof(fDst)));
return 0;
}
} POST_PACKED_STRUCTURE;
};

/*!
\brief PortDisconnectName request.
@@ -514,8 +527,8 @@ struct JackPortDisconnectNameRequest : public JackRequest
int Read(JackChannelTransaction* trans)
{
CheckRes(trans->Read(&fRefNum, sizeof(int)));
CheckRes(trans->Read(&fSrc, JACK_PORT_NAME_SIZE + 1));
CheckRes(trans->Read(&fDst, JACK_PORT_NAME_SIZE + 1));
CheckRes(trans->Read(&fSrc, sizeof(fSrc)));
CheckRes(trans->Read(&fDst, sizeof(fDst)));
return 0;
}

@@ -523,12 +536,12 @@ struct JackPortDisconnectNameRequest : public JackRequest
{
CheckRes(JackRequest::Write(trans));
CheckRes(trans->Write(&fRefNum, sizeof(int)));
CheckRes(trans->Write(&fSrc, JACK_PORT_NAME_SIZE + 1));
CheckRes(trans->Write(&fDst, JACK_PORT_NAME_SIZE + 1));
CheckRes(trans->Write(&fSrc, sizeof(fSrc)));
CheckRes(trans->Write(&fDst, sizeof(fDst)));
return 0;
}
} POST_PACKED_STRUCTURE;
};

/*!
\brief PortConnect request.
@@ -564,7 +577,7 @@ struct JackPortConnectRequest : public JackRequest
return 0;
}
} POST_PACKED_STRUCTURE;
};

/*!
\brief PortDisconnect request.
@@ -598,10 +611,9 @@ struct JackPortDisconnectRequest : public JackRequest
CheckRes(trans->Write(&fSrc, sizeof(jack_port_id_t)));
CheckRes(trans->Write(&fDst, sizeof(jack_port_id_t)));
return 0;

}
} POST_PACKED_STRUCTURE;
};

/*!
\brief PortRename request.
@@ -626,7 +638,7 @@ struct JackPortRenameRequest : public JackRequest
{
CheckRes(trans->Read(&fRefNum, sizeof(int)));
CheckRes(trans->Read(&fPort, sizeof(jack_port_id_t)));
CheckRes(trans->Read(&fName, JACK_PORT_NAME_SIZE + 1));
CheckRes(trans->Read(&fName, sizeof(fName)));
return 0;
}

@@ -635,12 +647,12 @@ struct JackPortRenameRequest : public JackRequest
CheckRes(JackRequest::Write(trans));
CheckRes(trans->Write(&fRefNum, sizeof(int)));
CheckRes(trans->Write(&fPort, sizeof(jack_port_id_t)));
CheckRes(trans->Write(&fName, JACK_PORT_NAME_SIZE + 1));
CheckRes(trans->Write(&fName, sizeof(fName)));
return 0;

}
} POST_PACKED_STRUCTURE;
};

/*!
\brief SetBufferSize request.
@@ -668,7 +680,7 @@ struct JackSetBufferSizeRequest : public JackRequest
return trans->Write(&fBufferSize, sizeof(jack_nframes_t));
}
} POST_PACKED_STRUCTURE;
};

/*!
\brief SetFreeWheel request.
@@ -696,7 +708,7 @@ struct JackSetFreeWheelRequest : public JackRequest
return trans->Write(&fOnOff, sizeof(int));
}
} POST_PACKED_STRUCTURE;
};

/*!
\brief ReleaseTimebase request.
@@ -724,7 +736,7 @@ struct JackReleaseTimebaseRequest : public JackRequest
return trans->Write(&fRefNum, sizeof(int));
}
} POST_PACKED_STRUCTURE;
};

/*!
\brief SetTimebaseCallback request.
@@ -755,7 +767,7 @@ struct JackSetTimebaseCallbackRequest : public JackRequest
return trans->Write(&fConditionnal, sizeof(int));
}
} POST_PACKED_STRUCTURE;
};

/*!
\brief GetInternalClientName request.
@@ -786,7 +798,7 @@ struct JackGetInternalClientNameRequest : public JackRequest
return trans->Write(&fIntRefNum, sizeof(int));
}
} POST_PACKED_STRUCTURE;
};

/*!
\brief GetInternalClient result.
@@ -808,18 +820,18 @@ struct JackGetInternalClientNameResult : public JackResult
int Read(JackChannelTransaction* trans)
{
CheckRes(JackResult::Read(trans));
CheckRes(trans->Read(&fName, JACK_CLIENT_NAME_SIZE + 1));
CheckRes(trans->Read(&fName, sizeof(fName)));
return 0;
}

int Write(JackChannelTransaction* trans)
{
CheckRes(JackResult::Write(trans));
CheckRes(trans->Write(&fName, JACK_CLIENT_NAME_SIZE + 1));
CheckRes(trans->Write(&fName, sizeof(fName)));
return 0;
}
} POST_PACKED_STRUCTURE;
};

/*!
\brief InternalClientHandle request.
@@ -842,17 +854,17 @@ struct JackInternalClientHandleRequest : public JackRequest
int Read(JackChannelTransaction* trans)
{
CheckRes(trans->Read(&fRefNum, sizeof(int)));
return trans->Read(&fName, JACK_CLIENT_NAME_SIZE + 1);
return trans->Read(&fName, sizeof(fName));
}

int Write(JackChannelTransaction* trans)
{
CheckRes(JackRequest::Write(trans));
CheckRes(trans->Write(&fRefNum, sizeof(int)));
return trans->Write(&fName, JACK_CLIENT_NAME_SIZE + 1);
return trans->Write(&fName, sizeof(fName));
}
} POST_PACKED_STRUCTURE;
};

/*!
\brief InternalClientHandle result.
@@ -886,7 +898,7 @@ struct JackInternalClientHandleResult : public JackResult
return 0;
}
} POST_PACKED_STRUCTURE;
};

/*!
\brief InternalClientLoad request.
@@ -904,23 +916,26 @@ struct JackInternalClientLoadRequest : public JackRequest
char fDllName[MAX_PATH + 1];
char fLoadInitName[JACK_LOAD_INIT_LIMIT + 1];
int fOptions;
int fUUID;

JackInternalClientLoadRequest()
{}
JackInternalClientLoadRequest(int refnum, const char* client_name, const char* so_name, const char* objet_data, int options)
: JackRequest(JackRequest::kInternalClientLoad), fRefNum(refnum), fOptions(options)
JackInternalClientLoadRequest(int refnum, const char* client_name, const char* so_name, const char* objet_data, int options, int uuid )
: JackRequest(JackRequest::kInternalClientLoad), fRefNum(refnum), fOptions(options), fUUID(uuid)
{
snprintf(fName, sizeof(fName), "%s", client_name);
snprintf(fDllName, sizeof(fDllName), "%s", so_name);
snprintf(fLoadInitName, sizeof(fLoadInitName), "%s", objet_data);
snprintf(fLoadInitName, sizeof(fLoadInitName), "%s", objet_data);
}

int Read(JackChannelTransaction* trans)
{
CheckRes(trans->Read(&fRefNum, sizeof(int)));
CheckRes(trans->Read(&fName, JACK_CLIENT_NAME_SIZE + 1));
CheckRes(trans->Read(&fDllName, MAX_PATH + 1));
CheckRes(trans->Read(&fLoadInitName, JACK_LOAD_INIT_LIMIT + 1));
CheckRes(trans->Read(&fName, sizeof(fName)));
CheckRes(trans->Read(&fDllName, sizeof(fDllName)));
CheckRes(trans->Read(&fLoadInitName, sizeof(fLoadInitName)));
CheckRes(trans->Read(&fUUID, sizeof(int)));
return trans->Read(&fOptions, sizeof(int));
}

@@ -928,13 +943,14 @@ struct JackInternalClientLoadRequest : public JackRequest
{
CheckRes(JackRequest::Write(trans));
CheckRes(trans->Write(&fRefNum, sizeof(int)));
CheckRes(trans->Write(&fName, JACK_CLIENT_NAME_SIZE + 1));
CheckRes(trans->Write(&fDllName, MAX_PATH + 1));
CheckRes(trans->Write(&fLoadInitName, JACK_LOAD_INIT_LIMIT + 1));
CheckRes(trans->Write(&fName, sizeof(fName)));
CheckRes(trans->Write(&fDllName, sizeof(fDllName)));
CheckRes(trans->Write(&fLoadInitName, sizeof(fLoadInitName)));
CheckRes(trans->Write(&fUUID, sizeof(int)));
return trans->Write(&fOptions, sizeof(int));
}
} POST_PACKED_STRUCTURE;
};

/*!
\brief InternalClientLoad result.
@@ -968,7 +984,7 @@ struct JackInternalClientLoadResult : public JackResult
return 0;
}
} POST_PACKED_STRUCTURE;
};

/*!
\brief InternalClientUnload request.
@@ -998,7 +1014,7 @@ struct JackInternalClientUnloadRequest : public JackRequest
CheckRes(trans->Write(&fRefNum, sizeof(int)));
return trans->Write(&fIntRefNum, sizeof(int));
}
} POST_PACKED_STRUCTURE;
};

/*!
\brief InternalClientLoad result.
@@ -1029,7 +1045,7 @@ struct JackInternalClientUnloadResult : public JackResult
return 0;
}
} POST_PACKED_STRUCTURE;
};

/*!
\brief ClientNotification request.
@@ -1065,7 +1081,292 @@ struct JackClientNotificationRequest : public JackRequest
return 0;
}

} POST_PACKED_STRUCTURE;
};

struct JackSessionCommand
{
char fUUID[JACK_UUID_SIZE];
char fClientName[JACK_CLIENT_NAME_SIZE+1];
char fCommand[JACK_SESSION_COMMAND_SIZE];
jack_session_flags_t fFlags;

JackSessionCommand()
{}

JackSessionCommand( const char *uuid, const char *clientname, const char *command, jack_session_flags_t flags )
{
strncpy( fUUID, uuid, sizeof(fUUID));
strncpy( fClientName, clientname, sizeof(fClientName));
strncpy( fCommand, command, sizeof(fCommand));
fFlags = flags;
}
};

struct JackSessionNotifyResult : public JackResult
{

std::list<JackSessionCommand> fCommandList;

JackSessionNotifyResult(): JackResult()
{}
JackSessionNotifyResult(int32_t result)
: JackResult(result)
{}

int Read(JackChannelTransaction* trans)
{
CheckRes(JackResult::Read(trans));
while(1) {
JackSessionCommand buffer;

CheckRes(trans->Read(buffer.fUUID, sizeof(buffer.fUUID)));
if (buffer.fUUID[0] == '\0')
break;

CheckRes(trans->Read(buffer.fClientName, sizeof(buffer.fClientName)));
CheckRes(trans->Read(buffer.fCommand, sizeof(buffer.fCommand)));
CheckRes(trans->Read(&(buffer.fFlags), sizeof(buffer.fFlags)));

fCommandList.push_back(buffer);
}
return 0;
}

int Write(JackChannelTransaction* trans)
{
char terminator[JACK_UUID_SIZE];
terminator[0] = '\0';

CheckRes(JackResult::Write(trans));
for (std::list<JackSessionCommand>::iterator i=fCommandList.begin(); i!=fCommandList.end(); i++) {
CheckRes(trans->Write(i->fUUID, sizeof(i->fUUID)));
CheckRes(trans->Write(i->fClientName, sizeof(i->fClientName)));
CheckRes(trans->Write(i->fCommand, sizeof(i->fCommand)));
CheckRes(trans->Write(&(i->fFlags), sizeof(i->fFlags)));
}
CheckRes(trans->Write(terminator, sizeof(terminator)));
return 0;
}
};

/*!
\brief SessionNotify request.
*/

struct JackSessionNotifyRequest : public JackRequest
{
char fPath[JACK_MESSAGE_SIZE + 1];
char fDst[JACK_CLIENT_NAME_SIZE + 1];
jack_session_event_type_t fEventType;
int fRefNum;

JackSessionNotifyRequest()
{}
JackSessionNotifyRequest(int refnum, const char *path, jack_session_event_type_t type, const char *dst)
: JackRequest(JackRequest::kSessionNotify), fEventType(type), fRefNum(refnum)
{
snprintf(fPath, sizeof(fPath), "%s", path);
if (dst)
snprintf(fDst, sizeof(fDst), "%s", dst);
else
fDst[0] = '\0';
}

int Read(JackChannelTransaction* trans)
{
CheckRes(trans->Read(&fRefNum, sizeof(fRefNum)));
CheckRes(trans->Read(&fPath, sizeof(fPath)));
CheckRes(trans->Read(&fDst, sizeof(fDst)));
CheckRes(trans->Read(&fEventType, sizeof(fEventType)));
return 0;
}

int Write(JackChannelTransaction* trans)
{
CheckRes(JackRequest::Write(trans));
CheckRes(trans->Write(&fRefNum, sizeof(fRefNum)));
CheckRes(trans->Write(&fPath, sizeof(fPath)));
CheckRes(trans->Write(&fDst, sizeof(fDst)));
CheckRes(trans->Write(&fEventType, sizeof(fEventType)));
return 0;
}

};

struct JackSessionReplyRequest : public JackRequest
{
int fRefNum;

JackSessionReplyRequest()
{}

JackSessionReplyRequest(int refnum)
: JackRequest(JackRequest::kSessionReply), fRefNum(refnum)
{}

int Read(JackChannelTransaction* trans)
{
CheckRes(trans->Read(&fRefNum, sizeof(fRefNum)));
return 0;
}

int Write(JackChannelTransaction* trans)
{
CheckRes(JackRequest::Write(trans));
CheckRes(trans->Write(&fRefNum, sizeof(fRefNum)));
return 0;
}

};

struct JackClientNameResult : public JackResult
{
char fName[JACK_CLIENT_NAME_SIZE + 1];

JackClientNameResult(): JackResult()
{}
JackClientNameResult(int32_t result, const char* name)
: JackResult(result)
{
snprintf(fName, sizeof(fName), "%s", name);
}

int Read(JackChannelTransaction* trans)
{
CheckRes(JackResult::Read(trans));
CheckRes(trans->Read(&fName, sizeof(fName)));
return 0;
}

int Write(JackChannelTransaction* trans)
{
CheckRes(JackResult::Write(trans));
CheckRes(trans->Write(&fName, sizeof(fName)));
return 0;
}
};

struct JackUUIDResult : public JackResult
{

char fUUID[JACK_UUID_SIZE];

JackUUIDResult(): JackResult()
{}
JackUUIDResult(int32_t result, const char* uuid)
: JackResult(result)
{
snprintf(fUUID, sizeof(fUUID), "%s", uuid);
}

int Read(JackChannelTransaction* trans)
{
CheckRes(JackResult::Read(trans));
CheckRes(trans->Read(&fUUID, sizeof(fUUID)));
return 0;
}

int Write(JackChannelTransaction* trans)
{
CheckRes(JackResult::Write(trans));
CheckRes(trans->Write(&fUUID, sizeof(fUUID)));
return 0;
}
};

struct JackGetUUIDRequest : public JackRequest
{
char fName[JACK_CLIENT_NAME_SIZE + 1];

JackGetUUIDRequest()
{}

JackGetUUIDRequest(const char* client_name)
: JackRequest(JackRequest::kGetUUIDByClient)
{
strncpy(fName, client_name, sizeof(fName));
}

int Read(JackChannelTransaction* trans)
{
CheckRes(trans->Read(&fName, sizeof(fName)));
return 0;
}

int Write(JackChannelTransaction* trans)
{
CheckRes(JackRequest::Write(trans));
CheckRes(trans->Write(&fName, sizeof(fName)));
return 0;
}

};

struct JackGetClientNameRequest : public JackRequest
{
char fUUID[JACK_UUID_SIZE];

JackGetClientNameRequest()
{}

JackGetClientNameRequest(const char* uuid)
: JackRequest(JackRequest::kGetClientByUUID)
{
strncpy(fUUID, uuid, sizeof(fUUID));
}

int Read(JackChannelTransaction* trans)
{
CheckRes(trans->Read(&fUUID, sizeof(fUUID)));
return 0;
}

int Write(JackChannelTransaction* trans)
{
CheckRes(JackRequest::Write(trans));
CheckRes(trans->Write(&fUUID, sizeof(fUUID)));
return 0;
}

};

struct JackReserveNameRequest : public JackRequest
{
int fRefNum;
char fName[JACK_CLIENT_NAME_SIZE + 1];
char fUUID[JACK_UUID_SIZE];

JackReserveNameRequest()
{}

JackReserveNameRequest(int refnum, const char *name, const char* uuid)
: JackRequest(JackRequest::kReserveClientName), fRefNum(refnum)
{
strncpy(fName, name, sizeof(fName));
strncpy(fUUID, uuid, sizeof(fUUID));
}

int Read(JackChannelTransaction* trans)
{
CheckRes(trans->Read(&fUUID, sizeof(fUUID)));
CheckRes(trans->Read(&fName, sizeof(fName)));
CheckRes(trans->Read(&fRefNum, sizeof(fRefNum)));
return 0;
}

int Write(JackChannelTransaction* trans)
{
CheckRes(JackRequest::Write(trans));
CheckRes(trans->Write(&fUUID, sizeof(fUUID)));
CheckRes(trans->Write(&fName, sizeof(fName)));
CheckRes(trans->Write(&fRefNum, sizeof(fRefNum)));
return 0;
}

};

/*!
\brief ClientNotification.
@@ -1092,29 +1393,29 @@ struct JackClientNotification

int Read(JackChannelTransaction* trans)
{
CheckRes(trans->Read(&fName, JACK_CLIENT_NAME_SIZE + 1));
CheckRes(trans->Read(&fName, sizeof(fName)));
CheckRes(trans->Read(&fRefNum, sizeof(int)));
CheckRes(trans->Read(&fNotify, sizeof(int)));
CheckRes(trans->Read(&fValue1, sizeof(int)));
CheckRes(trans->Read(&fValue2, sizeof(int)));
CheckRes(trans->Read(&fSync, sizeof(int)));
CheckRes(trans->Read(&fMessage, JACK_MESSAGE_SIZE + 1));
CheckRes(trans->Read(&fMessage, sizeof(fName)));
return 0;
}

int Write(JackChannelTransaction* trans)
{
CheckRes(trans->Write(&fName, JACK_CLIENT_NAME_SIZE + 1));
CheckRes(trans->Write(&fName, sizeof(fName)));
CheckRes(trans->Write(&fRefNum, sizeof(int)));
CheckRes(trans->Write(&fNotify, sizeof(int)));
CheckRes(trans->Write(&fValue1, sizeof(int)));
CheckRes(trans->Write(&fValue2, sizeof(int)));
CheckRes(trans->Write(&fSync, sizeof(int)));
CheckRes(trans->Write(&fMessage, JACK_MESSAGE_SIZE + 1));
CheckRes(trans->Write(&fMessage, sizeof(fName)));
return 0;
}

} POST_PACKED_STRUCTURE;
};

} // end of namespace



+ 6
- 6
common/JackServer.cpp View File

@@ -136,25 +136,25 @@ int JackServer::Close()
return 0;
}

int JackServer::InternalClientLoad(const char* client_name, const char* so_name, const char* objet_data, int options, int* int_ref, int* status)
int JackServer::InternalClientLoad(const char* client_name, const char* so_name, const char* objet_data, int options, int* int_ref, int uuid, int* status)
{
JackLoadableInternalClient* client = new JackLoadableInternalClient1(JackServerGlobals::fInstance, GetSynchroTable(), objet_data);
assert(client);
return InternalClientLoadAux(client, so_name, client_name, options, int_ref, status);
return InternalClientLoadAux(client, so_name, client_name, options, int_ref, uuid, status);
}

int JackServer::InternalClientLoad(const char* client_name, const char* so_name, const JSList * parameters, int options, int* int_ref, int* status)
int JackServer::InternalClientLoad(const char* client_name, const char* so_name, const JSList * parameters, int options, int* int_ref, int uuid, int* status)
{
JackLoadableInternalClient* client = new JackLoadableInternalClient2(JackServerGlobals::fInstance, GetSynchroTable(), parameters);
assert(client);
return InternalClientLoadAux(client, so_name, client_name, options, int_ref, status);
return InternalClientLoadAux(client, so_name, client_name, options, int_ref, uuid, status);
}

int JackServer::InternalClientLoadAux(JackLoadableInternalClient* client, const char* so_name, const char* client_name, int options, int* int_ref, int* status)
int JackServer::InternalClientLoadAux(JackLoadableInternalClient* client, const char* so_name, const char* client_name, int options, int* int_ref, int uuid, int* status)
{
// Clear status
*status = 0;
if ((client->Init(so_name) < 0) || (client->Open(JACK_DEFAULT_SERVER_NAME, client_name, (jack_options_t)options, (jack_status_t*)status) < 0)) {
if ((client->Init(so_name) < 0) || (client->Open(JACK_DEFAULT_SERVER_NAME, client_name, uuid, (jack_options_t)options, (jack_status_t*)status) < 0)) {
delete client;
int my_status1 = *status | JackFailure;
*status = (jack_status_t)my_status1;


+ 3
- 3
common/JackServer.h View File

@@ -58,7 +58,7 @@ class SERVER_EXPORT JackServer
JackSynchro fSynchroTable[CLIENT_NUM];
bool fFreewheel;
int InternalClientLoadAux(JackLoadableInternalClient* client, const char* so_name, const char* client_name, int options, int* int_ref, int* status);
int InternalClientLoadAux(JackLoadableInternalClient* client, const char* so_name, const char* client_name, int options, int* int_ref, int uuid, int* status);

public:

@@ -77,8 +77,8 @@ class SERVER_EXPORT JackServer
// Command thread : API
int SetBufferSize(jack_nframes_t buffer_size);
int SetFreewheel(bool onoff);
int InternalClientLoad(const char* client_name, const char* so_name, const char* objet_data, int options, int* int_ref, int* status);
int InternalClientLoad(const char* client_name, const char* so_name, const JSList * parameters, int options, int* int_ref, int* status);
int InternalClientLoad(const char* client_name, const char* so_name, const char* objet_data, int options, int* int_ref, int uuid, int* status);
int InternalClientLoad(const char* client_name, const char* so_name, const JSList * parameters, int options, int* int_ref, int uuid, int* status);
void ClientKill(int refnum);

// Transport management


+ 6
- 6
common/JackServerAPI.cpp View File

@@ -53,7 +53,7 @@ using namespace Jack;

jack_client_t* jack_client_new_aux(const char* client_name, jack_options_t options, jack_status_t* status)
{
jack_varargs_t va; /* variable arguments */
jack_varargs_t va; /* variable arguments */
jack_status_t my_status;
JackClient* client;

@@ -64,8 +64,8 @@ jack_client_t* jack_client_new_aux(const char* client_name, jack_options_t optio

jack_log("jack_client_new %s", client_name);
if (status == NULL) /* no status from caller? */
status = &my_status; /* use local status word */
if (status == NULL) /* no status from caller? */
status = &my_status; /* use local status word */
*status = (jack_status_t)0;

/* validate parameters */
@@ -90,7 +90,7 @@ jack_client_t* jack_client_new_aux(const char* client_name, jack_options_t optio
client = new JackInternalClient(JackServerGlobals::fInstance, GetSynchroTable());
}

int res = client->Open(va.server_name, client_name, options, status);
int res = client->Open(va.server_name, client_name, va.session_id, options, status);
if (res < 0) {
delete client;
JackServerGlobals::Destroy(); // jack server destruction
@@ -141,7 +141,7 @@ jack_client_t* jack_client_open_aux(const char* client_name, jack_options_t opti
client = new JackInternalClient(JackServerGlobals::fInstance, GetSynchroTable());
}

int res = client->Open(va.server_name, client_name, options, status);
int res = client->Open(va.server_name, client_name, va.session_id, options, status);
if (res < 0) {
delete client;
JackServerGlobals::Destroy(); // jack server destruction
@@ -191,7 +191,7 @@ EXPORT int jack_client_close(jack_client_t* ext_client)
} else {
res = client->Close();
delete client;
JackServerGlobals::Destroy(); // jack server destruction
JackServerGlobals::Destroy(); // jack server destruction
jack_log("jack_client_close res = %d", res);
}
JackGlobals::fOpenMutex->Unlock();


+ 1
- 0
common/JackThread.h View File

@@ -106,6 +106,7 @@ class SERVER_EXPORT JackThreadInterface
int DropSelfRealTime(); // Used when called from thread itself

pthread_t GetThreadID();
bool IsThread();

static int AcquireRealTimeImp(pthread_t thread, int priority);
static int AcquireRealTimeImp(pthread_t thread, int priority, UInt64 period, UInt64 computation, UInt64 constraint);


+ 10
- 0
common/JackTools.cpp View File

@@ -20,6 +20,7 @@
#include "JackConstants.h"
#include "JackDriverLoader.h"
#include "JackTools.h"
#include "JackError.h"
#include <stdlib.h>
#include <stdio.h>
#include <assert.h>
@@ -46,6 +47,15 @@ namespace Jack {
{
throw JackNetException();
}
int JackTools::MkDir(const char* path)
{
#ifdef WIN32
return CreateDirectory(path, NULL) == 0;
#else
return mkdir(path, 0777) != 0;
#endif
}

#define DEFAULT_TMP_DIR "/tmp"
char* jack_tmpdir = (char*)DEFAULT_TMP_DIR;


+ 4
- 0
common/JackTools.h View File

@@ -22,7 +22,10 @@

#ifdef WIN32
#include <windows.h>
#define DIR_SEPARATOR '\\'
#else
#define DIR_SEPARATOR '/'
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include <dirent.h>
@@ -58,6 +61,7 @@ namespace Jack

static void KillServer();

static int MkDir(const char* path);
static char* UserDir();
static char* ServerDir ( const char* server_name, char* server_dir );
static const char* DefaultServerName();


+ 229
- 0
common/jack/session.h View File

@@ -0,0 +1,229 @@
/*
Copyright (C) 2001 Paul Davis
Copyright (C) 2004 Jack O'Quin
Copyright (C) 2010 Torben Hohn
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

*/

#ifndef __jack_session_h__
#define __jack_session_h__

#ifdef __cplusplus
extern "C" {
#endif

#include <jack/types.h>
#include <jack/weakmacros.h>

/**
* @defgroup SessionClientFunctions Session API for clients.
* @{
*/


/**
* session event types.
*
* if a client cant save templates, i might just do a normal save.
*
* the rationale, why there is no quit without save, is that a client
* might refuse to quit when it has unsaved data.
* however some other clients might have already quit.
* this results in too much confusion, so we just dont support that.
* the session manager can check, if the saved state is different from a previous
* save, and just remove the saved stuff.
*
* (an inquiry function, whether a quit is ok, followed by a quit event
* would have a race)
*/
enum JackSessionEventType {
JackSessionSave = 1,
JackSessionSaveAndQuit = 2,
JackSessionSaveTemplate = 3
};

typedef enum JackSessionEventType jack_session_event_type_t;

enum JackSessionFlags {
/**
* an error occured while saving.
*/
JackSessionSaveError = 0x01,

/**
* this reply indicates that a client is part of a multiclient application.
* the command reply is left empty. but the session manager should still
* consider this client part of a session. it will come up due to invocation of another
* client.
*/
JackSessionChildClient = 0x02
};

typedef enum JackSessionFlags jack_session_flags_t;

struct _jack_session_event {
/**
* the actual type of this session event.
*/
jack_session_event_type_t type;

/**
* session_directory with trailing separator
* this is per client. so the client can do whatever it likes in here.
*/
const char *session_dir;

/**
* client_uuid which must be specified to jack_client_open on session reload.
* client can specify it in the returned commandline as an option, or just save it
* with the state file.
*/
const char *client_uuid;

/**
* the command_line is the reply of the client.
* it specifies in a platform dependent way, how the client must be restarted upon session reload.
*
* probably it should contain ${SESSION_DIR} instead of the actual session dir.
* this would basically make the session dir moveable.
*
* ownership of the memory is handed to jack.
* initially set to NULL by jack;
*/
char *command_line;

/**
* flags to be set by the client. normally left 0.
*/
jack_session_flags_t flags;
};

typedef struct _jack_session_event jack_session_event_t;

/**
* Prototype for the client supplied function that is called
* whenever a session notification is sent via jack_session_notify().
*
* The session_id must be passed to jack_client_open on session reload (this can be
* done by specifying it somehow on the returned command line).
*
* @param event the event_structure.
* @param arg pointer to a client supplied structure
*/
typedef void (*JackSessionCallback)(jack_session_event_t *event, void *arg);

/**
* Tell the JACK server to call @a save_callback the session handler wants
* to save.
*
* @return 0 on success, otherwise a non-zero error code
*/
int jack_set_session_callback(jack_client_t *client,
JackSessionCallback session_callback,
void *arg) JACK_WEAK_EXPORT;

/**
* reply to a session_event
*
* this can either be called directly from the callback, or later from a different thread.
* so its possible to just stick the event pointer into a pipe and execute the save code
* from the gui thread.
*
* @return 0 on success, otherwise a non-zero error code
*/

int jack_session_reply( jack_client_t *client, jack_session_event_t *event ) JACK_WEAK_EXPORT;


/**
* free memory used by a jack_session_event_t
* this also frees the memory used by the command_line pointer.
* if its non NULL.
*/

void jack_session_event_free (jack_session_event_t *event);

/*@}*/


/**
* @defgroup JackSessionManagerAPI this API is intended for a sessionmanager.
* this API could be server specific. if we dont reach consensus here,
* we can just drop it.
* i know its a bit clumsy.
* but this api isnt required to be as stable as the client api.
* @{
*/

typedef struct {
const char *uuid;
const char *client_name;
const char *command;
jack_session_flags_t flags;
} jack_session_command_t;

/**
* send a save or quit event, to all clients listening for session
* callbacks. the returned strings of the clients are accumulated and
* returned as an array of jack_session_command_t.
* its terminated by ret[i].uuid == NULL
* target == NULL means send to all interested clients. otherwise a clientname
*/

jack_session_command_t *jack_session_notify (jack_client_t* client,
const char *target,
jack_session_event_type_t type,
const char *path ) JACK_WEAK_EXPORT;

/**
* free the memory allocated by a session command.
*/

void jack_session_commands_free (jack_session_command_t *cmds) JACK_WEAK_EXPORT;

/**
* get the sessionid for a client name.
* the sessionmanager needs this to reassociate a client_name to the session_id.
*/

char *jack_get_uuid_for_client_name( jack_client_t *client, const char *client_name ) JACK_WEAK_EXPORT;

/**
* get the client name for a session_id.
* in order to snapshot the graph connections, the sessionmanager needs to map
* session_ids to client names.
*/

char *jack_get_client_name_by_uuid( jack_client_t *client, const char *client_uuid ) JACK_WEAK_EXPORT;

/**
* reserve a client name and associate it to a uuid.
* when a client later call jack_client_open() and specifies the uuid,
* jackd will assign the reserved name.
* this allows a session manager to know in advance under which client name
* its managed clients will appear.
*
* @return 0 on success, otherwise a non-zero error code
*/

int
jack_reserve_client_name( jack_client_t *client, const char *name, const char *uuid ) JACK_WEAK_EXPORT;

#ifdef __cplusplus
}
#endif
#endif

+ 47
- 43
common/jack/types.h View File

@@ -23,18 +23,17 @@

#include <jack/systemdeps.h>


typedef int32_t jack_shmsize_t;

/**
* Type used to represent sample frame counts.
*/
typedef uint32_t jack_nframes_t;
typedef uint32_t jack_nframes_t;

/**
* Maximum value that can be stored in jack_nframes_t
*/
#define JACK_MAX_FRAMES (4294967295U) /* This should be UINT32_MAX, but C++ has a problem with that. */
#define JACK_MAX_FRAMES (4294967295U) /* This should be UINT32_MAX, but C++ has a problem with that. */

/**
* Type used to represent the value of free running
@@ -284,9 +283,9 @@ enum JackPortFlags {
/**
* JackPortIsTerminal means:
*
* for an input port: the data received by the port
* for an input port: the data received by the port
* will not be passed on or made
* available at any other port
* available at any other port
*
* for an output port: the data available at the port
* does not originate from any other port
@@ -345,11 +344,16 @@ enum JackOptions {
* Pass optional <em>(char *) load_init</em> string to the
* jack_initialize() entry point of an internal client.
*/
JackLoadInit = 0x10
JackLoadInit = 0x10,

/**
* pass a SessionID Token this allows the sessionmanager to identify the client again.
*/
JackSessionID = 0x20
};

/** Valid options for opening an external client. */
#define JackOpenOptions (JackServerName|JackNoStartServer|JackUseExactName)
#define JackOpenOptions (JackSessionID|JackServerName|JackNoStartServer|JackUseExactName)

/** Valid options for loading an internal client. */
#define JackLoadOptions (JackLoadInit|JackLoadName|JackUseExactName)
@@ -456,20 +460,20 @@ typedef enum {
JackTransportRolling = 1, /**< Transport playing */
JackTransportLooping = 2, /**< For OLD_TRANSPORT, now ignored */
JackTransportStarting = 3, /**< Waiting for sync ready */
JackTransportNetStarting = 4, /**< Waiting for sync ready on the network*/
JackTransportNetStarting = 4, /**< Waiting for sync ready on the network*/

} jack_transport_state_t;

typedef uint64_t jack_unique_t; /**< Unique ID (opaque) */
typedef uint64_t jack_unique_t; /**< Unique ID (opaque) */

/**
* Optional struct jack_position_t fields.
*/
typedef enum {

JackPositionBBT = 0x10, /**< Bar, Beat, Tick */
JackPositionTimecode = 0x20, /**< External timecode */
JackBBTFrameOffset = 0x40, /**< Frame offset of BBT information */
JackPositionBBT = 0x10, /**< Bar, Beat, Tick */
JackPositionTimecode = 0x20, /**< External timecode */
JackBBTFrameOffset = 0x40, /**< Frame offset of BBT information */
JackAudioVideoRatio = 0x80, /**< audio frames per video frame */
JackVideoFrameOffset = 0x100 /**< frame offset of first video frame */
@@ -482,31 +486,31 @@ typedef enum {
typedef struct {

/* these four cannot be set from clients: the server sets them */
jack_unique_t unique_1; /**< unique ID */
jack_time_t usecs; /**< monotonic, free-rolling */
jack_nframes_t frame_rate; /**< current frame rate (per second) */
jack_nframes_t frame; /**< frame number, always present */
jack_unique_t unique_1; /**< unique ID */
jack_time_t usecs; /**< monotonic, free-rolling */
jack_nframes_t frame_rate; /**< current frame rate (per second) */
jack_nframes_t frame; /**< frame number, always present */

jack_position_bits_t valid; /**< which other fields are valid */
jack_position_bits_t valid; /**< which other fields are valid */

/* JackPositionBBT fields: */
int32_t bar; /**< current bar */
int32_t beat; /**< current beat-within-bar */
int32_t tick; /**< current tick-within-beat */
double bar_start_tick;
float beats_per_bar; /**< time signature "numerator" */
float beat_type; /**< time signature "denominator" */
double ticks_per_beat;
double beats_per_minute;
/* JackPositionTimecode fields: (EXPERIMENTAL: could change) */
double frame_time; /**< current time in seconds */
double next_time; /**< next sequential frame_time
int32_t bar; /**< current bar */
int32_t beat; /**< current beat-within-bar */
int32_t tick; /**< current tick-within-beat */
double bar_start_tick;
float beats_per_bar; /**< time signature "numerator" */
float beat_type; /**< time signature "denominator" */
double ticks_per_beat;
double beats_per_minute;
/* JackPositionTimecode fields: (EXPERIMENTAL: could change) */
double frame_time; /**< current time in seconds */
double next_time; /**< next sequential frame_time
(unless repositioned) */

/* JackBBTFrameOffset fields: */
jack_nframes_t bbt_offset; /**< frame offset for the BBT fields
jack_nframes_t bbt_offset; /**< frame offset for the BBT fields
(the given bar, beat, and tick
values actually refer to a time
frame_offset frames before the
@@ -540,10 +544,10 @@ typedef struct {
/* For binary compatibility, new fields should be allocated from
* this padding area with new valid bits controlling access, so
* the existing structure size and offsets are preserved. */
int32_t padding[7];
int32_t padding[7];

/* When (unique_1 == unique_2) the contents are consistent. */
jack_unique_t unique_2; /**< unique ID */
jack_unique_t unique_2; /**< unique ID */

} jack_position_t;

@@ -620,11 +624,11 @@ typedef void (*JackTimebaseCallback)(jack_transport_state_t state,
*/
typedef enum {

JackTransportState = 0x1, /**< Transport state */
JackTransportPosition = 0x2, /**< Frame number */
JackTransportLoop = 0x4, /**< Loop boundaries (ignored) */
JackTransportSMPTE = 0x8, /**< SMPTE (ignored) */
JackTransportBBT = 0x10 /**< Bar, Beat, Tick */
JackTransportState = 0x1, /**< Transport state */
JackTransportPosition = 0x2, /**< Frame number */
JackTransportLoop = 0x4, /**< Loop boundaries (ignored) */
JackTransportSMPTE = 0x8, /**< SMPTE (ignored) */
JackTransportBBT = 0x10 /**< Bar, Beat, Tick */

} jack_transport_bits_t;

@@ -638,17 +642,17 @@ typedef struct {

/* these two cannot be set from clients: the server sets them */

jack_nframes_t frame_rate; /**< current frame rate (per second) */
jack_time_t usecs; /**< monotonic, free-rolling */
jack_nframes_t frame_rate; /**< current frame rate (per second) */
jack_time_t usecs; /**< monotonic, free-rolling */

jack_transport_bits_t valid; /**< which fields are legal to read */
jack_transport_bits_t valid; /**< which fields are legal to read */
jack_transport_state_t transport_state;
jack_nframes_t frame;
jack_nframes_t loop_start;
jack_nframes_t loop_end;

long smpte_offset; /**< SMPTE offset (from frame 0) */
float smpte_frame_rate; /**< 29.97, 30, 24 etc. */
long smpte_offset; /**< SMPTE offset (from frame 0) */
float smpte_frame_rate; /**< 29.97, 30, 24 etc. */

int bar;
int beat;


+ 13
- 6
common/varargs.h View File

@@ -32,14 +32,15 @@ extern "C"

/* variable argument structure */
typedef struct {
char *server_name; /* server name */
char *load_name; /* load module name */
char *load_init; /* initialization string */
char *server_name; /* server name */
char *load_name; /* load module name */
char *load_init; /* initialization string */
int session_id; /* requested session_id */
}
jack_varargs_t;

static const char* jack_default_server_name (void)
{
{
const char *server_name;
if ((server_name = getenv("JACK_DEFAULT_SERVER")) == NULL)
server_name = "default";
@@ -47,13 +48,14 @@ extern "C"
}

static inline void jack_varargs_init (jack_varargs_t *va)
{
{
memset (va, 0, sizeof(jack_varargs_t));
va->server_name = (char*)jack_default_server_name();
va->session_id = -1;
}

static inline void jack_varargs_parse (jack_options_t options, va_list ap, jack_varargs_t *va)
{
{
// initialize default settings
jack_varargs_init (va);

@@ -66,6 +68,11 @@ extern "C"
va->load_name = va_arg(ap, char *);
if ((options & JackLoadInit))
va->load_init = va_arg(ap, char *);
if ((options & JackSessionID)) {
char *sid = va_arg(ap, char *);
if (sid)
va->session_id = atoi( sid );
}
}

#ifdef __cplusplus


+ 5
- 9
common/wscript View File

@@ -97,7 +97,7 @@ def build(bld):
'../posix/JackPosixThread.cpp',
'../macosx/JackMachThread.cpp',
'../macosx/JackMachSemaphore.cpp',
'../macosx/JackMachPort.cpp',
'../posix/JackSocket.cpp',
'../macosx/JackMachTime.c',
]
includes = ['../macosx', '../macosx/RPC', '../posix'] + includes
@@ -152,11 +152,9 @@ def build(bld):

if bld.env['IS_MACOSX']:
serverlib.source += [
'../macosx/JackMachServerChannel.cpp',
'../macosx/JackMachNotifyChannel.cpp',
'../macosx/JackMachServerNotifyChannel.cpp',
'../macosx/JackMacEngineRPC.cpp',
'../macosx/RPC/JackRPCClientUser.c',
'../posix/JackSocketServerChannel.cpp',
'../posix/JackSocketNotifyChannel.cpp',
'../posix/JackSocketServerNotifyChannel.cpp',
'../posix/JackNetUnixSocket.cpp',
]

@@ -205,9 +203,7 @@ def build(bld):

if bld.env['IS_MACOSX']:
clientlib.source += [
'../macosx/JackMachClientChannel.cpp',
'../macosx/RPC/JackRPCEngineUser.c',
'../macosx/JackMacLibClientRPC.cpp',
'../posix/JackSocketClientChannel.cpp',
'../posix/JackPosixServerLaunch.cpp',
]



+ 184
- 0
example-clients/session_notify.c View File

@@ -0,0 +1,184 @@
/*
* session_notify.c -- ultra minimal session manager
*
* Copyright (C) 2010 Torben Hohn.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/

#include <stdio.h>
#include <errno.h>
#include <unistd.h>
#include <signal.h>
#include <stdlib.h>
#include <string.h>
#include <jack/jack.h>
#include <jack/types.h>
#include <jack/jslist.h>
#include <jack/transport.h>
#include <jack/session.h>

char *package; /* program name */
jack_client_t *client;

jack_session_event_type_t notify_type;
char *save_path = NULL;

void jack_shutdown(void *arg)
{
fprintf(stderr, "JACK shut down, exiting ...\n");
exit(1);
}

void signal_handler(int sig)
{
jack_client_close(client);
fprintf(stderr, "signal received, exiting ...\n");
exit(0);
}

void parse_arguments(int argc, char *argv[])
{

/* basename $0 */
package = strrchr(argv[0], '/');
if (package == 0)
package = argv[0];
else
package++;

if (argc==2) {
if( !strcmp( argv[1], "quit" ) ) {
notify_type = JackSessionSaveAndQuit;
return;
}
}
if (argc==3) {
if( !strcmp( argv[1], "save" ) ) {
notify_type = JackSessionSave;
save_path = argv[2];
return;
}

}
fprintf(stderr, "usage: %s quit|save [path]\n", package);
exit(9);
}

typedef struct {
char name[32];
char uuid[16];
} uuid_map_t;

JSList *uuid_map = NULL;

void add_uuid_mapping( const char *uuid ) {
char *clientname = jack_get_client_name_by_uuid( client, uuid );
if( !clientname ) {
printf( "error... cant find client for uuid %s", uuid );

return;
}

uuid_map_t *mapping = malloc( sizeof(uuid_map_t) );
snprintf( mapping->uuid, sizeof(mapping->uuid), "%s", uuid );
snprintf( mapping->name, sizeof(mapping->name), "%s", clientname );
uuid_map = jack_slist_append( uuid_map, mapping );
}

char *map_port_name_to_uuid_port( const char *port_name )
{
JSList *node;
char retval[300];
char *port_component = strchr( port_name,':' );
char *client_component = strdup( port_name );
strchr( client_component, ':' )[0] = '\0';

sprintf( retval, "%s", port_name );

for( node=uuid_map; node; node=jack_slist_next(node) ) {
uuid_map_t *mapping = node->data;
if( !strcmp( mapping->name, client_component ) ) {
sprintf( retval, "%s%s", mapping->uuid, port_component );
break;
}
}

return strdup(retval);
}

int main(int argc, char *argv[])
{
parse_arguments(argc, argv);
jack_session_command_t *retval;
int k,i,j;


/* become a JACK client */
if ((client = jack_client_open(package, JackNullOption, NULL)) == 0) {
fprintf(stderr, "JACK server not running?\n");
exit(1);
}

signal(SIGQUIT, signal_handler);
signal(SIGTERM, signal_handler);
signal(SIGHUP, signal_handler);
signal(SIGINT, signal_handler);

jack_on_shutdown(client, jack_shutdown, 0);

jack_activate(client);


retval = jack_session_notify( client, NULL, notify_type, save_path );
printf( "retval = %p\n", retval );
for(i=0; retval[i].uuid; i++ ) {
printf( "export SESSION_DIR=\"%s%s/\"\n", save_path, retval[i].client_name );
printf( "%s &\n", retval[i].command );
add_uuid_mapping(retval[i].uuid);
}

printf( "sleep 10\n" );

for(k=0; retval[k].uuid; k++ ) {

char* port_regexp = alloca( jack_client_name_size()+3 );
char* client_name = jack_get_client_name_by_uuid( client, retval[k].uuid );
snprintf( port_regexp, jack_client_name_size()+3, "%s:.*", client_name );
jack_free(client_name);
const char **ports = jack_get_ports( client, port_regexp, NULL, 0 );
if( !ports ) {
continue;
}
for (i = 0; ports[i]; ++i) {
const char **connections;
if ((connections = jack_port_get_all_connections (client, jack_port_by_name(client, ports[i]))) != 0) {
for (j = 0; connections[j]; j++) {
char *src = map_port_name_to_uuid_port( ports[i] );
char *dst = map_port_name_to_uuid_port( connections[j] );
printf( "jack_connect -u \"%s\" \"%s\"\n", src, dst );
}
jack_free (connections);
}
}
jack_free(ports);

}
jack_session_commands_free(retval);

jack_client_close(client);

return 0;
}

+ 202
- 0
example-clients/simple_session_client.c View File

@@ -0,0 +1,202 @@
/** @file simple_session_client.c
*
* @brief This simple client demonstrates the most basic features of JACK
* as they would be used by many applications.
* this version also adds session manager functionality.
*/

#include <stdio.h>
#include <errno.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>

#include <jack/jack.h>
#include <jack/types.h>
#include <jack/session.h>

jack_port_t *input_port;
jack_port_t *output_port;
jack_client_t *client;

int simple_quit = 0;

/**
* The process callback for this JACK application is called in a
* special realtime thread once for each audio cycle.
*
* This client does nothing more than copy data from its input
* port to its output port. It will exit when stopped by
* the user (e.g. using Ctrl-C on a unix-ish operating system)
*/
int
process (jack_nframes_t nframes, void *arg)
{
jack_default_audio_sample_t *in, *out;

in = jack_port_get_buffer (input_port, nframes);
out = jack_port_get_buffer (output_port, nframes);
memcpy (out, in,
sizeof (jack_default_audio_sample_t) * nframes);

return 0;
}

void
session_callback (jack_session_event_t *event, void *arg)
{
char retval[100];
printf ("session notification\n");
printf ("path %s, uuid %s, type: %s\n", event->session_dir, event->client_uuid, event->type == JackSessionSave ? "save" : "quit");


snprintf (retval, 100, "jack_simple_session_client %s", event->client_uuid);
event->command_line = strdup (retval);

jack_session_reply( client, event );

if (event->type == JackSessionSaveAndQuit) {
simple_quit = 1;
}

jack_session_event_free (event);
}

/**
* JACK calls this shutdown_callback if the server ever shuts down or
* decides to disconnect the client.
*/
void
jack_shutdown (void *arg)
{
exit (1);
}

int
main (int argc, char *argv[])
{
const char **ports;
const char *client_name = "simple";
jack_status_t status;

/* open a client connection to the JACK server */

if( argc == 1 )
client = jack_client_open (client_name, JackNullOption, &status );
else if( argc == 2 )
client = jack_client_open (client_name, JackSessionID, &status, argv[1] );

if (client == NULL) {
fprintf (stderr, "jack_client_open() failed, "
"status = 0x%2.0x\n", status);
if (status & JackServerFailed) {
fprintf (stderr, "Unable to connect to JACK server\n");
}
exit (1);
}
if (status & JackServerStarted) {
fprintf (stderr, "JACK server started\n");
}
if (status & JackNameNotUnique) {
client_name = jack_get_client_name(client);
fprintf (stderr, "unique name `%s' assigned\n", client_name);
}

/* tell the JACK server to call `process()' whenever
there is work to be done.
*/

jack_set_process_callback (client, process, 0);

/* tell the JACK server to call `jack_shutdown()' if
it ever shuts down, either entirely, or if it
just decides to stop calling us.
*/

jack_on_shutdown (client, jack_shutdown, 0);

/* tell the JACK server to call `session_callback()' if
the session is saved.
*/

jack_set_session_callback (client, session_callback, NULL);

/* display the current sample rate.
*/

printf ("engine sample rate: %" PRIu32 "\n",
jack_get_sample_rate (client));

/* create two ports */

input_port = jack_port_register (client, "input",
JACK_DEFAULT_AUDIO_TYPE,
JackPortIsInput, 0);
output_port = jack_port_register (client, "output",
JACK_DEFAULT_AUDIO_TYPE,
JackPortIsOutput, 0);

if ((input_port == NULL) || (output_port == NULL)) {
fprintf(stderr, "no more JACK ports available\n");
exit (1);
}

/* Tell the JACK server that we are ready to roll. Our
* process() callback will start running now. */

if (jack_activate (client)) {
fprintf (stderr, "cannot activate client");
exit (1);
}

/* Connect the ports. You can't do this before the client is
* activated, because we can't make connections to clients
* that aren't running. Note the confusing (but necessary)
* orientation of the driver backend ports: playback ports are
* "input" to the backend, and capture ports are "output" from
* it.
*/


/* only do the autoconnect when not reloading from a session.
* in case of a session reload, the SM will restore our connections
*/

if (argc==1) {

ports = jack_get_ports (client, NULL, NULL,
JackPortIsPhysical|JackPortIsOutput);
if (ports == NULL) {
fprintf(stderr, "no physical capture ports\n");
exit (1);
}

if (jack_connect (client, ports[0], jack_port_name (input_port))) {
fprintf (stderr, "cannot connect input ports\n");
}

free (ports);

ports = jack_get_ports (client, NULL, NULL,
JackPortIsPhysical|JackPortIsInput);
if (ports == NULL) {
fprintf(stderr, "no physical playback ports\n");
exit (1);
}

if (jack_connect (client, jack_port_name (output_port), ports[0])) {
fprintf (stderr, "cannot connect output ports\n");
}

free (ports);
}

/* keep running until until we get a quit event */

while (!simple_quit)
sleep(1);

jack_client_close (client);
exit (0);
}

+ 2
- 0
example-clients/wscript View File

@@ -22,6 +22,8 @@ example_programs = {
'jack_monitor_client' : 'monitor_client.c',
'jack_thru' : 'thru_client.c',
'jack_cpu_load' : 'cpu_load.c',
'jack_simple_session_client' : 'simple_session_client.c',
'jack_session_notify' : 'session_notify.c',
'jack_server_control' : 'server_control.cpp',
}



+ 0
- 250
macosx/JackMacEngineRPC.cpp View File

@@ -1,250 +0,0 @@
/*
Copyright (C) 2004-2008 Grame

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

*/

#include "JackServer.h"
#include "JackNotification.h"
#include "JackLockedEngine.h"
#include "JackRPCEngine.h"
#include "JackMachServerChannel.h"
#include "JackException.h"
#include <assert.h>

using namespace Jack;

//-------------------
// Client management
//-------------------

#define rpc_type kern_return_t // for astyle

rpc_type server_rpc_jack_client_check(mach_port_t private_port, client_name_t name, client_name_t name_res, int protocol, int options, int* status, int* result)
{
jack_log("rpc_jack_client_check");
JackMachServerChannel* channel = JackMachServerChannel::fPortTable[private_port];
assert(channel);
channel->ClientCheck((char*)name, (char*)name_res, protocol, options, status, result);
return KERN_SUCCESS;
}

rpc_type server_rpc_jack_client_open(mach_port_t server_port, client_name_t name, int pid, mach_port_t* private_port, int* shared_engine, int* shared_client, int* shared_graph, int* result)
{
jack_log("rpc_jack_client_open name = %s", name);
JackMachServerChannel* channel = JackMachServerChannel::fPortTable[server_port];
assert(channel);
channel->ClientOpen((char*)name, pid, private_port, shared_engine, shared_client, shared_graph, result);
return KERN_SUCCESS;
}

rpc_type server_rpc_jack_client_close(mach_port_t private_port, int refnum, int* result)
{
jack_log("rpc_jack_client_close");
JackMachServerChannel* channel = JackMachServerChannel::fPortTable[private_port];
assert(channel);
channel->ClientClose(private_port, refnum);
*result = 0;
return KERN_SUCCESS;
}

rpc_type server_rpc_jack_client_activate(mach_port_t private_port, int refnum, int is_real_time, int* result)
{
jack_log("rpc_jack_client_activate");
JackMachServerChannel* channel = JackMachServerChannel::fPortTable[private_port];
assert(channel);
*result = channel->GetEngine()->ClientActivate(refnum, is_real_time);
return KERN_SUCCESS;
}

rpc_type server_rpc_jack_client_deactivate(mach_port_t private_port, int refnum, int* result)
{
jack_log("rpc_jack_client_deactivate");
JackMachServerChannel* channel = JackMachServerChannel::fPortTable[private_port];
assert(channel);
*result = channel->GetEngine()->ClientDeactivate(refnum);
return KERN_SUCCESS;
}

//-----------------
// Port management
//-----------------

rpc_type server_rpc_jack_port_register(mach_port_t private_port, int refnum, client_port_name_t name, client_port_type_t type, unsigned int flags, unsigned int buffer_size, unsigned int* port_index, int* result)
{
jack_log("rpc_jack_port_register ref = %d name = %s", refnum, name);
JackMachServerChannel* channel = JackMachServerChannel::fPortTable[private_port];
assert(channel);
*result = channel->GetEngine()->PortRegister(refnum, name, type, flags, buffer_size, port_index);
return KERN_SUCCESS;
}

rpc_type server_rpc_jack_port_unregister(mach_port_t private_port, int refnum, int port, int* result)
{
jack_log("rpc_jack_port_unregister ref = %d port = %d ", refnum, port);
JackMachServerChannel* channel = JackMachServerChannel::fPortTable[private_port];
assert(channel);
*result = channel->GetEngine()->PortUnRegister(refnum, port);
return KERN_SUCCESS;
}

rpc_type server_rpc_jack_port_connect_name(mach_port_t private_port, int refnum, client_port_name_t src, client_port_name_t dst, int* result)
{
jack_log("rpc_jack_port_connect_name");
JackMachServerChannel* channel = JackMachServerChannel::fPortTable[private_port];
assert(channel);
*result = channel->GetEngine()->PortConnect(refnum, src, dst);
return KERN_SUCCESS;
}

rpc_type server_rpc_jack_port_disconnect_name(mach_port_t private_port, int refnum, client_port_name_t src, client_port_name_t dst, int* result)
{
jack_log("rpc_jack_port_disconnect_name");
JackMachServerChannel* channel = JackMachServerChannel::fPortTable[private_port];
assert(channel);
*result = channel->GetEngine()->PortDisconnect(refnum, src, dst);
return KERN_SUCCESS;
}

rpc_type server_rpc_jack_port_connect(mach_port_t private_port, int refnum, int src, int dst, int* result)
{
jack_log("rpc_jack_port_connect");
JackMachServerChannel* channel = JackMachServerChannel::fPortTable[private_port];
assert(channel);
*result = channel->GetEngine()->PortConnect(refnum, src, dst);
return KERN_SUCCESS;
}

rpc_type server_rpc_jack_port_disconnect(mach_port_t private_port, int refnum, int src, int dst, int* result)
{
jack_log("rpc_jack_port_disconnect");
JackMachServerChannel* channel = JackMachServerChannel::fPortTable[private_port];
assert(channel);
*result = channel->GetEngine()->PortDisconnect(refnum, src, dst);
return KERN_SUCCESS;
}

rpc_type server_rpc_jack_port_rename(mach_port_t private_port, int refnum, int port, client_port_name_t name, int* result)
{
jack_log("server_rpc_jack_port_rename");
JackMachServerChannel* channel = JackMachServerChannel::fPortTable[private_port];
assert(channel);
*result = channel->GetEngine()->PortRename(refnum, port, name);
return KERN_SUCCESS;
}

//------------------------
// Buffer size, freewheel
//------------------------

rpc_type server_rpc_jack_set_buffer_size(mach_port_t private_port, int buffer_size, int* result)
{
jack_log("server_rpc_jack_set_buffer_size");
JackMachServerChannel* channel = JackMachServerChannel::fPortTable[private_port];
assert(channel);
*result = channel->GetServer()->SetBufferSize(buffer_size);
return KERN_SUCCESS;
}

rpc_type server_rpc_jack_set_freewheel(mach_port_t private_port, int onoff, int* result)
{
jack_log("server_rpc_jack_set_freewheel");
JackMachServerChannel* channel = JackMachServerChannel::fPortTable[private_port];
assert(channel);
*result = channel->GetServer()->SetFreewheel(onoff);
return KERN_SUCCESS;
}

//----------------------
// Transport management
//----------------------

rpc_type server_rpc_jack_release_timebase(mach_port_t private_port, int refnum, int* result)
{
jack_log("server_rpc_jack_release_timebase");
JackMachServerChannel* channel = JackMachServerChannel::fPortTable[private_port];
assert(channel);
*result = channel->GetServer()->ReleaseTimebase(refnum);
return KERN_SUCCESS;
}

rpc_type server_rpc_jack_set_timebase_callback(mach_port_t private_port, int refnum, int conditional, int* result)
{
jack_log("server_rpc_jack_set_timebase_callback");
JackMachServerChannel* channel = JackMachServerChannel::fPortTable[private_port];
assert(channel);
*result = channel->GetServer()->SetTimebaseCallback(refnum, conditional);
return KERN_SUCCESS;
}

//------------------
// Internal clients
//------------------

rpc_type server_rpc_jack_get_internal_clientname(mach_port_t private_port, int refnum, int int_ref, client_name_t name_res, int* result)
{
jack_log("server_rpc_jack_get_internal_clientname");
JackMachServerChannel* channel = JackMachServerChannel::fPortTable[private_port];
assert(channel);
*result = channel->GetServer()->GetEngine()->GetInternalClientName(int_ref, (char*)name_res);
return KERN_SUCCESS;
}

rpc_type server_rpc_jack_internal_clienthandle(mach_port_t private_port, int refnum, client_name_t client_name, int* status, int* int_ref, int* result)
{
jack_log("server_rpc_jack_internal_clienthandle");
JackMachServerChannel* channel = JackMachServerChannel::fPortTable[private_port];
assert(channel);
*result = channel->GetServer()->GetEngine()->InternalClientHandle(client_name, status, int_ref);
return KERN_SUCCESS;
}

rpc_type server_rpc_jack_internal_clientload(mach_port_t private_port, int refnum, client_name_t client_name, so_name_t so_name, objet_data_t objet_data, int options, int* status, int* int_ref, int* result)
{
jack_log("server_rpc_jack_internal_clientload");
JackMachServerChannel* channel = JackMachServerChannel::fPortTable[private_port];
assert(channel);
*result = channel->GetServer()->InternalClientLoad(client_name, so_name, objet_data, options, int_ref, status);
return KERN_SUCCESS;
}

rpc_type server_rpc_jack_internal_clientunload(mach_port_t private_port, int refnum, int int_ref, int* status, int* result)
{
jack_log("server_rpc_jack_internal_clientunload");
JackMachServerChannel* channel = JackMachServerChannel::fPortTable[private_port];
assert(channel);
*result = channel->GetServer()->GetEngine()->InternalClientUnload(int_ref, status);
return KERN_SUCCESS;
}

//-----------------
// RT notification
//-----------------

rpc_type server_rpc_jack_client_rt_notify(mach_port_t server_port, int refnum, int notify, int value)
{
jack_log("rpc_jack_client_rt_notify ref = %d notify = %d value = %d", refnum, notify, value);
JackMachServerChannel* channel = JackMachServerChannel::fPortTable[server_port];
assert(channel);
assert(channel->GetServer());
if (notify == kQUIT) {
throw JackQuitException();
} else {
channel->GetServer()->Notify(refnum, notify, value);
return KERN_SUCCESS;
}
}

+ 0
- 47
macosx/JackMacLibClientRPC.cpp View File

@@ -1,47 +0,0 @@
/*
Copyright (C) 2004-2008 Grame

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

*/

#include "JackLibClient.h"
#include "JackMachClientChannel.h"
#include "JackRPCEngine.h"
#include "JackLibGlobals.h"
#include <assert.h>

using namespace Jack;

#define rpc_type kern_return_t // for astyle

rpc_type rpc_jack_client_sync_notify(mach_port_t client_port, int refnum, client_name_t name, int notify, message_t message, int value1, int value2, int* result)
{
jack_log("rpc_jack_client_sync_notify ref = %ld name = %s notify = %ld message %s val1 = %ld val2 = %ld", refnum, name, notify, message, value1, value2);
JackClient* client = gClientTable[client_port];
assert(client);
*result = client->ClientNotify(refnum, name, notify, true, message, value1, value2);
return KERN_SUCCESS;
}

rpc_type rpc_jack_client_async_notify(mach_port_t client_port, int refnum, client_name_t name, int notify, message_t message, int value1, int value2)
{
jack_log("rpc_jack_client_async_notify ref = %ld name = %s notify = %ld message %s val1 = %ld val2 = %ld", refnum, name, notify, message, value1, value2);
JackClient* client = gClientTable[client_port];
assert(client);
client->ClientNotify(refnum, name, notify, false, message, value1, value2);
return KERN_SUCCESS;
}


+ 0
- 334
macosx/JackMachClientChannel.cpp View File

@@ -1,334 +0,0 @@
/*
Copyright (C) 2004-2008 Grame

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

*/

#include "JackMachClientChannel.h"
#include "JackRPCEngine.h"
#include "JackTools.h"
#include "JackRPCClientServer.c"
#include "JackError.h"
#include "JackLibClient.h"
#include "JackMachThread.h"
#include "JackConstants.h"

namespace Jack
{

std::map<mach_port_t, JackClient*> gClientTable;

JackMachClientChannel::JackMachClientChannel():fPrivatePort(0),fThread(this)
{}

JackMachClientChannel::~JackMachClientChannel()
{}

// Server <===> client

int JackMachClientChannel::ServerCheck(const char* server_name)
{
jack_log("JackMachClientChannel::ServerCheck = %s", server_name);
char jack_server_entry_name[512];
snprintf(jack_server_entry_name, sizeof(jack_server_entry_name), "%s.%d_%s", jack_server_entry, JackTools::GetUID(), server_name);

// Connect to server
if (!fServerPort.ConnectPort(jack_server_entry_name)) {
jack_error("Cannot connect to server Mach port");
return -1;
} else {
return 0;
}
}

int JackMachClientChannel::Open(const char* server_name, const char* name, char* name_res, JackClient* client, jack_options_t options, jack_status_t* status)
{
jack_log("JackMachClientChannel::Open name = %s", name);
char jack_server_entry_name[512];
snprintf(jack_server_entry_name, sizeof(jack_server_entry_name), "%s.%d_%s", jack_server_entry, JackTools::GetUID(), server_name);

// Connect to server
if (!fServerPort.ConnectPort(jack_server_entry_name)) {
jack_error("Cannot connect to server Mach port");
return -1;
}

// Check name in server
int result = 0;
ClientCheck(name, name_res, JACK_PROTOCOL_VERSION, (int)options, (int*)status, &result);
if (result < 0) {
int status1 = *status;
if (status1 & JackVersionError)
jack_error("JACK protocol mismatch %d", JACK_PROTOCOL_VERSION);
else
jack_error("Client name = %s conflits with another running client", name);
return -1;
}

// Prepare local port using client name
char buf[JACK_CLIENT_NAME_SIZE + 1];
snprintf(buf, sizeof(buf) - 1, "%s:%s", jack_client_entry, name_res);

if (!fClientPort.AllocatePort(buf, 16)) {
jack_error("Cannot allocate client Mach port");
return -1;
}

gClientTable[fClientPort.GetPort()] = client;
return 0;
}

void JackMachClientChannel::Close()
{
jack_log("JackMachClientChannel::Close");
gClientTable.erase(fClientPort.GetPort());
fServerPort.DisconnectPort();
fClientPort.DestroyPort();

if (fPrivatePort != 0) {
kern_return_t res;
if ((res = mach_port_destroy(mach_task_self(), fPrivatePort)) != KERN_SUCCESS) {
jack_error("JackMachClientChannel::Close err = %s", mach_error_string(res));
}
}
}

int JackMachClientChannel::Start()
{
jack_log("JackMachClientChannel::Start");
/*
To be sure notification thread is started before ClientOpen is called.
*/
if (fThread.StartSync() != 0) {
jack_error("Cannot start Jack client listener");
return -1;
} else {
return 0;
}
}

void JackMachClientChannel::Stop()
{
jack_log("JackMachClientChannel::Stop");
fThread.Kill();
}

void JackMachClientChannel::ClientCheck(const char* name, char* name_res, int protocol, int options, int* status, int* result)
{
kern_return_t res = rpc_jack_client_check(fServerPort.GetPort(), (char*)name, name_res, protocol, options, status, result);
if (res != KERN_SUCCESS) {
*result = -1;
jack_error("JackMachClientChannel::ClientCheck err = %s", mach_error_string(res));
}
}

void JackMachClientChannel::ClientOpen(const char* name, int pid, int* shared_engine, int* shared_client, int* shared_graph, int* result)
{
kern_return_t res = rpc_jack_client_open(fServerPort.GetPort(), (char*)name, pid, &fPrivatePort, shared_engine, shared_client, shared_graph, result);
if (res != KERN_SUCCESS) {
*result = -1;
jack_error("JackMachClientChannel::ClientOpen err = %s", mach_error_string(res));
}
}

void JackMachClientChannel::ClientClose(int refnum, int* result)
{
kern_return_t res = rpc_jack_client_close(fPrivatePort, refnum, result);
if (res != KERN_SUCCESS) {
*result = -1;
jack_error("JackMachClientChannel::ClientClose err = %s", mach_error_string(res));
}
}

void JackMachClientChannel::ClientActivate(int refnum, int is_real_time, int* result)
{
kern_return_t res = rpc_jack_client_activate(fPrivatePort, refnum, is_real_time, result);
if (res != KERN_SUCCESS) {
*result = -1;
jack_error("JackMachClientChannel::ClientActivate err = %s", mach_error_string(res));
}
}

void JackMachClientChannel::ClientDeactivate(int refnum, int* result)
{
kern_return_t res = rpc_jack_client_deactivate(fPrivatePort, refnum, result);
if (res != KERN_SUCCESS) {
*result = -1;
jack_error("JackMachClientChannel::ClientDeactivate err = %s", mach_error_string(res));
}
}

void JackMachClientChannel::PortRegister(int refnum, const char* name, const char* type, unsigned int flags, unsigned int buffer_size, jack_port_id_t* port_index, int* result)
{
kern_return_t res = rpc_jack_port_register(fPrivatePort, refnum, (char*)name, (char*)type, flags, buffer_size, port_index, result);
if (res != KERN_SUCCESS) {
*result = -1;
jack_error("JackMachClientChannel::PortRegister err = %s", mach_error_string(res));
}
}

void JackMachClientChannel::PortUnRegister(int refnum, jack_port_id_t port_index, int* result)
{
kern_return_t res = rpc_jack_port_unregister(fPrivatePort, refnum, port_index, result);
if (res != KERN_SUCCESS) {
*result = -1;
jack_error("JackMachClientChannel::PortUnRegister err = %s", mach_error_string(res));
}
}

void JackMachClientChannel::PortConnect(int refnum, const char* src, const char* dst, int* result)
{
kern_return_t res = rpc_jack_port_connect_name(fPrivatePort, refnum, (char*)src, (char*)dst, result);
if (res != KERN_SUCCESS) {
jack_error("JackMachClientChannel::PortConnect err = %s", mach_error_string(res));
}
}

void JackMachClientChannel::PortDisconnect(int refnum, const char* src, const char* dst, int* result)
{
kern_return_t res = rpc_jack_port_disconnect_name(fPrivatePort, refnum, (char*)src, (char*)dst, result);
if (res != KERN_SUCCESS) {
*result = -1;
jack_error("JackMachClientChannel::PortDisconnect err = %s", mach_error_string(res));
}
}

void JackMachClientChannel::PortConnect(int refnum, jack_port_id_t src, jack_port_id_t dst, int* result)
{
kern_return_t res = rpc_jack_port_connect(fPrivatePort, refnum, src, dst, result);
if (res != KERN_SUCCESS) {
*result = -1;
jack_error("JackMachClientChannel::PortConnect err = %s", mach_error_string(res));
}
}

void JackMachClientChannel::PortDisconnect(int refnum, jack_port_id_t src, jack_port_id_t dst, int* result)
{
kern_return_t res = rpc_jack_port_disconnect(fPrivatePort, refnum, src, dst, result);
if (res != KERN_SUCCESS) {
*result = -1;
jack_error("JackMachClientChannel::PortDisconnect err = %s", mach_error_string(res));
}
}

void JackMachClientChannel::PortRename(int refnum, jack_port_id_t port, const char* name, int* result)
{
kern_return_t res = rpc_jack_port_rename(fPrivatePort, refnum, port, (char*)name, result);
if (res != KERN_SUCCESS) {
*result = -1;
jack_error("JackMachClientChannel::PortRename err = %s", mach_error_string(res));
}
}

void JackMachClientChannel::SetBufferSize(jack_nframes_t buffer_size, int* result)
{
kern_return_t res = rpc_jack_set_buffer_size(fPrivatePort, buffer_size, result);
if (res != KERN_SUCCESS) {
*result = -1;
jack_error("JackMachClientChannel::SetBufferSize err = %s", mach_error_string(res));
}
}

void JackMachClientChannel::SetFreewheel(int onoff, int* result)
{
kern_return_t res = rpc_jack_set_freewheel(fPrivatePort, onoff, result);
if (res != KERN_SUCCESS) {
*result = -1;
jack_error("JackMachClientChannel::SetFreewheel err = %s", mach_error_string(res));
}
}

void JackMachClientChannel::ReleaseTimebase(int refnum, int* result)
{
kern_return_t res = rpc_jack_release_timebase(fPrivatePort, refnum, result);
if (res != KERN_SUCCESS) {
*result = -1;
jack_error("JackMachClientChannel::ReleaseTimebase err = %s", mach_error_string(res));
}
}

void JackMachClientChannel::SetTimebaseCallback(int refnum, int conditional, int* result)
{
kern_return_t res = rpc_jack_set_timebase_callback(fPrivatePort, refnum, conditional, result);
if (res != KERN_SUCCESS) {
*result = -1;
jack_error("JackMachClientChannel::SetTimebaseCallback err = %s", mach_error_string(res));
}
}

void JackMachClientChannel::GetInternalClientName(int refnum, int int_ref, char* name_res, int* result)
{
kern_return_t res = rpc_jack_get_internal_clientname(fPrivatePort, refnum, int_ref, name_res, result);
if (res != KERN_SUCCESS) {
*result = -1;
jack_error("JackMachClientChannel::GetInternalClientName err = %s", mach_error_string(res));
}
}

void JackMachClientChannel::InternalClientHandle(int refnum, const char* client_name, int* status, int* int_ref, int* result)
{
kern_return_t res = rpc_jack_internal_clienthandle(fPrivatePort, refnum, (char*)client_name, status, int_ref, result);
if (res != KERN_SUCCESS) {
*result = -1;
jack_error("JackMachClientChannel::InternalClientHandle err = %s", mach_error_string(res));
}
}

void JackMachClientChannel::InternalClientLoad(int refnum, const char* client_name, const char* so_name, const char* objet_data, int options, int* status, int* int_ref, int* result)
{
const char* int_client_name = (client_name) ? client_name : "";
const char* int_so_name = (so_name) ? so_name : "";
const char* int_objet_data = (objet_data) ? objet_data : "";
kern_return_t res = rpc_jack_internal_clientload(fPrivatePort, refnum, (char*)int_client_name, (char*)int_so_name, (char*)int_objet_data, options, status, int_ref, result);
if (res != KERN_SUCCESS) {
*result = -1;
jack_error("JackMachClientChannel::InternalClientLoad err = %s", mach_error_string(res));
}
}

void JackMachClientChannel::InternalClientUnload(int refnum, int int_ref, int* status, int* result)
{
kern_return_t res = rpc_jack_internal_clientunload(fPrivatePort, refnum, int_ref, status, result);
if (res != KERN_SUCCESS) {
*result = -1;
jack_error("JackMachClientChannel::InternalClientUnload err = %s", mach_error_string(res));
}
}

bool JackMachClientChannel::Init()
{
jack_log("JackMachClientChannel::Init");
JackClient* client = gClientTable[fClientPort.GetPort()];
return client->Init();
}

bool JackMachClientChannel::Execute()
{
kern_return_t res;
if ((res = mach_msg_server(JackRPCClient_server, 1024, fClientPort.GetPort(), 0)) != KERN_SUCCESS) {
jack_error("JackMachClientChannel::Execute err = %s", mach_error_string(res));
JackClient* client = gClientTable[fClientPort.GetPort()];
client->ShutDown();
return false;
} else {
return true;
}
}

} // end of namespace



+ 0
- 99
macosx/JackMachClientChannel.h View File

@@ -1,99 +0,0 @@
/*
Copyright (C) 2004-2008 Grame

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

*/

#ifndef __JackMachClientChannel__
#define __JackMachClientChannel__

#include "JackChannel.h"
#include "JackMachPort.h"
#include "JackPlatformPlug.h"
#include <map>

namespace Jack
{

/*!
\brief JackClientChannel using Mach IPC.
*/

class JackMachClientChannel : public detail::JackClientChannelInterface, public JackRunnableInterface
{

private:

JackMachPort fClientPort; /*! Mach port to communicate with the server : from server to client */
JackMachPort fServerPort; /*! Mach port to communicate with the server : from client to server */
mach_port_t fPrivatePort;
JackThread fThread; /*! Thread to execute the event loop */

public:

JackMachClientChannel();
~JackMachClientChannel();

int Open(const char* server_name, const char* name, char* name_res, JackClient* client, jack_options_t options, jack_status_t* status);
void Close();

int Start();
void Stop();

int ServerCheck(const char* server_name);

void ClientCheck(const char* name, char* name_res, int protocol, int options, int* status, int* result);
void ClientOpen(const char* name, int pid, int* shared_engine, int* shared_client, int* shared_graph, int* result);
void ClientOpen(const char* name, int* ref, JackEngineControl** shared_engine, JackGraphManager** shared_manager, JackClientInterface* client, int* result)
{}
void ClientClose(int refnum, int* result);

void ClientActivate(int refnum, int is_real_time, int* result);
void ClientDeactivate(int refnum, int* result);

void PortRegister(int refnum, const char* name, const char* type, unsigned int flags, unsigned int buffer_size, jack_port_id_t* port_index, int* result);
void PortUnRegister(int refnum, jack_port_id_t port_index, int* result);

void PortConnect(int refnum, const char* src, const char* dst, int* result);
void PortDisconnect(int refnum, const char* src, const char* dst, int* result);

void PortConnect(int refnum, jack_port_id_t src, jack_port_id_t dst, int* result);
void PortDisconnect(int refnum, jack_port_id_t src, jack_port_id_t dst, int* result);
void PortRename(int refnum, jack_port_id_t port, const char* name, int* result);

void SetBufferSize(jack_nframes_t buffer_size, int* result);
void SetFreewheel(int onoff, int* result);

void ReleaseTimebase(int refnum, int* result);
void SetTimebaseCallback(int refnum, int conditional, int* result);

void GetInternalClientName(int refnum, int int_ref, char* name_res, int* result);
void InternalClientHandle(int refnum, const char* client_name, int* status, int* int_ref, int* result);
void InternalClientLoad(int refnum, const char* client_name, const char* so_name, const char* objet_data, int options, int* status, int* int_ref, int* result);
void InternalClientUnload(int refnum, int int_ref, int* status, int* result);

// JackRunnableInterface interface
bool Init();
bool Execute();
};

extern std::map<mach_port_t, JackClient*> gClientTable;

} // end of namespace

#endif


+ 0
- 67
macosx/JackMachNotifyChannel.cpp View File

@@ -1,67 +0,0 @@
/*
Copyright (C) 2004-2008 Grame

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

*/

#include "JackMachNotifyChannel.h"
#include "JackRPCClient.h"
#include "JackError.h"
#include "JackConstants.h"
#include <stdio.h>

namespace Jack
{

// Server side : server to client

int JackMachNotifyChannel::Open(const char* name)
{
jack_log("JackMachNotifyChannel::Open name = %s", name);

char buf[256];
snprintf(buf, sizeof(buf) - 1, "%s:%s", jack_client_entry, name);

// Connect to client notification port using client name
if (!fClientPort.ConnectPort(buf)) {
jack_error("Cannot connect client port");
return -1;
} else {
return 0;
}
}

void JackMachNotifyChannel::Close()
{
fClientPort.DisconnectPort();
}

void JackMachNotifyChannel::ClientNotify(int refnum, const char* name, int notify, int sync, const char* message, int value1, int value2, int* result)
{
kern_return_t res = (sync)
? rpc_jack_client_sync_notify(fClientPort.GetPort(), refnum, (char*)name, notify, (char*)message, value1, value2, result)
: rpc_jack_client_async_notify(fClientPort.GetPort(), refnum, (char*)name, notify, (char*)message, value1, value2);
if (res == KERN_SUCCESS) {
*result = 0;
} else {
jack_error("JackMachNotifyChannel::ClientNotify: name = %s notify = %ld err = %s", name, notify, mach_error_string(res));
*result = -1;
}
}

} // end of namespace



+ 0
- 53
macosx/JackMachNotifyChannel.h View File

@@ -1,53 +0,0 @@
/*
Copyright (C) 2004-2008 Grame

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

*/

#ifndef __JackMachNotifyChannel__
#define __JackMachNotifyChannel__

#include "JackMachPort.h"

namespace Jack
{

/*!
\brief JackNotifyChannel using Mach IPC.
*/

class JackMachNotifyChannel
{

private:

JackMachPort fClientPort; /*! Mach port to communicate with the client : from server to client */

public:

JackMachNotifyChannel()
{}

int Open(const char* name); // Open the Server/Client connection
void Close(); // Close the Server/Client connection

void ClientNotify(int refnum, const char* name, int notify, int sync, const char* message, int value1, int value2, int* result);
};

} // end of namespace

#endif


+ 0
- 295
macosx/JackMachPort.cpp View File

@@ -1,295 +0,0 @@
/*
Copyright (C) 2004-2008 Grame

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

*/

#include "JackMachPort.h"
#include "JackError.h"

namespace Jack
{

// Server side : port is published to be accessible from other processes (clients)

bool JackMachPort::AllocatePort(const char* name, int queue)
{
mach_port_t task = mach_task_self();
kern_return_t res;

if ((res = task_get_bootstrap_port(task, &fBootPort)) != KERN_SUCCESS) {
jack_error("AllocatePort: Can't find bootstrap mach port err = %s", mach_error_string(res));
return false;
}

if ((res = mach_port_allocate(task, MACH_PORT_RIGHT_RECEIVE, &fServerPort)) != KERN_SUCCESS) {
jack_error("AllocatePort: can't allocate mach port err = %s", mach_error_string(res));
return false;
}

if ((res = mach_port_insert_right(task, fServerPort, fServerPort, MACH_MSG_TYPE_MAKE_SEND)) != KERN_SUCCESS) {
jack_error("AllocatePort: error inserting mach rights err = %s", mach_error_string(res));
return false;
}

if ((res = bootstrap_register(fBootPort, (char*)name, fServerPort)) != KERN_SUCCESS) {
jack_error("Allocate: can't check in mach port name = %s err = %s", name, mach_error_string(res));
return false;
}

mach_port_limits_t qlimits;
mach_msg_type_number_t info_cnt = MACH_PORT_LIMITS_INFO_COUNT;
if ((res = mach_port_get_attributes(task, fServerPort, MACH_PORT_LIMITS_INFO, (mach_port_info_t) & qlimits, &info_cnt)) != KERN_SUCCESS) {
jack_error("Allocate: mach_port_get_attributes error err = %s", name, mach_error_string(res));
}

jack_log("AllocatePort: queue limit %ld", qlimits.mpl_qlimit);

if (queue > 0) {
qlimits.mpl_qlimit = queue;
if ((res = mach_port_set_attributes(task, fServerPort, MACH_PORT_LIMITS_INFO, (mach_port_info_t) & qlimits, MACH_PORT_LIMITS_INFO_COUNT)) != KERN_SUCCESS) {
jack_error("Allocate: mach_port_set_attributes error name = %s err = %s", name, mach_error_string(res));
}
}

return true;
}

// Server side : port is published to be accessible from other processes (clients)

bool JackMachPort::AllocatePort(const char* name)
{
return AllocatePort(name, -1);
}

// Client side : get the published port from server

bool JackMachPort::ConnectPort(const char* name)
{
kern_return_t res;

jack_log("JackMachPort::ConnectPort %s", name);

if ((res = task_get_bootstrap_port(mach_task_self(), &fBootPort)) != KERN_SUCCESS) {
jack_error("ConnectPort: can't find bootstrap port err = %s", mach_error_string(res));
return false;
}

if ((res = bootstrap_look_up(fBootPort, (char*)name, &fServerPort)) != KERN_SUCCESS) {
jack_error("ConnectPort: can't find mach server port name = %s err = %s", name, mach_error_string(res));
return false;
}

return true;
}

bool JackMachPort::DisconnectPort()
{
jack_log("JackMacRPC::DisconnectPort");
kern_return_t res;
mach_port_t task = mach_task_self();

if (fBootPort != 0) {
if ((res = mach_port_deallocate(task, fBootPort)) != KERN_SUCCESS) {
jack_error("JackMacRPC::DisconnectPort mach_port_deallocate fBootPort err = %s", mach_error_string(res));
}
}

if (fServerPort != 0) {
if ((res = mach_port_deallocate(task, fServerPort)) != KERN_SUCCESS) {
jack_error("JackMacRPC::DisconnectPort mach_port_deallocate fServerPort err = %s", mach_error_string(res));
}
}
return true;
}

bool JackMachPort::DestroyPort()
{
jack_log("JackMacRPC::DisconnectPort");
kern_return_t res;
mach_port_t task = mach_task_self();

if (fBootPort != 0) {
if ((res = mach_port_deallocate(task, fBootPort)) != KERN_SUCCESS) {
jack_error("JackMacRPC::DisconnectPort mach_port_deallocate fBootPort err = %s", mach_error_string(res));
}
}

if (fServerPort != 0) {
if ((res = mach_port_destroy(task, fServerPort)) != KERN_SUCCESS) {
jack_error("JackMacRPC::DisconnectPort mach_port_destroy fServerPort err = %s", mach_error_string(res));
}
}

return true;
}

mach_port_t JackMachPort::GetPort()
{
return fServerPort;
}

bool JackMachPortSet::AllocatePort(const char* name, int queue)
{
kern_return_t res;
mach_port_t task = mach_task_self();

jack_log("JackMachPortSet::AllocatePort");

if ((res = task_get_bootstrap_port(task, &fBootPort)) != KERN_SUCCESS) {
jack_error("AllocatePort: Can't find bootstrap mach port err = %s", mach_error_string(res));
return false;
}

if ((res = mach_port_allocate(task, MACH_PORT_RIGHT_RECEIVE, &fServerPort)) != KERN_SUCCESS) {
jack_error("AllocatePort: can't allocate mach port err = %s", mach_error_string(res));
return false;
}

if ((res = mach_port_insert_right(task, fServerPort, fServerPort, MACH_MSG_TYPE_MAKE_SEND)) != KERN_SUCCESS) {
jack_error("AllocatePort: error inserting mach rights err = %s", mach_error_string(res));
return false;
}

if ((res = mach_port_allocate(task, MACH_PORT_RIGHT_PORT_SET, &fPortSet)) != KERN_SUCCESS) {
jack_error("AllocatePort: can't allocate mach port err = %s", mach_error_string(res));
return false;
}

if ((res = mach_port_move_member(task, fServerPort, fPortSet)) != KERN_SUCCESS) {
jack_error("AllocatePort: error in mach_port_move_member err = %s", mach_error_string(res));
return false;
}

if ((res = bootstrap_register(fBootPort, (char*)name, fServerPort)) != KERN_SUCCESS) {
jack_error("Allocate: can't check in mach port name = %s err = %s", name, mach_error_string(res));
return false;
}

mach_port_limits_t qlimits;
mach_msg_type_number_t info_cnt = MACH_PORT_LIMITS_INFO_COUNT;
if ((res = mach_port_get_attributes(task, fServerPort, MACH_PORT_LIMITS_INFO, (mach_port_info_t) & qlimits, &info_cnt)) != KERN_SUCCESS) {
jack_error("Allocate: mach_port_get_attributes error name = %s err = %s", name, mach_error_string(res));
}

jack_log("AllocatePort: queue limit = %ld", qlimits.mpl_qlimit);

if (queue > 0) {
qlimits.mpl_qlimit = queue;

if ((res = mach_port_set_attributes(task, fServerPort, MACH_PORT_LIMITS_INFO, (mach_port_info_t) & qlimits, MACH_PORT_LIMITS_INFO_COUNT)) != KERN_SUCCESS) {
jack_error("Allocate: mach_port_set_attributes error name = %s err = %s", name, mach_error_string(res));
}
}

return true;
}

// Server side : port is published to be accessible from other processes (clients)

bool JackMachPortSet::AllocatePort(const char* name)
{
return AllocatePort(name, -1);
}

bool JackMachPortSet::DisconnectPort()
{
kern_return_t res;
mach_port_t task = mach_task_self();

jack_log("JackMachPortSet::DisconnectPort");

if (fBootPort != 0) {
if ((res = mach_port_deallocate(task, fBootPort)) != KERN_SUCCESS) {
jack_error("JackMachPortSet::DisconnectPort mach_port_deallocate fBootPort err = %s", mach_error_string(res));
}
}

if (fServerPort != 0) {
if ((res = mach_port_deallocate(task, fServerPort)) != KERN_SUCCESS) {
jack_error("JackMachPortSet::DisconnectPort mach_port_deallocate fServerPort err = %s", mach_error_string(res));
}
}

return true;
}

bool JackMachPortSet::DestroyPort()
{
kern_return_t res;
mach_port_t task = mach_task_self();

jack_log("JackMachPortSet::DisconnectPort");

if (fBootPort != 0) {
if ((res = mach_port_deallocate(task, fBootPort)) != KERN_SUCCESS) {
jack_error("JackMachPortSet::DisconnectPort mach_port_deallocate err = %s", mach_error_string(res));
}
}

if (fServerPort != 0) {
if ((res = mach_port_destroy(task, fServerPort)) != KERN_SUCCESS) {
jack_error("JackMachPortSet::DisconnectPort mach_port_destroy fServerPort err = %s", mach_error_string(res));
}
}

return true;
}

mach_port_t JackMachPortSet::GetPortSet()
{
return fPortSet;
}

mach_port_t JackMachPortSet::AddPort()
{
kern_return_t res;
mach_port_t task = mach_task_self();
mach_port_t old_port, result = 0;

jack_log("JackMachPortSet::AddPort");

if ((res = mach_port_allocate(task, MACH_PORT_RIGHT_RECEIVE, &result)) != KERN_SUCCESS) {
jack_error("AddPort: can't allocate mach port err = %s", mach_error_string(res));
goto error;
}

if ((res = mach_port_request_notification(task, result, MACH_NOTIFY_NO_SENDERS,
1, result, MACH_MSG_TYPE_MAKE_SEND_ONCE, &old_port)) != KERN_SUCCESS) {
jack_error("AddPort: error in mach_port_request_notification err = %s", mach_error_string(res));
goto error;
}

if ((res = mach_port_move_member(task, result, fPortSet)) != KERN_SUCCESS) {
jack_error("AddPort: error in mach_port_move_member err = %s", mach_error_string(res));
goto error;
}

return result;

error:
if (result) {
if ((res = mach_port_destroy(task, result)) != KERN_SUCCESS) {
jack_error("JackMacRPC::DisconnectPort mach_port_destroy err = %s", mach_error_string(res));
}
}
return 0;
}


} // end of namespace


+ 0
- 88
macosx/JackMachPort.h View File

@@ -1,88 +0,0 @@
/*
Copyright (C) 2004-2008 Grame

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

*/

#ifndef __JackMachPort__
#define __JackMachPort__

#include <mach/mach.h>
#include <mach/mach_types.h>
#include <mach/message.h>
#include <mach/mach_error.h>
#include <servers/bootstrap.h>

namespace Jack
{

/*!
\brief Mach port.
*/

class JackMachPort
{

protected:

mach_port_t fBootPort;
mach_port_t fServerPort;

public:

JackMachPort():fBootPort(0), fServerPort(0)
{}
virtual ~JackMachPort()
{}

virtual bool AllocatePort(const char* name);
virtual bool AllocatePort(const char* name, int queue);
virtual bool ConnectPort(const char* name);
virtual bool DisconnectPort();
virtual bool DestroyPort();
virtual mach_port_t GetPort();
};

/*!
\brief Mach port set.
*/

class JackMachPortSet : public JackMachPort
{

private:

mach_port_t fPortSet;

public:

JackMachPortSet():fPortSet(0)
{}
virtual ~JackMachPortSet()
{}

bool AllocatePort(const char* name);
bool AllocatePort(const char* name, int queue);
bool DisconnectPort();
bool DestroyPort();
mach_port_t GetPortSet();
mach_port_t AddPort();
};

} // end of namespace

#endif


+ 0
- 174
macosx/JackMachServerChannel.cpp View File

@@ -1,174 +0,0 @@
/*
Copyright (C) 2004-2008 Grame

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

*/

#include "JackTools.h"
#include "JackMachServerChannel.h"
#include "JackRPCEngineServer.c"
#include "JackError.h"
#include "JackServer.h"
#include "JackLockedEngine.h"
#include "JackNotification.h"
#include "JackServerGlobals.h"

using namespace std;

namespace Jack
{

map<mach_port_t, JackMachServerChannel*> JackMachServerChannel::fPortTable;

JackMachServerChannel::JackMachServerChannel():fThread(this)
{}

JackMachServerChannel::~JackMachServerChannel()
{}

int JackMachServerChannel::Open(const char* server_name, JackServer* server)
{
jack_log("JackMachServerChannel::Open");
char jack_server_entry_name[512];
snprintf(jack_server_entry_name, sizeof(jack_server_entry_name), "%s.%d_%s", jack_server_entry, JackTools::GetUID(), server_name);

if (!fServerPort.AllocatePort(jack_server_entry_name, 16)) { // 16 is the max possible value
jack_error("Cannot check in Jack server");
return -1;
}

fServer = server;
fPortTable[fServerPort.GetPort()] = this;
return 0;
}

void JackMachServerChannel::Close()
{
jack_log("JackMachServerChannel::Close");
#ifdef MAC_OS_X_VERSION_10_5
// Exception does not work in this case on pre Snow Loopard systems, see JackMachServerNotifyChannel::NotifyQuit()
fThread.Kill();
#else
fThread.Stop();
#endif
fServerPort.DestroyPort();
}
int JackMachServerChannel::Start()
{
if (fThread.Start() != 0) {
jack_error("Cannot start Jack server listener");
return -1;
}
return 0;
}

JackLockedEngine* JackMachServerChannel::GetEngine()
{
return fServer->GetEngine();
}

JackServer* JackMachServerChannel::GetServer()
{
return fServer;
}

void JackMachServerChannel::ClientCheck(char* name, char* name_res, int protocol, int options, int* status, int* result)
{
*result = GetEngine()->ClientCheck(name, name_res, protocol, options, status);
}

void JackMachServerChannel::ClientOpen(char* name, int pid, mach_port_t* private_port, int* shared_engine, int* shared_client, int* shared_graph, int* result)
{
int refnum = -1;
*result = GetEngine()->ClientExternalOpen(name, pid, &refnum, shared_engine, shared_client, shared_graph);

if (*result == 0) {
mach_port_t port = fServerPort.AddPort();
if (port != 0) {
fClientTable[port] = refnum;
fPortTable[port] = this;
*private_port = port;
} else {
jack_error("Cannot create private client mach port");
*result = -1;
}
} else {
jack_error("Cannot create new client");
}
}

void JackMachServerChannel::ClientClose(mach_port_t private_port, int refnum)
{
GetEngine()->ClientExternalClose(refnum);
fClientTable.erase(private_port);

// Hum, hum....
kern_return_t res;
if ((res = mach_port_destroy(mach_task_self(), private_port)) != KERN_SUCCESS) {
jack_error("server_rpc_jack_client_close mach_port_destroy %s", mach_error_string(res));
}
}

void JackMachServerChannel::ClientKill(mach_port_t private_port)
{
jack_log("JackMachServerChannel::ClientKill");
int refnum = fClientTable[private_port];
assert(refnum > 0);
fServer->ClientKill(refnum);
fClientTable.erase(private_port);

// Hum, hum....
kern_return_t res;
if ((res = mach_port_destroy(mach_task_self(), private_port)) != KERN_SUCCESS) {
jack_error("server_rpc_jack_client_close mach_port_destroy %s", mach_error_string(res));
}
}

boolean_t JackMachServerChannel::MessageHandler(mach_msg_header_t* Request, mach_msg_header_t* Reply)
{
if (Request->msgh_id == MACH_NOTIFY_NO_SENDERS) {
jack_log("MACH_NOTIFY_NO_SENDERS %ld", Request->msgh_local_port);
JackMachServerChannel* channel = JackMachServerChannel::fPortTable[Request->msgh_local_port];
assert(channel);
channel->ClientKill(Request->msgh_local_port);
} else {
JackRPCEngine_server(Request, Reply);
}
return true;
}

bool JackMachServerChannel::Execute()
{
try {
kern_return_t res;
if ((res = mach_msg_server(MessageHandler, 1024, fServerPort.GetPortSet(), 0)) != KERN_SUCCESS) {
jack_log("JackMachServerChannel::Execute: err = %s", mach_error_string(res));
// A recoverable error, so keep running...
}
return true;
} catch (JackQuitException& e) {
jack_log("JackMachServerChannel::Execute JackQuitException");
return false;
}
}

} // end of namespace



+ 0
- 76
macosx/JackMachServerChannel.h View File

@@ -1,76 +0,0 @@
/*
Copyright (C) 2004-2008 Grame

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

*/

#ifndef __JackMachServerChannel__
#define __JackMachServerChannel__

#include "JackPlatformPlug.h"
#include "JackMachPort.h"
#include <map>

namespace Jack
{

class JackServer;
class JackLockedEngine;

/*!
\brief JackServerChannel using Mach IPC.
*/

class JackMachServerChannel : public JackRunnableInterface
{

private:

JackMachPortSet fServerPort; /*! Mach port to communicate with the server : from client to server */
JackThread fThread; /*! Thread to execute the event loop */
JackServer* fServer;
std::map<mach_port_t, int> fClientTable;

static boolean_t MessageHandler(mach_msg_header_t* Request, mach_msg_header_t* Reply);

public:

JackMachServerChannel();
~JackMachServerChannel();

int Open(const char* server_name, JackServer* server); // Open the Server/Client connection
void Close(); // Close the Server/Client connection
int Start();
JackLockedEngine* GetEngine();
JackServer* GetServer();

void ClientCheck(char* name, char* name_res, int protocol, int options, int* status, int* result);
void ClientOpen(char* name, int pid, mach_port_t* private_port, int* shared_engine, int* shared_client, int* shared_graph, int* result);
void ClientClose(mach_port_t private_port, int refnum);
void ClientKill(mach_port_t private_port);

bool Execute();

// Has to be public..
static std::map<mach_port_t, JackMachServerChannel*> fPortTable;
};

} // end of namespace

#endif


+ 0
- 70
macosx/JackMachServerNotifyChannel.cpp View File

@@ -1,70 +0,0 @@
/*
Copyright (C) 2004-2008 Grame

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

*/

#include "JackMachServerNotifyChannel.h"
#include "JackRPCEngineUser.c"
#include "JackNotification.h"
#include "JackTools.h"
#include "JackConstants.h"
#include "JackError.h"
#include <stdio.h>

namespace Jack
{

int JackMachServerNotifyChannel::Open(const char* server_name)
{
jack_log("JackMachServerChannel::Open");
char jack_server_entry_name[512];
snprintf(jack_server_entry_name, sizeof(jack_server_entry_name), "%s.%d_%s", jack_server_entry, JackTools::GetUID(), server_name);

if (!fClientPort.ConnectPort(jack_server_entry_name)) {
jack_error("Cannot connect to server port");
return -1;
} else {
return 0;
}
}

void JackMachServerNotifyChannel::Close()
{}

void JackMachServerNotifyChannel::Notify(int refnum, int notify, int value)
{
kern_return_t res = rpc_jack_client_rt_notify(fClientPort.GetPort(), refnum, notify, value, 0);
if (res != KERN_SUCCESS) {
jack_error("Could not write request ref = %d notify = %d err = %s", refnum, notify, mach_error_string(res));
}
}
void JackMachServerNotifyChannel::NotifyQuit()
{
#ifdef MAC_OS_X_VERSION_10_5
// Nothing : since exception does not work in this case on pre Snow Loopard systems, see JackMachServerChannel::Close()
#else
kern_return_t res = rpc_jack_client_rt_notify(fClientPort.GetPort(), -1, kQUIT, 0, 0);
if (res != KERN_SUCCESS) {
jack_error("Could not write request ref = %d notify = %d err = %s", -1, kQUIT, mach_error_string(res));
}
#endif
}

} // end of namespace



+ 0
- 55
macosx/JackMachServerNotifyChannel.h View File

@@ -1,55 +0,0 @@
/*
Copyright (C) 2004-2008 Grame

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

*/

#ifndef __JackMachServerNotifyChannel__
#define __JackMachServerNotifyChannel__

#include "JackChannel.h"
#include "JackMachPort.h"

namespace Jack
{

/*!
\brief JackServerNotifyChannel using Mach IPC.
*/

class JackMachServerNotifyChannel
{

private:

JackMachPort fClientPort; /*! Mach port to communicate with the server : from client to server */

public:

JackMachServerNotifyChannel()
{}

int Open(const char* server_name); // Open the Server/Client connection
void Close(); // Close the Server/Client connection

void Notify(int refnum, int notify, int value);
void NotifyQuit();
};

} // end of namespace

#endif


+ 20
- 13
macosx/JackPlatformPlug_os.h View File

@@ -26,14 +26,18 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

namespace Jack
{
struct JackRequest;
struct JackResult;
class JackPosixMutex;
class JackMachThread;
class JackMachSemaphore;

class JackMachServerChannel;
class JackMachClientChannel;
class JackMachServerNotifyChannel;
class JackMachNotifyChannel;
class JackSocketServerChannel;
class JackSocketClientChannel;
class JackSocketServerNotifyChannel;
class JackSocketNotifyChannel;
class JackNetUnixSocket;
}

@@ -49,25 +53,28 @@ namespace Jack { typedef JackMachThread JackThread; }
#include "JackMachSemaphore.h"
namespace Jack { typedef JackMachSemaphore JackSynchro; }

#include "JackSocket.h"
namespace Jack { typedef JackClientSocket JackChannelTransaction; }

/* __JackPlatformProcessSync__ */
#include "JackProcessSync.h"
/* Only on windows a special JackProcessSync is used. It is directly defined by including JackProcessSync.h here */

/* __JackPlatformServerChannel__ */
#include "JackMachServerChannel.h"
namespace Jack { typedef JackMachServerChannel JackServerChannel; }
#include "JackSocketServerChannel.h"
namespace Jack { typedef JackSocketServerChannel JackServerChannel; }

/* __JackPlatformClientChannel__ */
#include "JackMachClientChannel.h"
namespace Jack { typedef JackMachClientChannel JackClientChannel; }
#include "JackSocketClientChannel.h"
namespace Jack { typedef JackSocketClientChannel JackClientChannel; }

/* __JackPlatformServerNotifyChannel__ */
#include "JackMachServerNotifyChannel.h"
namespace Jack { typedef JackMachServerNotifyChannel JackServerNotifyChannel; }
#include "JackSocketServerNotifyChannel.h"
namespace Jack { typedef JackSocketServerNotifyChannel JackServerNotifyChannel; }

/* __JackPlatformNotifyChannel__ */
#include "JackMachNotifyChannel.h"
namespace Jack { typedef JackMachNotifyChannel JackNotifyChannel; }
#include "JackSocketNotifyChannel.h"
namespace Jack { typedef JackSocketNotifyChannel JackNotifyChannel; }

/* __JackPlatformNetSocket__ */
#include "JackNetUnixSocket.h"


+ 24
- 148
macosx/Jackdmp.xcodeproj/project.pbxproj View File

@@ -132,7 +132,6 @@
4B32258010A3195A00838A8E /* netjack_packet.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B3224ED10A315C400838A8E /* netjack_packet.h */; };
4B32258110A3195B00838A8E /* netsource.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B32256310A318E300838A8E /* netsource.c */; };
4B35C41E0D4731D1000DE7AE /* Jackdmp.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF8D2250834F06A00C94B91 /* Jackdmp.cpp */; };
4B35C4290D4731D1000DE7AE /* JackMachPort.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B799AD707899652003F3F15 /* JackMachPort.h */; };
4B35C42A0D4731D1000DE7AE /* JackError.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF8D1770834EE4800C94B91 /* JackError.h */; };
4B35C42B0D4731D1000DE7AE /* JackTime.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF8D1830834EE5800C94B91 /* JackTime.h */; };
4B35C42C0D4731D1000DE7AE /* JackShmMem.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF8D1870834EE7900C94B91 /* JackShmMem.h */; };
@@ -153,7 +152,6 @@
4B35C43D0D4731D1000DE7AE /* JackMachSemaphore.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF6C1D608ACE64C001E2013 /* JackMachSemaphore.h */; };
4B35C43E0D4731D1000DE7AE /* JackGlobals.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BFB73F608AD291A00DB99B8 /* JackGlobals.h */; };
4B35C43F0D4731D1000DE7AE /* JackMachThread.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BFB741F08AD2B9900DB99B8 /* JackMachThread.h */; };
4B35C4400D4731D1000DE7AE /* JackMachClientChannel.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BFB298708AF450200D450D4 /* JackMachClientChannel.h */; };
4B35C4460D4731D1000DE7AE /* JackSynchro.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BD561C708EEB910006BBC2A /* JackSynchro.h */; };
4B35C4470D4731D1000DE7AE /* JackDebugClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B98AE010931D30C0091932A /* JackDebugClient.h */; };
4B35C4480D4731D1000DE7AE /* JackConstants.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B66A8580934964500A89560 /* JackConstants.h */; };
@@ -170,9 +168,6 @@
4B35C4530D4731D1000DE7AE /* JackMidiPort.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B80D7E50BA0D17400F035BB /* JackMidiPort.h */; };
4B35C4540D4731D1000DE7AE /* midiport.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B6B9EF50CD0958B0051EE5A /* midiport.h */; settings = {ATTRIBUTES = (Public, ); }; };
4B35C4550D4731D1000DE7AE /* JackTools.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BE4CC000CDA153400CCF5BB /* JackTools.h */; };
4B35C4580D4731D1000DE7AE /* JackMacLibClientRPC.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF3937C0626BF3600CC67FA /* JackMacLibClientRPC.cpp */; };
4B35C4590D4731D1000DE7AE /* JackRPCEngineUser.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B89B769076B74D200D170DE /* JackRPCEngineUser.c */; };
4B35C45A0D4731D1000DE7AE /* JackMachPort.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B799AD607899652003F3F15 /* JackMachPort.cpp */; };
4B35C45B0D4731D1000DE7AE /* JackShmMem.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF8D1880834EE7900C94B91 /* JackShmMem.cpp */; };
4B35C45C0D4731D1000DE7AE /* shm.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BF8D1900834EE8400C94B91 /* shm.c */; };
4B35C45E0D4731D1000DE7AE /* JackActivationCount.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF8D1A80834EEB400C94B91 /* JackActivationCount.cpp */; };
@@ -186,7 +181,6 @@
4B35C4660D4731D1000DE7AE /* JackFrameTimer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF8FB0D08AC88EF00D1A344 /* JackFrameTimer.cpp */; };
4B35C4680D4731D1000DE7AE /* JackMachSemaphore.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF6C1D508ACE64C001E2013 /* JackMachSemaphore.cpp */; };
4B35C4690D4731D1000DE7AE /* JackMachThread.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BFB741E08AD2B9900DB99B8 /* JackMachThread.cpp */; };
4B35C46A0D4731D1000DE7AE /* JackMachClientChannel.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BFB29AE08AF45FD00D450D4 /* JackMachClientChannel.cpp */; };
4B35C4700D4731D1000DE7AE /* JackGlobals.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B2C28F908DAD01E00249230 /* JackGlobals.cpp */; };
4B35C4720D4731D1000DE7AE /* ringbuffer.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B003AB008E2B2BA0060EFDC /* ringbuffer.c */; };
4B35C4730D4731D1000DE7AE /* JackDebugClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B98AE000931D30C0091932A /* JackDebugClient.cpp */; };
@@ -198,7 +192,6 @@
4B35C47A0D4731D1000DE7AE /* JackMidiAPI.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B80D7E70BA0D17400F035BB /* JackMidiAPI.cpp */; };
4B35C47B0D4731D1000DE7AE /* JackEngineControl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B6F7AEC0CD0CDBD00F48A9D /* JackEngineControl.cpp */; };
4B35C47C0D4731D1000DE7AE /* JackTools.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BE4CBFF0CDA153400CCF5BB /* JackTools.cpp */; };
4B35C4870D4731D1000DE7AE /* JackMachPort.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B799AD707899652003F3F15 /* JackMachPort.h */; };
4B35C4880D4731D1000DE7AE /* JackError.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF8D1770834EE4800C94B91 /* JackError.h */; };
4B35C4890D4731D1000DE7AE /* JackTime.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF8D1830834EE5800C94B91 /* JackTime.h */; };
4B35C48A0D4731D1000DE7AE /* JackShmMem.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF8D1870834EE7900C94B91 /* JackShmMem.h */; };
@@ -227,9 +220,6 @@
4B35C4A90D4731D1000DE7AE /* JackEngine.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF8D2130834F02800C94B91 /* JackEngine.h */; };
4B35C4AA0D4731D1000DE7AE /* JackExternalClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF8D1F70834EFBD00C94B91 /* JackExternalClient.h */; };
4B35C4AB0D4731D1000DE7AE /* JackServer.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF8D2220834F05C00C94B91 /* JackServer.h */; };
4B35C4AE0D4731D1000DE7AE /* JackMachNotifyChannel.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BFB298908AF450200D450D4 /* JackMachNotifyChannel.h */; };
4B35C4AF0D4731D1000DE7AE /* JackMachServerChannel.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BFB297808AF44ED00D450D4 /* JackMachServerChannel.h */; };
4B35C4B00D4731D1000DE7AE /* JackMachServerNotifyChannel.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BFB297A08AF44ED00D450D4 /* JackMachServerNotifyChannel.h */; };
4B35C4B20D4731D1000DE7AE /* JackConstants.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B66A8580934964500A89560 /* JackConstants.h */; };
4B35C4B30D4731D1000DE7AE /* JackTransportEngine.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BD4B4D409BACD9600750C0F /* JackTransportEngine.h */; };
4B35C4B40D4731D1000DE7AE /* JackServerGlobals.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BC2168D0A444BED00BDA09F /* JackServerGlobals.h */; };
@@ -246,7 +236,6 @@
4B35C4BF0D4731D1000DE7AE /* midiport.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B6B9EF50CD0958B0051EE5A /* midiport.h */; settings = {ATTRIBUTES = (Public, ); }; };
4B35C4C00D4731D1000DE7AE /* JackDebugClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B98AE010931D30C0091932A /* JackDebugClient.h */; };
4B35C4C10D4731D1000DE7AE /* JackTools.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BE4CC000CDA153400CCF5BB /* JackTools.h */; };
4B35C4C40D4731D1000DE7AE /* JackMachPort.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B799AD607899652003F3F15 /* JackMachPort.cpp */; };
4B35C4C50D4731D1000DE7AE /* JackShmMem.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF8D1880834EE7900C94B91 /* JackShmMem.cpp */; };
4B35C4C60D4731D1000DE7AE /* shm.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BF8D1900834EE8400C94B91 /* shm.c */; };
4B35C4C80D4731D1000DE7AE /* JackActivationCount.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF8D1A80834EEB400C94B91 /* JackActivationCount.cpp */; };
@@ -268,12 +257,7 @@
4B35C4DD0D4731D1000DE7AE /* JackEngine.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF8D2140834F02800C94B91 /* JackEngine.cpp */; };
4B35C4DE0D4731D1000DE7AE /* JackExternalClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF8D1F80834EFBD00C94B91 /* JackExternalClient.cpp */; };
4B35C4DF0D4731D1000DE7AE /* JackInternalClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF8D1ED0834EF9200C94B91 /* JackInternalClient.cpp */; };
4B35C4E00D4731D1000DE7AE /* JackRPCClientUser.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B89B759076B731100D170DE /* JackRPCClientUser.c */; };
4B35C4E20D4731D1000DE7AE /* JackServer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF8D2210834F05C00C94B91 /* JackServer.cpp */; };
4B35C4E60D4731D1000DE7AE /* JackMacEngineRPC.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B4259E5076B635E00C1ECE1 /* JackMacEngineRPC.cpp */; };
4B35C4E70D4731D1000DE7AE /* JackMachNotifyChannel.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BFB298808AF450200D450D4 /* JackMachNotifyChannel.cpp */; };
4B35C4E80D4731D1000DE7AE /* JackMachServerChannel.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BFB297908AF44ED00D450D4 /* JackMachServerChannel.cpp */; };
4B35C4E90D4731D1000DE7AE /* JackMachServerNotifyChannel.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BFB297708AF44ED00D450D4 /* JackMachServerNotifyChannel.cpp */; };
4B35C4EB0D4731D1000DE7AE /* JackTransportEngine.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BD4B4D509BACD9600750C0F /* JackTransportEngine.cpp */; };
4B35C4EC0D4731D1000DE7AE /* JackServerAPI.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF8D1F50834EFB000C94B91 /* JackServerAPI.cpp */; };
4B35C4ED0D4731D1000DE7AE /* JackServerGlobals.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BC216880A444BDE00BDA09F /* JackServerGlobals.cpp */; };
@@ -322,7 +306,6 @@
4B43A8CB1014605000E52943 /* JackLoopbackDriver.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B43A8C91014605000E52943 /* JackLoopbackDriver.h */; };
4B43A8DF1014615800E52943 /* JackLoopbackDriver.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B43A8C91014605000E52943 /* JackLoopbackDriver.h */; };
4B43A8E11014615800E52943 /* JackLoopbackDriver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B43A8C81014605000E52943 /* JackLoopbackDriver.cpp */; };
4B47AC8210B5890100469C67 /* JackMachPort.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B799AD707899652003F3F15 /* JackMachPort.h */; };
4B47AC8310B5890100469C67 /* JackError.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF8D1770834EE4800C94B91 /* JackError.h */; };
4B47AC8410B5890100469C67 /* JackTime.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF8D1830834EE5800C94B91 /* JackTime.h */; };
4B47AC8510B5890100469C67 /* JackShmMem.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF8D1870834EE7900C94B91 /* JackShmMem.h */; };
@@ -343,7 +326,6 @@
4B47AC9410B5890100469C67 /* JackMachSemaphore.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF6C1D608ACE64C001E2013 /* JackMachSemaphore.h */; };
4B47AC9510B5890100469C67 /* JackGlobals.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BFB73F608AD291A00DB99B8 /* JackGlobals.h */; };
4B47AC9610B5890100469C67 /* JackMachThread.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BFB741F08AD2B9900DB99B8 /* JackMachThread.h */; };
4B47AC9710B5890100469C67 /* JackMachClientChannel.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BFB298708AF450200D450D4 /* JackMachClientChannel.h */; };
4B47AC9810B5890100469C67 /* JackSynchro.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BD561C708EEB910006BBC2A /* JackSynchro.h */; };
4B47AC9910B5890100469C67 /* JackDebugClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B98AE010931D30C0091932A /* JackDebugClient.h */; };
4B47AC9A10B5890100469C67 /* JackConstants.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B66A8580934964500A89560 /* JackConstants.h */; };
@@ -364,9 +346,6 @@
4B47ACA910B5890100469C67 /* JackMessageBuffer.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B4F9C8B0DC20C0400706CB0 /* JackMessageBuffer.h */; };
4B47ACAA10B5890100469C67 /* JackPosixThread.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BC3B6A30E703B2E0066E42F /* JackPosixThread.h */; };
4B47ACAB10B5890100469C67 /* JackProcessSync.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BECB2F40F4451C10091B70A /* JackProcessSync.h */; };
4B47ACAE10B5890100469C67 /* JackMacLibClientRPC.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF3937C0626BF3600CC67FA /* JackMacLibClientRPC.cpp */; };
4B47ACAF10B5890100469C67 /* JackRPCEngineUser.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B89B769076B74D200D170DE /* JackRPCEngineUser.c */; };
4B47ACB010B5890100469C67 /* JackMachPort.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B799AD607899652003F3F15 /* JackMachPort.cpp */; };
4B47ACB110B5890100469C67 /* JackShmMem.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF8D1880834EE7900C94B91 /* JackShmMem.cpp */; };
4B47ACB210B5890100469C67 /* shm.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BF8D1900834EE8400C94B91 /* shm.c */; };
4B47ACB310B5890100469C67 /* JackActivationCount.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF8D1A80834EEB400C94B91 /* JackActivationCount.cpp */; };
@@ -380,7 +359,6 @@
4B47ACBB10B5890100469C67 /* JackFrameTimer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF8FB0D08AC88EF00D1A344 /* JackFrameTimer.cpp */; };
4B47ACBC10B5890100469C67 /* JackMachSemaphore.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF6C1D508ACE64C001E2013 /* JackMachSemaphore.cpp */; };
4B47ACBD10B5890100469C67 /* JackMachThread.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BFB741E08AD2B9900DB99B8 /* JackMachThread.cpp */; };
4B47ACBE10B5890100469C67 /* JackMachClientChannel.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BFB29AE08AF45FD00D450D4 /* JackMachClientChannel.cpp */; };
4B47ACBF10B5890100469C67 /* JackGlobals.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B2C28F908DAD01E00249230 /* JackGlobals.cpp */; };
4B47ACC010B5890100469C67 /* ringbuffer.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B003AB008E2B2BA0060EFDC /* ringbuffer.c */; };
4B47ACC110B5890100469C67 /* JackDebugClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B98AE000931D30C0091932A /* JackDebugClient.cpp */; };
@@ -434,7 +412,6 @@
4B60CE490AAABA31004956AA /* connect.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B60CE480AAABA31004956AA /* connect.c */; };
4B60CE4A0AAABA31004956AA /* connect.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B60CE480AAABA31004956AA /* connect.c */; };
4B699BAA097D421600A18468 /* Jackdmp.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF8D2250834F06A00C94B91 /* Jackdmp.cpp */; };
4B699C02097D421600A18468 /* JackMachPort.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B799AD707899652003F3F15 /* JackMachPort.h */; };
4B699C03097D421600A18468 /* JackError.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF8D1770834EE4800C94B91 /* JackError.h */; };
4B699C04097D421600A18468 /* JackTime.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF8D1830834EE5800C94B91 /* JackTime.h */; };
4B699C05097D421600A18468 /* JackShmMem.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF8D1870834EE7900C94B91 /* JackShmMem.h */; };
@@ -455,13 +432,9 @@
4B699C16097D421600A18468 /* JackMachSemaphore.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF6C1D608ACE64C001E2013 /* JackMachSemaphore.h */; };
4B699C17097D421600A18468 /* JackGlobals.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BFB73F608AD291A00DB99B8 /* JackGlobals.h */; };
4B699C18097D421600A18468 /* JackMachThread.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BFB741F08AD2B9900DB99B8 /* JackMachThread.h */; };
4B699C19097D421600A18468 /* JackMachClientChannel.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BFB298708AF450200D450D4 /* JackMachClientChannel.h */; };
4B699C20097D421600A18468 /* JackSynchro.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BD561C708EEB910006BBC2A /* JackSynchro.h */; };
4B699C21097D421600A18468 /* JackDebugClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B98AE010931D30C0091932A /* JackDebugClient.h */; };
4B699C22097D421600A18468 /* JackConstants.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B66A8580934964500A89560 /* JackConstants.h */; };
4B699C25097D421600A18468 /* JackMacLibClientRPC.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF3937C0626BF3600CC67FA /* JackMacLibClientRPC.cpp */; };
4B699C26097D421600A18468 /* JackRPCEngineUser.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B89B769076B74D200D170DE /* JackRPCEngineUser.c */; };
4B699C27097D421600A18468 /* JackMachPort.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B799AD607899652003F3F15 /* JackMachPort.cpp */; };
4B699C28097D421600A18468 /* JackShmMem.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF8D1880834EE7900C94B91 /* JackShmMem.cpp */; };
4B699C29097D421600A18468 /* shm.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BF8D1900834EE8400C94B91 /* shm.c */; };
4B699C2B097D421600A18468 /* JackActivationCount.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF8D1A80834EEB400C94B91 /* JackActivationCount.cpp */; };
@@ -475,11 +448,9 @@
4B699C33097D421600A18468 /* JackFrameTimer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF8FB0D08AC88EF00D1A344 /* JackFrameTimer.cpp */; };
4B699C35097D421600A18468 /* JackMachSemaphore.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF6C1D508ACE64C001E2013 /* JackMachSemaphore.cpp */; };
4B699C36097D421600A18468 /* JackMachThread.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BFB741E08AD2B9900DB99B8 /* JackMachThread.cpp */; };
4B699C37097D421600A18468 /* JackMachClientChannel.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BFB29AE08AF45FD00D450D4 /* JackMachClientChannel.cpp */; };
4B699C3D097D421600A18468 /* JackGlobals.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B2C28F908DAD01E00249230 /* JackGlobals.cpp */; };
4B699C3F097D421600A18468 /* ringbuffer.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B003AB008E2B2BA0060EFDC /* ringbuffer.c */; };
4B699C40097D421600A18468 /* JackDebugClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B98AE000931D30C0091932A /* JackDebugClient.cpp */; };
4B699C4E097D421600A18468 /* JackMachPort.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B799AD707899652003F3F15 /* JackMachPort.h */; };
4B699C4F097D421600A18468 /* JackError.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF8D1770834EE4800C94B91 /* JackError.h */; };
4B699C50097D421600A18468 /* JackTime.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF8D1830834EE5800C94B91 /* JackTime.h */; };
4B699C51097D421600A18468 /* JackShmMem.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF8D1870834EE7900C94B91 /* JackShmMem.h */; };
@@ -508,11 +479,7 @@
4B699C71097D421600A18468 /* JackEngine.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF8D2130834F02800C94B91 /* JackEngine.h */; };
4B699C73097D421600A18468 /* JackExternalClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF8D1F70834EFBD00C94B91 /* JackExternalClient.h */; };
4B699C74097D421600A18468 /* JackServer.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF8D2220834F05C00C94B91 /* JackServer.h */; };
4B699C77097D421600A18468 /* JackMachNotifyChannel.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BFB298908AF450200D450D4 /* JackMachNotifyChannel.h */; };
4B699C78097D421600A18468 /* JackMachServerChannel.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BFB297808AF44ED00D450D4 /* JackMachServerChannel.h */; };
4B699C79097D421600A18468 /* JackMachServerNotifyChannel.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BFB297A08AF44ED00D450D4 /* JackMachServerNotifyChannel.h */; };
4B699C7B097D421600A18468 /* JackConstants.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B66A8580934964500A89560 /* JackConstants.h */; };
4B699C7E097D421600A18468 /* JackMachPort.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B799AD607899652003F3F15 /* JackMachPort.cpp */; };
4B699C7F097D421600A18468 /* JackShmMem.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF8D1880834EE7900C94B91 /* JackShmMem.cpp */; };
4B699C80097D421600A18468 /* shm.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BF8D1900834EE8400C94B91 /* shm.c */; };
4B699C82097D421600A18468 /* JackActivationCount.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF8D1A80834EEB400C94B91 /* JackActivationCount.cpp */; };
@@ -534,12 +501,7 @@
4B699C97097D421600A18468 /* JackEngine.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF8D2140834F02800C94B91 /* JackEngine.cpp */; };
4B699C99097D421600A18468 /* JackExternalClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF8D1F80834EFBD00C94B91 /* JackExternalClient.cpp */; };
4B699C9A097D421600A18468 /* JackInternalClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF8D1ED0834EF9200C94B91 /* JackInternalClient.cpp */; };
4B699C9B097D421600A18468 /* JackRPCClientUser.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B89B759076B731100D170DE /* JackRPCClientUser.c */; };
4B699C9D097D421600A18468 /* JackServer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF8D2210834F05C00C94B91 /* JackServer.cpp */; };
4B699CA1097D421600A18468 /* JackMacEngineRPC.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B4259E5076B635E00C1ECE1 /* JackMacEngineRPC.cpp */; };
4B699CA2097D421600A18468 /* JackMachNotifyChannel.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BFB298808AF450200D450D4 /* JackMachNotifyChannel.cpp */; };
4B699CA3097D421600A18468 /* JackMachServerChannel.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BFB297908AF44ED00D450D4 /* JackMachServerChannel.cpp */; };
4B699CA4097D421600A18468 /* JackMachServerNotifyChannel.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BFB297708AF44ED00D450D4 /* JackMachServerNotifyChannel.cpp */; };
4B699CB4097D421600A18468 /* metro.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BF8D16B0834EDF000C94B91 /* metro.c */; };
4B699CC4097D421600A18468 /* lsp.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BF8D1690834EDE600C94B91 /* lsp.c */; };
4B699CF6097D421600A18468 /* freewheel.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BF8D1710834EE0F00C94B91 /* freewheel.c */; };
@@ -584,6 +546,18 @@
4B88D04411298BEE007A87C1 /* weakmacros.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B88D03A11298BEE007A87C1 /* weakmacros.h */; settings = {ATTRIBUTES = (Public, ); }; };
4B88D04511298BEE007A87C1 /* weakjack.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B88D03911298BEE007A87C1 /* weakjack.h */; settings = {ATTRIBUTES = (Public, ); }; };
4B88D04611298BEE007A87C1 /* weakmacros.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B88D03A11298BEE007A87C1 /* weakmacros.h */; settings = {ATTRIBUTES = (Public, ); }; };
4B8A38A7117B80D300664E07 /* JackSocket.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BC3B6AD0E703B8D0066E42F /* JackSocket.cpp */; };
4B8A38A8117B80DA00664E07 /* JackSocket.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BC3B6AE0E703B8D0066E42F /* JackSocket.h */; };
4B8A38AD117B810A00664E07 /* JackSocketNotifyChannel.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BC3B6B20E703B8D0066E42F /* JackSocketNotifyChannel.h */; };
4B8A38AE117B811100664E07 /* JackSocketNotifyChannel.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BC3B6B10E703B8D0066E42F /* JackSocketNotifyChannel.cpp */; };
4B8A38B0117B812500664E07 /* JackSocketServerChannel.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BC3B6B40E703B8D0066E42F /* JackSocketServerChannel.h */; };
4B8A38B1117B812D00664E07 /* JackSocketServerChannel.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BC3B6B30E703B8D0066E42F /* JackSocketServerChannel.cpp */; };
4B8A38B2117B813400664E07 /* JackSocketServerNotifyChannel.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BC3B6B50E703B8D0066E42F /* JackSocketServerNotifyChannel.cpp */; };
4B8A38C4117B814000664E07 /* JackSocketServerNotifyChannel.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BC3B6B60E703B8D0066E42F /* JackSocketServerNotifyChannel.h */; };
4B8A38F0117B827900664E07 /* JackSocket.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BC3B6AE0E703B8D0066E42F /* JackSocket.h */; };
4B8A38F1117B827E00664E07 /* JackSocketClientChannel.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BC3B6AF0E703B8D0066E42F /* JackSocketClientChannel.cpp */; };
4B8A38F6117B82AB00664E07 /* JackSocket.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BC3B6AD0E703B8D0066E42F /* JackSocket.cpp */; };
4B8A38F7117B82B200664E07 /* JackSocketClientChannel.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BC3B6B00E703B8D0066E42F /* JackSocketClientChannel.h */; };
4B93F1990E87992100E4ECCD /* JackPosixThread.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BC3B6A20E703B2E0066E42F /* JackPosixThread.cpp */; };
4B93F19A0E87992200E4ECCD /* JackPosixThread.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BC3B6A30E703B2E0066E42F /* JackPosixThread.h */; };
4B93F19C0E87998200E4ECCD /* JackPosixServerLaunch.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF5FBBA0E878B9C003D2374 /* JackPosixServerLaunch.cpp */; };
@@ -604,7 +578,6 @@
4B9A26610DBF8ADD006E9FBC /* JackError.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B9A25B30DBF8330006E9FBC /* JackError.cpp */; };
4B9A26640DBF8B14006E9FBC /* JackError.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B9A25B30DBF8330006E9FBC /* JackError.cpp */; };
4B9A26790DBF8B88006E9FBC /* JackError.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B9A25B30DBF8330006E9FBC /* JackError.cpp */; };
4BA3393510B2E36800190E3B /* JackMachPort.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B799AD707899652003F3F15 /* JackMachPort.h */; };
4BA3393610B2E36800190E3B /* JackError.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF8D1770834EE4800C94B91 /* JackError.h */; };
4BA3393710B2E36800190E3B /* JackTime.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF8D1830834EE5800C94B91 /* JackTime.h */; };
4BA3393810B2E36800190E3B /* JackShmMem.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF8D1870834EE7900C94B91 /* JackShmMem.h */; };
@@ -633,9 +606,6 @@
4BA3394F10B2E36800190E3B /* JackEngine.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF8D2130834F02800C94B91 /* JackEngine.h */; };
4BA3395010B2E36800190E3B /* JackExternalClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF8D1F70834EFBD00C94B91 /* JackExternalClient.h */; };
4BA3395110B2E36800190E3B /* JackServer.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF8D2220834F05C00C94B91 /* JackServer.h */; };
4BA3395210B2E36800190E3B /* JackMachNotifyChannel.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BFB298908AF450200D450D4 /* JackMachNotifyChannel.h */; };
4BA3395310B2E36800190E3B /* JackMachServerChannel.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BFB297808AF44ED00D450D4 /* JackMachServerChannel.h */; };
4BA3395410B2E36800190E3B /* JackMachServerNotifyChannel.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BFB297A08AF44ED00D450D4 /* JackMachServerNotifyChannel.h */; };
4BA3395510B2E36800190E3B /* JackConstants.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B66A8580934964500A89560 /* JackConstants.h */; };
4BA3395610B2E36800190E3B /* JackTransportEngine.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BD4B4D409BACD9600750C0F /* JackTransportEngine.h */; };
4BA3395710B2E36800190E3B /* JackServerGlobals.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BC2168D0A444BED00BDA09F /* JackServerGlobals.h */; };
@@ -663,7 +633,6 @@
4BA3396D10B2E36800190E3B /* JackMidiDriver.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF339200F8B873E0080FB5B /* JackMidiDriver.h */; };
4BA3396E10B2E36800190E3B /* JackWaitThreadedDriver.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BBC93B90DF9736C002DF220 /* JackWaitThreadedDriver.h */; };
4BA3396F10B2E36800190E3B /* JackArgParser.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF284170F31B4BC00B05BE3 /* JackArgParser.h */; };
4BA3397210B2E36800190E3B /* JackMachPort.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B799AD607899652003F3F15 /* JackMachPort.cpp */; };
4BA3397310B2E36800190E3B /* JackShmMem.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF8D1880834EE7900C94B91 /* JackShmMem.cpp */; };
4BA3397410B2E36800190E3B /* shm.c in Sources */ = {isa = PBXBuildFile; fileRef = 4BF8D1900834EE8400C94B91 /* shm.c */; };
4BA3397510B2E36800190E3B /* JackActivationCount.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF8D1A80834EEB400C94B91 /* JackActivationCount.cpp */; };
@@ -685,12 +654,7 @@
4BA3398510B2E36800190E3B /* JackEngine.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF8D2140834F02800C94B91 /* JackEngine.cpp */; };
4BA3398610B2E36800190E3B /* JackExternalClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF8D1F80834EFBD00C94B91 /* JackExternalClient.cpp */; };
4BA3398710B2E36800190E3B /* JackInternalClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF8D1ED0834EF9200C94B91 /* JackInternalClient.cpp */; };
4BA3398810B2E36800190E3B /* JackRPCClientUser.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B89B759076B731100D170DE /* JackRPCClientUser.c */; };
4BA3398910B2E36800190E3B /* JackServer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF8D2210834F05C00C94B91 /* JackServer.cpp */; };
4BA3398A10B2E36800190E3B /* JackMacEngineRPC.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B4259E5076B635E00C1ECE1 /* JackMacEngineRPC.cpp */; };
4BA3398B10B2E36800190E3B /* JackMachNotifyChannel.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BFB298808AF450200D450D4 /* JackMachNotifyChannel.cpp */; };
4BA3398C10B2E36800190E3B /* JackMachServerChannel.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BFB297908AF44ED00D450D4 /* JackMachServerChannel.cpp */; };
4BA3398D10B2E36800190E3B /* JackMachServerNotifyChannel.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BFB297708AF44ED00D450D4 /* JackMachServerNotifyChannel.cpp */; };
4BA3398E10B2E36800190E3B /* JackTransportEngine.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BD4B4D509BACD9600750C0F /* JackTransportEngine.cpp */; };
4BA3398F10B2E36800190E3B /* JackServerAPI.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BF8D1F50834EFB000C94B91 /* JackServerAPI.cpp */; };
4BA3399010B2E36800190E3B /* JackServerGlobals.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BC216880A444BDE00BDA09F /* JackServerGlobals.cpp */; };
@@ -1497,7 +1461,6 @@
4B37C20406DF1FBE0016E567 /* CALatencyLog.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = CALatencyLog.h; path = /Developer/Examples/CoreAudio/PublicUtility/CALatencyLog.h; sourceTree = "<absolute>"; };
4B37C20906DF1FE20016E567 /* latency.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = latency.c; path = /Developer/Examples/CoreAudio/PublicUtility/latency.c; sourceTree = "<absolute>"; };
4B3F49070AD8503300491C6E /* cpu.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = cpu.c; path = ../tests/cpu.c; sourceTree = SOURCE_ROOT; };
4B4259E5076B635E00C1ECE1 /* JackMacEngineRPC.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JackMacEngineRPC.cpp; sourceTree = SOURCE_ROOT; };
4B43A8BA10145F6F00E52943 /* jack_loopback.so */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = jack_loopback.so; sourceTree = BUILT_PRODUCTS_DIR; };
4B43A8C81014605000E52943 /* JackLoopbackDriver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JackLoopbackDriver.cpp; path = ../common/JackLoopbackDriver.cpp; sourceTree = SOURCE_ROOT; };
4B43A8C91014605000E52943 /* JackLoopbackDriver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JackLoopbackDriver.h; path = ../common/JackLoopbackDriver.h; sourceTree = SOURCE_ROOT; };
@@ -1549,8 +1512,6 @@
4B6F7AEC0CD0CDBD00F48A9D /* JackEngineControl.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = JackEngineControl.cpp; path = ../common/JackEngineControl.cpp; sourceTree = SOURCE_ROOT; };
4B76C7680E5AB2DB00E2AC21 /* JackNetInterface.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JackNetInterface.cpp; path = ../common/JackNetInterface.cpp; sourceTree = SOURCE_ROOT; };
4B76C7690E5AB2DB00E2AC21 /* JackNetInterface.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JackNetInterface.h; path = ../common/JackNetInterface.h; sourceTree = SOURCE_ROOT; };
4B799AD607899652003F3F15 /* JackMachPort.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JackMachPort.cpp; sourceTree = "<group>"; };
4B799AD707899652003F3F15 /* JackMachPort.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = JackMachPort.h; sourceTree = "<group>"; };
4B80D7E50BA0D17400F035BB /* JackMidiPort.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = JackMidiPort.h; path = ../common/JackMidiPort.h; sourceTree = SOURCE_ROOT; };
4B80D7E60BA0D17400F035BB /* JackMidiPort.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = JackMidiPort.cpp; path = ../common/JackMidiPort.cpp; sourceTree = SOURCE_ROOT; };
4B80D7E70BA0D17400F035BB /* JackMidiAPI.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = JackMidiAPI.cpp; path = ../common/JackMidiAPI.cpp; sourceTree = SOURCE_ROOT; };
@@ -1559,8 +1520,6 @@
4B869D7F08C9CB00001CF041 /* JackDriverLoader.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = JackDriverLoader.cpp; path = ../common/JackDriverLoader.cpp; sourceTree = SOURCE_ROOT; };
4B88D03911298BEE007A87C1 /* weakjack.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = weakjack.h; path = ../common/jack/weakjack.h; sourceTree = SOURCE_ROOT; };
4B88D03A11298BEE007A87C1 /* weakmacros.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = weakmacros.h; path = ../common/jack/weakmacros.h; sourceTree = SOURCE_ROOT; };
4B89B759076B731100D170DE /* JackRPCClientUser.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = JackRPCClientUser.c; path = RPC/JackRPCClientUser.c; sourceTree = SOURCE_ROOT; };
4B89B769076B74D200D170DE /* JackRPCEngineUser.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = JackRPCEngineUser.c; path = RPC/JackRPCEngineUser.c; sourceTree = SOURCE_ROOT; };
4B940B9B06DDDE5B00D77F60 /* AudioHardware.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = AudioHardware.h; path = /System/Library/Frameworks/CoreAudio.framework/Versions/A/Headers/AudioHardware.h; sourceTree = "<absolute>"; };
4B94334910A5E666002A187F /* systemdeps.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = systemdeps.h; path = ../common/jack/systemdeps.h; sourceTree = SOURCE_ROOT; };
4B95BCAD0D913073000F7695 /* control.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = control.h; path = ../common/jack/control.h; sourceTree = SOURCE_ROOT; };
@@ -1645,7 +1604,6 @@
4BF339150F8B86DC0080FB5B /* JackCoreMidiDriver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JackCoreMidiDriver.cpp; path = coremidi/JackCoreMidiDriver.cpp; sourceTree = SOURCE_ROOT; };
4BF3391F0F8B873E0080FB5B /* JackMidiDriver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JackMidiDriver.cpp; path = ../common/JackMidiDriver.cpp; sourceTree = SOURCE_ROOT; };
4BF339200F8B873E0080FB5B /* JackMidiDriver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JackMidiDriver.h; path = ../common/JackMidiDriver.h; sourceTree = SOURCE_ROOT; };
4BF3937C0626BF3600CC67FA /* JackMacLibClientRPC.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JackMacLibClientRPC.cpp; sourceTree = SOURCE_ROOT; };
4BF4BAB00E3480AB00403CDF /* JackAudioAdapterFactory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JackAudioAdapterFactory.cpp; path = ../common/JackAudioAdapterFactory.cpp; sourceTree = SOURCE_ROOT; };
4BF520520CB8D0E80037470E /* timestamps.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = timestamps.c; path = ../common/timestamps.c; sourceTree = SOURCE_ROOT; };
4BF520580CB8D1010037470E /* timestamps.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = timestamps.h; path = ../common/timestamps.h; sourceTree = SOURCE_ROOT; };
@@ -1718,14 +1676,6 @@
4BFA82CF0DF6A9E40087B4E1 /* jack_impulse_grabber */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = jack_impulse_grabber; sourceTree = BUILT_PRODUCTS_DIR; };
4BFA99A20AAAF3B0009E916C /* jdelay */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = jdelay; sourceTree = BUILT_PRODUCTS_DIR; };
4BFA99A90AAAF40C009E916C /* jdelay.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = jdelay.cpp; path = ../tests/jdelay.cpp; sourceTree = SOURCE_ROOT; };
4BFB297708AF44ED00D450D4 /* JackMachServerNotifyChannel.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JackMachServerNotifyChannel.cpp; sourceTree = "<group>"; };
4BFB297808AF44ED00D450D4 /* JackMachServerChannel.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = JackMachServerChannel.h; sourceTree = "<group>"; };
4BFB297908AF44ED00D450D4 /* JackMachServerChannel.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JackMachServerChannel.cpp; sourceTree = "<group>"; };
4BFB297A08AF44ED00D450D4 /* JackMachServerNotifyChannel.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = JackMachServerNotifyChannel.h; sourceTree = "<group>"; };
4BFB298708AF450200D450D4 /* JackMachClientChannel.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = JackMachClientChannel.h; sourceTree = "<group>"; };
4BFB298808AF450200D450D4 /* JackMachNotifyChannel.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JackMachNotifyChannel.cpp; sourceTree = "<group>"; };
4BFB298908AF450200D450D4 /* JackMachNotifyChannel.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = JackMachNotifyChannel.h; sourceTree = "<group>"; };
4BFB29AE08AF45FD00D450D4 /* JackMachClientChannel.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JackMachClientChannel.cpp; sourceTree = SOURCE_ROOT; };
4BFB73F608AD291A00DB99B8 /* JackGlobals.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = JackGlobals.h; path = ../common/JackGlobals.h; sourceTree = SOURCE_ROOT; };
4BFB741E08AD2B9900DB99B8 /* JackMachThread.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JackMachThread.cpp; sourceTree = SOURCE_ROOT; };
4BFB741F08AD2B9900DB99B8 /* JackMachThread.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = JackMachThread.h; sourceTree = SOURCE_ROOT; };
@@ -2627,24 +2577,6 @@
name = Additional;
sourceTree = "<group>";
};
4B168CA3076A5319005B2802 /* MIG_RPC */ = {
isa = PBXGroup;
children = (
4B89B759076B731100D170DE /* JackRPCClientUser.c */,
4B4259E5076B635E00C1ECE1 /* JackMacEngineRPC.cpp */,
);
name = MIG_RPC;
sourceTree = "<group>";
};
4B168CA4076A5333005B2802 /* MIG_RPC */ = {
isa = PBXGroup;
children = (
4B89B769076B74D200D170DE /* JackRPCEngineUser.c */,
4BF3937C0626BF3600CC67FA /* JackMacLibClientRPC.cpp */,
);
name = MIG_RPC;
sourceTree = "<group>";
};
4B19B3010E23629800DD4A82 /* Adapter */ = {
isa = PBXGroup;
children = (
@@ -2818,7 +2750,6 @@
4BA550F905E241D900569492 /* Library */ = {
isa = PBXGroup;
children = (
4B168CA4076A5333005B2802 /* MIG_RPC */,
4BF8D1FB0834EFD100C94B91 /* JackLibGlobals.h */,
4BF8D1FC0834EFD100C94B91 /* JackLibClient.h */,
4BF8D1FD0834EFD100C94B91 /* JackLibClient.cpp */,
@@ -2844,7 +2775,6 @@
4BA550FB05E2420000569492 /* Engine */ = {
isa = PBXGroup;
children = (
4B168CA3076A5319005B2802 /* MIG_RPC */,
4B5F253D0DEE9B8F0041E486 /* JackLockedEngine.h */,
4BF8D2130834F02800C94B91 /* JackEngine.h */,
4BF8D2140834F02800C94B91 /* JackEngine.cpp */,
@@ -2872,7 +2802,6 @@
4BB371D40C1AD85A0050C1E4 /* JackNotification.h */,
4BF8D1B30834EED500C94B91 /* JackInternalClientChannel.h */,
4BFB299908AF452300D450D4 /* Socket */,
4BFB299808AF451200D450D4 /* Mach */,
);
name = Channels;
sourceTree = "<group>";
@@ -2963,23 +2892,6 @@
name = MIDI;
sourceTree = "<group>";
};
4BFB299808AF451200D450D4 /* Mach */ = {
isa = PBXGroup;
children = (
4B799AD707899652003F3F15 /* JackMachPort.h */,
4B799AD607899652003F3F15 /* JackMachPort.cpp */,
4BFB298708AF450200D450D4 /* JackMachClientChannel.h */,
4BFB29AE08AF45FD00D450D4 /* JackMachClientChannel.cpp */,
4BFB297808AF44ED00D450D4 /* JackMachServerChannel.h */,
4BFB297908AF44ED00D450D4 /* JackMachServerChannel.cpp */,
4BFB297A08AF44ED00D450D4 /* JackMachServerNotifyChannel.h */,
4BFB297708AF44ED00D450D4 /* JackMachServerNotifyChannel.cpp */,
4BFB298908AF450200D450D4 /* JackMachNotifyChannel.h */,
4BFB298808AF450200D450D4 /* JackMachNotifyChannel.cpp */,
);
name = Mach;
sourceTree = "<group>";
};
4BFB299908AF452300D450D4 /* Socket */ = {
isa = PBXGroup;
children = (
@@ -3110,7 +3022,6 @@
isa = PBXHeadersBuildPhase;
buildActionMask = 2147483647;
files = (
4B35C4290D4731D1000DE7AE /* JackMachPort.h in Headers */,
4B35C42A0D4731D1000DE7AE /* JackError.h in Headers */,
4B35C42B0D4731D1000DE7AE /* JackTime.h in Headers */,
4B35C42C0D4731D1000DE7AE /* JackShmMem.h in Headers */,
@@ -3131,7 +3042,6 @@
4B35C43D0D4731D1000DE7AE /* JackMachSemaphore.h in Headers */,
4B35C43E0D4731D1000DE7AE /* JackGlobals.h in Headers */,
4B35C43F0D4731D1000DE7AE /* JackMachThread.h in Headers */,
4B35C4400D4731D1000DE7AE /* JackMachClientChannel.h in Headers */,
4B35C4460D4731D1000DE7AE /* JackSynchro.h in Headers */,
4B35C4470D4731D1000DE7AE /* JackDebugClient.h in Headers */,
4B35C4480D4731D1000DE7AE /* JackConstants.h in Headers */,
@@ -3154,6 +3064,8 @@
4BECB2FA0F4451C10091B70A /* JackProcessSync.h in Headers */,
4B88D03F11298BEE007A87C1 /* weakjack.h in Headers */,
4B88D04011298BEE007A87C1 /* weakmacros.h in Headers */,
4B8A38F0117B827900664E07 /* JackSocket.h in Headers */,
4B8A38F7117B82B200664E07 /* JackSocketClientChannel.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -3161,7 +3073,6 @@
isa = PBXHeadersBuildPhase;
buildActionMask = 2147483647;
files = (
4B35C4870D4731D1000DE7AE /* JackMachPort.h in Headers */,
4B35C4880D4731D1000DE7AE /* JackError.h in Headers */,
4B35C4890D4731D1000DE7AE /* JackTime.h in Headers */,
4B35C48A0D4731D1000DE7AE /* JackShmMem.h in Headers */,
@@ -3190,9 +3101,6 @@
4B35C4A90D4731D1000DE7AE /* JackEngine.h in Headers */,
4B35C4AA0D4731D1000DE7AE /* JackExternalClient.h in Headers */,
4B35C4AB0D4731D1000DE7AE /* JackServer.h in Headers */,
4B35C4AE0D4731D1000DE7AE /* JackMachNotifyChannel.h in Headers */,
4B35C4AF0D4731D1000DE7AE /* JackMachServerChannel.h in Headers */,
4B35C4B00D4731D1000DE7AE /* JackMachServerNotifyChannel.h in Headers */,
4B35C4B20D4731D1000DE7AE /* JackConstants.h in Headers */,
4B35C4B30D4731D1000DE7AE /* JackTransportEngine.h in Headers */,
4B35C4B40D4731D1000DE7AE /* JackServerGlobals.h in Headers */,
@@ -3226,6 +3134,10 @@
4B88D04411298BEE007A87C1 /* weakmacros.h in Headers */,
4BC2CA5A113C6CB80076717C /* JackNetInterface.h in Headers */,
4BC2CA5C113C6CC00076717C /* JackNetUnixSocket.h in Headers */,
4B8A38A8117B80DA00664E07 /* JackSocket.h in Headers */,
4B8A38AD117B810A00664E07 /* JackSocketNotifyChannel.h in Headers */,
4B8A38B0117B812500664E07 /* JackSocketServerChannel.h in Headers */,
4B8A38C4117B814000664E07 /* JackSocketServerNotifyChannel.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -3464,7 +3376,6 @@
isa = PBXHeadersBuildPhase;
buildActionMask = 2147483647;
files = (
4B47AC8210B5890100469C67 /* JackMachPort.h in Headers */,
4B47AC8310B5890100469C67 /* JackError.h in Headers */,
4B47AC8410B5890100469C67 /* JackTime.h in Headers */,
4B47AC8510B5890100469C67 /* JackShmMem.h in Headers */,
@@ -3485,7 +3396,6 @@
4B47AC9410B5890100469C67 /* JackMachSemaphore.h in Headers */,
4B47AC9510B5890100469C67 /* JackGlobals.h in Headers */,
4B47AC9610B5890100469C67 /* JackMachThread.h in Headers */,
4B47AC9710B5890100469C67 /* JackMachClientChannel.h in Headers */,
4B47AC9810B5890100469C67 /* JackSynchro.h in Headers */,
4B47AC9910B5890100469C67 /* JackDebugClient.h in Headers */,
4B47AC9A10B5890100469C67 /* JackConstants.h in Headers */,
@@ -3547,7 +3457,6 @@
isa = PBXHeadersBuildPhase;
buildActionMask = 2147483647;
files = (
4B699C02097D421600A18468 /* JackMachPort.h in Headers */,
4B699C03097D421600A18468 /* JackError.h in Headers */,
4B699C04097D421600A18468 /* JackTime.h in Headers */,
4B699C05097D421600A18468 /* JackShmMem.h in Headers */,
@@ -3568,7 +3477,6 @@
4B699C16097D421600A18468 /* JackMachSemaphore.h in Headers */,
4B699C17097D421600A18468 /* JackGlobals.h in Headers */,
4B699C18097D421600A18468 /* JackMachThread.h in Headers */,
4B699C19097D421600A18468 /* JackMachClientChannel.h in Headers */,
4B699C20097D421600A18468 /* JackSynchro.h in Headers */,
4B699C21097D421600A18468 /* JackDebugClient.h in Headers */,
4B699C22097D421600A18468 /* JackConstants.h in Headers */,
@@ -3599,7 +3507,6 @@
isa = PBXHeadersBuildPhase;
buildActionMask = 2147483647;
files = (
4B699C4E097D421600A18468 /* JackMachPort.h in Headers */,
4B699C4F097D421600A18468 /* JackError.h in Headers */,
4B699C50097D421600A18468 /* JackTime.h in Headers */,
4B699C51097D421600A18468 /* JackShmMem.h in Headers */,
@@ -3628,9 +3535,6 @@
4B699C71097D421600A18468 /* JackEngine.h in Headers */,
4B699C73097D421600A18468 /* JackExternalClient.h in Headers */,
4B699C74097D421600A18468 /* JackServer.h in Headers */,
4B699C77097D421600A18468 /* JackMachNotifyChannel.h in Headers */,
4B699C78097D421600A18468 /* JackMachServerChannel.h in Headers */,
4B699C79097D421600A18468 /* JackMachServerNotifyChannel.h in Headers */,
4B699C7B097D421600A18468 /* JackConstants.h in Headers */,
4BD4B4D809BACD9600750C0F /* JackTransportEngine.h in Headers */,
4BC2168E0A444BED00BDA09F /* JackServerGlobals.h in Headers */,
@@ -3784,7 +3688,6 @@
isa = PBXHeadersBuildPhase;
buildActionMask = 2147483647;
files = (
4BA3393510B2E36800190E3B /* JackMachPort.h in Headers */,
4BA3393610B2E36800190E3B /* JackError.h in Headers */,
4BA3393710B2E36800190E3B /* JackTime.h in Headers */,
4BA3393810B2E36800190E3B /* JackShmMem.h in Headers */,
@@ -3813,9 +3716,6 @@
4BA3394F10B2E36800190E3B /* JackEngine.h in Headers */,
4BA3395010B2E36800190E3B /* JackExternalClient.h in Headers */,
4BA3395110B2E36800190E3B /* JackServer.h in Headers */,
4BA3395210B2E36800190E3B /* JackMachNotifyChannel.h in Headers */,
4BA3395310B2E36800190E3B /* JackMachServerChannel.h in Headers */,
4BA3395410B2E36800190E3B /* JackMachServerNotifyChannel.h in Headers */,
4BA3395510B2E36800190E3B /* JackConstants.h in Headers */,
4BA3395610B2E36800190E3B /* JackTransportEngine.h in Headers */,
4BA3395710B2E36800190E3B /* JackServerGlobals.h in Headers */,
@@ -6332,9 +6232,6 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
4B35C4580D4731D1000DE7AE /* JackMacLibClientRPC.cpp in Sources */,
4B35C4590D4731D1000DE7AE /* JackRPCEngineUser.c in Sources */,
4B35C45A0D4731D1000DE7AE /* JackMachPort.cpp in Sources */,
4B35C45B0D4731D1000DE7AE /* JackShmMem.cpp in Sources */,
4B35C45C0D4731D1000DE7AE /* shm.c in Sources */,
4B35C45E0D4731D1000DE7AE /* JackActivationCount.cpp in Sources */,
@@ -6348,7 +6245,6 @@
4B35C4660D4731D1000DE7AE /* JackFrameTimer.cpp in Sources */,
4B35C4680D4731D1000DE7AE /* JackMachSemaphore.cpp in Sources */,
4B35C4690D4731D1000DE7AE /* JackMachThread.cpp in Sources */,
4B35C46A0D4731D1000DE7AE /* JackMachClientChannel.cpp in Sources */,
4B35C4700D4731D1000DE7AE /* JackGlobals.cpp in Sources */,
4B35C4720D4731D1000DE7AE /* ringbuffer.c in Sources */,
4B35C4730D4731D1000DE7AE /* JackDebugClient.cpp in Sources */,
@@ -6366,6 +6262,8 @@
4B93F19D0E87998400E4ECCD /* JackPosixThread.cpp in Sources */,
4B93F1C00E87A35400E4ECCD /* JackMachTime.c in Sources */,
4BECB2F90F4451C10091B70A /* JackProcessSync.cpp in Sources */,
4B8A38F1117B827E00664E07 /* JackSocketClientChannel.cpp in Sources */,
4B8A38F6117B82AB00664E07 /* JackSocket.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -6373,7 +6271,6 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
4B35C4C40D4731D1000DE7AE /* JackMachPort.cpp in Sources */,
4B35C4C50D4731D1000DE7AE /* JackShmMem.cpp in Sources */,
4B35C4C60D4731D1000DE7AE /* shm.c in Sources */,
4B35C4C80D4731D1000DE7AE /* JackActivationCount.cpp in Sources */,
@@ -6395,12 +6292,7 @@
4B35C4DD0D4731D1000DE7AE /* JackEngine.cpp in Sources */,
4B35C4DE0D4731D1000DE7AE /* JackExternalClient.cpp in Sources */,
4B35C4DF0D4731D1000DE7AE /* JackInternalClient.cpp in Sources */,
4B35C4E00D4731D1000DE7AE /* JackRPCClientUser.c in Sources */,
4B35C4E20D4731D1000DE7AE /* JackServer.cpp in Sources */,
4B35C4E60D4731D1000DE7AE /* JackMacEngineRPC.cpp in Sources */,
4B35C4E70D4731D1000DE7AE /* JackMachNotifyChannel.cpp in Sources */,
4B35C4E80D4731D1000DE7AE /* JackMachServerChannel.cpp in Sources */,
4B35C4E90D4731D1000DE7AE /* JackMachServerNotifyChannel.cpp in Sources */,
4B35C4EB0D4731D1000DE7AE /* JackTransportEngine.cpp in Sources */,
4B35C4EC0D4731D1000DE7AE /* JackServerAPI.cpp in Sources */,
4B35C4ED0D4731D1000DE7AE /* JackServerGlobals.cpp in Sources */,
@@ -6428,6 +6320,10 @@
4BCBCE6310C4FE3F00450FFE /* JackPhysicalMidiOutput.cpp in Sources */,
4BC2CA59113C6CB60076717C /* JackNetInterface.cpp in Sources */,
4BC2CA5B113C6CBE0076717C /* JackNetUnixSocket.cpp in Sources */,
4B8A38A7117B80D300664E07 /* JackSocket.cpp in Sources */,
4B8A38AE117B811100664E07 /* JackSocketNotifyChannel.cpp in Sources */,
4B8A38B1117B812D00664E07 /* JackSocketServerChannel.cpp in Sources */,
4B8A38B2117B813400664E07 /* JackSocketServerNotifyChannel.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -6693,9 +6589,6 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
4B47ACAE10B5890100469C67 /* JackMacLibClientRPC.cpp in Sources */,
4B47ACAF10B5890100469C67 /* JackRPCEngineUser.c in Sources */,
4B47ACB010B5890100469C67 /* JackMachPort.cpp in Sources */,
4B47ACB110B5890100469C67 /* JackShmMem.cpp in Sources */,
4B47ACB210B5890100469C67 /* shm.c in Sources */,
4B47ACB310B5890100469C67 /* JackActivationCount.cpp in Sources */,
@@ -6709,7 +6602,6 @@
4B47ACBB10B5890100469C67 /* JackFrameTimer.cpp in Sources */,
4B47ACBC10B5890100469C67 /* JackMachSemaphore.cpp in Sources */,
4B47ACBD10B5890100469C67 /* JackMachThread.cpp in Sources */,
4B47ACBE10B5890100469C67 /* JackMachClientChannel.cpp in Sources */,
4B47ACBF10B5890100469C67 /* JackGlobals.cpp in Sources */,
4B47ACC010B5890100469C67 /* ringbuffer.c in Sources */,
4B47ACC110B5890100469C67 /* JackDebugClient.cpp in Sources */,
@@ -6770,9 +6662,6 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
4B699C25097D421600A18468 /* JackMacLibClientRPC.cpp in Sources */,
4B699C26097D421600A18468 /* JackRPCEngineUser.c in Sources */,
4B699C27097D421600A18468 /* JackMachPort.cpp in Sources */,
4B699C28097D421600A18468 /* JackShmMem.cpp in Sources */,
4B699C29097D421600A18468 /* shm.c in Sources */,
4B699C2B097D421600A18468 /* JackActivationCount.cpp in Sources */,
@@ -6786,7 +6675,6 @@
4B699C33097D421600A18468 /* JackFrameTimer.cpp in Sources */,
4B699C35097D421600A18468 /* JackMachSemaphore.cpp in Sources */,
4B699C36097D421600A18468 /* JackMachThread.cpp in Sources */,
4B699C37097D421600A18468 /* JackMachClientChannel.cpp in Sources */,
4B699C3D097D421600A18468 /* JackGlobals.cpp in Sources */,
4B699C3F097D421600A18468 /* ringbuffer.c in Sources */,
4B699C40097D421600A18468 /* JackDebugClient.cpp in Sources */,
@@ -6811,7 +6699,6 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
4B699C7E097D421600A18468 /* JackMachPort.cpp in Sources */,
4B699C7F097D421600A18468 /* JackShmMem.cpp in Sources */,
4B699C80097D421600A18468 /* shm.c in Sources */,
4B699C82097D421600A18468 /* JackActivationCount.cpp in Sources */,
@@ -6833,12 +6720,7 @@
4B699C97097D421600A18468 /* JackEngine.cpp in Sources */,
4B699C99097D421600A18468 /* JackExternalClient.cpp in Sources */,
4B699C9A097D421600A18468 /* JackInternalClient.cpp in Sources */,
4B699C9B097D421600A18468 /* JackRPCClientUser.c in Sources */,
4B699C9D097D421600A18468 /* JackServer.cpp in Sources */,
4B699CA1097D421600A18468 /* JackMacEngineRPC.cpp in Sources */,
4B699CA2097D421600A18468 /* JackMachNotifyChannel.cpp in Sources */,
4B699CA3097D421600A18468 /* JackMachServerChannel.cpp in Sources */,
4B699CA4097D421600A18468 /* JackMachServerNotifyChannel.cpp in Sources */,
4BD4B4D909BACD9600750C0F /* JackTransportEngine.cpp in Sources */,
4BC216850A444BAD00BDA09F /* JackServerAPI.cpp in Sources */,
4BC216890A444BDE00BDA09F /* JackServerGlobals.cpp in Sources */,
@@ -6993,7 +6875,6 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
4BA3397210B2E36800190E3B /* JackMachPort.cpp in Sources */,
4BA3397310B2E36800190E3B /* JackShmMem.cpp in Sources */,
4BA3397410B2E36800190E3B /* shm.c in Sources */,
4BA3397510B2E36800190E3B /* JackActivationCount.cpp in Sources */,
@@ -7015,12 +6896,7 @@
4BA3398510B2E36800190E3B /* JackEngine.cpp in Sources */,
4BA3398610B2E36800190E3B /* JackExternalClient.cpp in Sources */,
4BA3398710B2E36800190E3B /* JackInternalClient.cpp in Sources */,
4BA3398810B2E36800190E3B /* JackRPCClientUser.c in Sources */,
4BA3398910B2E36800190E3B /* JackServer.cpp in Sources */,
4BA3398A10B2E36800190E3B /* JackMacEngineRPC.cpp in Sources */,
4BA3398B10B2E36800190E3B /* JackMachNotifyChannel.cpp in Sources */,
4BA3398C10B2E36800190E3B /* JackMachServerChannel.cpp in Sources */,
4BA3398D10B2E36800190E3B /* JackMachServerNotifyChannel.cpp in Sources */,
4BA3398E10B2E36800190E3B /* JackTransportEngine.cpp in Sources */,
4BA3398F10B2E36800190E3B /* JackServerAPI.cpp in Sources */,
4BA3399010B2E36800190E3B /* JackServerGlobals.cpp in Sources */,


+ 0
- 47
macosx/RPC/JackRPCClient.defs View File

@@ -1,47 +0,0 @@
/*
Copyright (C) 2004 Grame
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

*/

subsystem JackRPCClient 1000;

#include <mach/std_types.defs>
#include <mach/mach_types.defs>
import "Jackdefs.h";
waittime 5000;

type client_name_t = c_string[64];
type message_t = c_string[256];

routine rpc_jack_client_sync_notify(
client_port : mach_port_t;
refnum : int;
client_name : client_name_t;
notify : int;
message : message_t;
value1 : int;
value2 : int;
out result : int);

simpleroutine rpc_jack_client_async_notify(
client_port : mach_port_t;
refnum : int;
client_name : client_name_t;
notify : int;
message : message_t;
value1 : int;
value2 : int);

+ 0
- 194
macosx/RPC/JackRPCClient.h View File

@@ -1,194 +0,0 @@
#ifndef _JackRPCClient_user_
#define _JackRPCClient_user_

/* Module JackRPCClient */

#include <string.h>
#include <mach/ndr.h>
#include <mach/boolean.h>
#include <mach/kern_return.h>
#include <mach/notify.h>
#include <mach/mach_types.h>
#include <mach/message.h>
#include <mach/mig_errors.h>
#include <mach/port.h>

#ifdef AUTOTEST
#ifndef FUNCTION_PTR_T
#define FUNCTION_PTR_T
typedef void (*function_ptr_t)(mach_port_t, char *, mach_msg_type_number_t);
typedef struct {
char *name;
function_ptr_t function;
} function_table_entry;
typedef function_table_entry *function_table_t;
#endif /* FUNCTION_PTR_T */
#endif /* AUTOTEST */

#ifndef JackRPCClient_MSG_COUNT
#define JackRPCClient_MSG_COUNT 2
#endif /* JackRPCClient_MSG_COUNT */

#include <mach/std_types.h>
#include <mach/mig.h>
#include <mach/mig.h>
#include <mach/mach_types.h>
#include "Jackdefs.h"

#ifdef __BeforeMigUserHeader
__BeforeMigUserHeader
#endif /* __BeforeMigUserHeader */

#include <sys/cdefs.h>
__BEGIN_DECLS


/* Routine rpc_jack_client_sync_notify */
#ifdef mig_external
mig_external
#else
extern
#endif /* mig_external */
kern_return_t rpc_jack_client_sync_notify
(
mach_port_t client_port,
int refnum,
client_name_t client_name,
int notify,
message_t message,
int value1,
int value2,
int *result
);

/* SimpleRoutine rpc_jack_client_async_notify */
#ifdef mig_external
mig_external
#else
extern
#endif /* mig_external */
kern_return_t rpc_jack_client_async_notify
(
mach_port_t client_port,
int refnum,
client_name_t client_name,
int notify,
message_t message,
int value1,
int value2
);

__END_DECLS

/********************** Caution **************************/
/* The following data types should be used to calculate */
/* maximum message sizes only. The actual message may be */
/* smaller, and the position of the arguments within the */
/* message layout may vary from what is presented here. */
/* For example, if any of the arguments are variable- */
/* sized, and less than the maximum is sent, the data */
/* will be packed tight in the actual message to reduce */
/* the presence of holes. */
/********************** Caution **************************/

/* typedefs for all requests */

#ifndef __Request__JackRPCClient_subsystem__defined
#define __Request__JackRPCClient_subsystem__defined

#ifdef __MigPackStructs
#pragma pack(4)
#endif
typedef struct {
mach_msg_header_t Head;
NDR_record_t NDR;
int refnum;
client_name_t client_name;
int notify;
message_t message;
int value1;
int value2;
} __Request__rpc_jack_client_sync_notify_t;
#ifdef __MigPackStructs
#pragma pack()
#endif

#ifdef __MigPackStructs
#pragma pack(4)
#endif
typedef struct {
mach_msg_header_t Head;
NDR_record_t NDR;
int refnum;
client_name_t client_name;
int notify;
message_t message;
int value1;
int value2;
} __Request__rpc_jack_client_async_notify_t;
#ifdef __MigPackStructs
#pragma pack()
#endif
#endif /* !__Request__JackRPCClient_subsystem__defined */

/* union of all requests */

#ifndef __RequestUnion__JackRPCClient_subsystem__defined
#define __RequestUnion__JackRPCClient_subsystem__defined
union __RequestUnion__JackRPCClient_subsystem {
__Request__rpc_jack_client_sync_notify_t Request_rpc_jack_client_sync_notify;
__Request__rpc_jack_client_async_notify_t Request_rpc_jack_client_async_notify;
};
#endif /* !__RequestUnion__JackRPCClient_subsystem__defined */
/* typedefs for all replies */

#ifndef __Reply__JackRPCClient_subsystem__defined
#define __Reply__JackRPCClient_subsystem__defined

#ifdef __MigPackStructs
#pragma pack(4)
#endif
typedef struct {
mach_msg_header_t Head;
NDR_record_t NDR;
kern_return_t RetCode;
int result;
} __Reply__rpc_jack_client_sync_notify_t;
#ifdef __MigPackStructs
#pragma pack()
#endif

#ifdef __MigPackStructs
#pragma pack(4)
#endif
typedef struct {
mach_msg_header_t Head;
NDR_record_t NDR;
kern_return_t RetCode;
} __Reply__rpc_jack_client_async_notify_t;
#ifdef __MigPackStructs
#pragma pack()
#endif
#endif /* !__Reply__JackRPCClient_subsystem__defined */

/* union of all replies */

#ifndef __ReplyUnion__JackRPCClient_subsystem__defined
#define __ReplyUnion__JackRPCClient_subsystem__defined
union __ReplyUnion__JackRPCClient_subsystem {
__Reply__rpc_jack_client_sync_notify_t Reply_rpc_jack_client_sync_notify;
__Reply__rpc_jack_client_async_notify_t Reply_rpc_jack_client_async_notify;
};
#endif /* !__RequestUnion__JackRPCClient_subsystem__defined */

#ifndef subsystem_to_name_map_JackRPCClient
#define subsystem_to_name_map_JackRPCClient \
{ "rpc_jack_client_sync_notify", 1000 },\
{ "rpc_jack_client_async_notify", 1001 }
#endif

#ifdef __AfterMigUserHeader
__AfterMigUserHeader
#endif /* __AfterMigUserHeader */

#endif /* _JackRPCClient_user_ */

+ 0
- 1373
macosx/RPC/JackRPCClientServer.c
File diff suppressed because it is too large
View File


+ 0
- 466
macosx/RPC/JackRPCClientUser.c View File

@@ -1,466 +0,0 @@
/*
* IDENTIFICATION:
* stub generated Fri Oct 23 10:35:08 2009
* with a MiG generated Mon May 18 09:59:33 PDT 2009 by root@sulitlana.apple.com
* OPTIONS:
*/
#define __MIG_check__Reply__JackRPCClient_subsystem__ 1
#define __NDR_convert__Reply__JackRPCClient_subsystem__ 1
#define __NDR_convert__mig_reply_error_subsystem__ 1

#include "JackRPCClient.h"


#ifndef mig_internal
#define mig_internal static __inline__
#endif /* mig_internal */

#ifndef mig_external
#define mig_external
#endif /* mig_external */

#if !defined(__MigTypeCheck) && defined(TypeCheck)
#define __MigTypeCheck TypeCheck /* Legacy setting */
#endif /* !defined(__MigTypeCheck) */

#if !defined(__MigKernelSpecificCode) && defined(_MIG_KERNEL_SPECIFIC_CODE_)
#define __MigKernelSpecificCode _MIG_KERNEL_SPECIFIC_CODE_ /* Legacy setting */
#endif /* !defined(__MigKernelSpecificCode) */

#ifndef LimitCheck
#define LimitCheck 0
#endif /* LimitCheck */

#ifndef min
#define min(a,b) ( ((a) < (b))? (a): (b) )
#endif /* min */

#if !defined(_WALIGN_)
#define _WALIGN_(x) (((x) + 3) & ~3)
#endif /* !defined(_WALIGN_) */

#if !defined(_WALIGNSZ_)
#define _WALIGNSZ_(x) _WALIGN_(sizeof(x))
#endif /* !defined(_WALIGNSZ_) */

#ifndef UseStaticTemplates
#define UseStaticTemplates 0
#endif /* UseStaticTemplates */

#ifndef __MachMsgErrorWithTimeout
#define __MachMsgErrorWithTimeout(_R_) { \
switch (_R_) { \
case MACH_SEND_INVALID_DATA: \
case MACH_SEND_INVALID_DEST: \
case MACH_SEND_INVALID_HEADER: \
mig_put_reply_port(InP->Head.msgh_reply_port); \
break; \
case MACH_SEND_TIMED_OUT: \
case MACH_RCV_TIMED_OUT: \
default: \
mig_dealloc_reply_port(InP->Head.msgh_reply_port); \
} \
}
#endif /* __MachMsgErrorWithTimeout */

#ifndef __MachMsgErrorWithoutTimeout
#define __MachMsgErrorWithoutTimeout(_R_) { \
switch (_R_) { \
case MACH_SEND_INVALID_DATA: \
case MACH_SEND_INVALID_DEST: \
case MACH_SEND_INVALID_HEADER: \
mig_put_reply_port(InP->Head.msgh_reply_port); \
break; \
default: \
mig_dealloc_reply_port(InP->Head.msgh_reply_port); \
} \
}
#endif /* __MachMsgErrorWithoutTimeout */

#ifndef __DeclareSendRpc
#define __DeclareSendRpc(_NUM_, _NAME_)
#endif /* __DeclareSendRpc */

#ifndef __BeforeSendRpc
#define __BeforeSendRpc(_NUM_, _NAME_)
#endif /* __BeforeSendRpc */

#ifndef __AfterSendRpc
#define __AfterSendRpc(_NUM_, _NAME_)
#endif /* __AfterSendRpc */

#ifndef __DeclareSendSimple
#define __DeclareSendSimple(_NUM_, _NAME_)
#endif /* __DeclareSendSimple */

#ifndef __BeforeSendSimple
#define __BeforeSendSimple(_NUM_, _NAME_)
#endif /* __BeforeSendSimple */

#ifndef __AfterSendSimple
#define __AfterSendSimple(_NUM_, _NAME_)
#endif /* __AfterSendSimple */

#define msgh_request_port msgh_remote_port
#define msgh_reply_port msgh_local_port



#if ( __MigTypeCheck || __NDR_convert__ )
#if __MIG_check__Reply__JackRPCClient_subsystem__
#if !defined(__MIG_check__Reply__rpc_jack_client_sync_notify_t__defined)
#define __MIG_check__Reply__rpc_jack_client_sync_notify_t__defined
#ifndef __NDR_convert__int_rep__Reply__rpc_jack_client_sync_notify_t__RetCode__defined
#if defined(__NDR_convert__int_rep__JackRPCClient__kern_return_t__defined)
#define __NDR_convert__int_rep__Reply__rpc_jack_client_sync_notify_t__RetCode__defined
#define __NDR_convert__int_rep__Reply__rpc_jack_client_sync_notify_t__RetCode(a, f) \
__NDR_convert__int_rep__JackRPCClient__kern_return_t((kern_return_t *)(a), f)
#elif defined(__NDR_convert__int_rep__kern_return_t__defined)
#define __NDR_convert__int_rep__Reply__rpc_jack_client_sync_notify_t__RetCode__defined
#define __NDR_convert__int_rep__Reply__rpc_jack_client_sync_notify_t__RetCode(a, f) \
__NDR_convert__int_rep__kern_return_t((kern_return_t *)(a), f)
#endif /* defined(__NDR_convert__*__defined) */
#endif /* __NDR_convert__int_rep__Reply__rpc_jack_client_sync_notify_t__RetCode__defined */


#ifndef __NDR_convert__int_rep__Reply__rpc_jack_client_sync_notify_t__result__defined
#if defined(__NDR_convert__int_rep__JackRPCClient__int__defined)
#define __NDR_convert__int_rep__Reply__rpc_jack_client_sync_notify_t__result__defined
#define __NDR_convert__int_rep__Reply__rpc_jack_client_sync_notify_t__result(a, f) \
__NDR_convert__int_rep__JackRPCClient__int((int *)(a), f)
#elif defined(__NDR_convert__int_rep__int__defined)
#define __NDR_convert__int_rep__Reply__rpc_jack_client_sync_notify_t__result__defined
#define __NDR_convert__int_rep__Reply__rpc_jack_client_sync_notify_t__result(a, f) \
__NDR_convert__int_rep__int((int *)(a), f)
#elif defined(__NDR_convert__int_rep__JackRPCClient__int32_t__defined)
#define __NDR_convert__int_rep__Reply__rpc_jack_client_sync_notify_t__result__defined
#define __NDR_convert__int_rep__Reply__rpc_jack_client_sync_notify_t__result(a, f) \
__NDR_convert__int_rep__JackRPCClient__int32_t((int32_t *)(a), f)
#elif defined(__NDR_convert__int_rep__int32_t__defined)
#define __NDR_convert__int_rep__Reply__rpc_jack_client_sync_notify_t__result__defined
#define __NDR_convert__int_rep__Reply__rpc_jack_client_sync_notify_t__result(a, f) \
__NDR_convert__int_rep__int32_t((int32_t *)(a), f)
#endif /* defined(__NDR_convert__*__defined) */
#endif /* __NDR_convert__int_rep__Reply__rpc_jack_client_sync_notify_t__result__defined */



#ifndef __NDR_convert__char_rep__Reply__rpc_jack_client_sync_notify_t__result__defined
#if defined(__NDR_convert__char_rep__JackRPCClient__int__defined)
#define __NDR_convert__char_rep__Reply__rpc_jack_client_sync_notify_t__result__defined
#define __NDR_convert__char_rep__Reply__rpc_jack_client_sync_notify_t__result(a, f) \
__NDR_convert__char_rep__JackRPCClient__int((int *)(a), f)
#elif defined(__NDR_convert__char_rep__int__defined)
#define __NDR_convert__char_rep__Reply__rpc_jack_client_sync_notify_t__result__defined
#define __NDR_convert__char_rep__Reply__rpc_jack_client_sync_notify_t__result(a, f) \
__NDR_convert__char_rep__int((int *)(a), f)
#elif defined(__NDR_convert__char_rep__JackRPCClient__int32_t__defined)
#define __NDR_convert__char_rep__Reply__rpc_jack_client_sync_notify_t__result__defined
#define __NDR_convert__char_rep__Reply__rpc_jack_client_sync_notify_t__result(a, f) \
__NDR_convert__char_rep__JackRPCClient__int32_t((int32_t *)(a), f)
#elif defined(__NDR_convert__char_rep__int32_t__defined)
#define __NDR_convert__char_rep__Reply__rpc_jack_client_sync_notify_t__result__defined
#define __NDR_convert__char_rep__Reply__rpc_jack_client_sync_notify_t__result(a, f) \
__NDR_convert__char_rep__int32_t((int32_t *)(a), f)
#endif /* defined(__NDR_convert__*__defined) */
#endif /* __NDR_convert__char_rep__Reply__rpc_jack_client_sync_notify_t__result__defined */



#ifndef __NDR_convert__float_rep__Reply__rpc_jack_client_sync_notify_t__result__defined
#if defined(__NDR_convert__float_rep__JackRPCClient__int__defined)
#define __NDR_convert__float_rep__Reply__rpc_jack_client_sync_notify_t__result__defined
#define __NDR_convert__float_rep__Reply__rpc_jack_client_sync_notify_t__result(a, f) \
__NDR_convert__float_rep__JackRPCClient__int((int *)(a), f)
#elif defined(__NDR_convert__float_rep__int__defined)
#define __NDR_convert__float_rep__Reply__rpc_jack_client_sync_notify_t__result__defined
#define __NDR_convert__float_rep__Reply__rpc_jack_client_sync_notify_t__result(a, f) \
__NDR_convert__float_rep__int((int *)(a), f)
#elif defined(__NDR_convert__float_rep__JackRPCClient__int32_t__defined)
#define __NDR_convert__float_rep__Reply__rpc_jack_client_sync_notify_t__result__defined
#define __NDR_convert__float_rep__Reply__rpc_jack_client_sync_notify_t__result(a, f) \
__NDR_convert__float_rep__JackRPCClient__int32_t((int32_t *)(a), f)
#elif defined(__NDR_convert__float_rep__int32_t__defined)
#define __NDR_convert__float_rep__Reply__rpc_jack_client_sync_notify_t__result__defined
#define __NDR_convert__float_rep__Reply__rpc_jack_client_sync_notify_t__result(a, f) \
__NDR_convert__float_rep__int32_t((int32_t *)(a), f)
#endif /* defined(__NDR_convert__*__defined) */
#endif /* __NDR_convert__float_rep__Reply__rpc_jack_client_sync_notify_t__result__defined */



mig_internal kern_return_t __MIG_check__Reply__rpc_jack_client_sync_notify_t(__Reply__rpc_jack_client_sync_notify_t *Out0P)
{

typedef __Reply__rpc_jack_client_sync_notify_t __Reply;
#if __MigTypeCheck
unsigned int msgh_size;
#endif /* __MigTypeCheck */
if (Out0P->Head.msgh_id != 1100) {
if (Out0P->Head.msgh_id == MACH_NOTIFY_SEND_ONCE)
{ return MIG_SERVER_DIED; }
else
{ return MIG_REPLY_MISMATCH; }
}

#if __MigTypeCheck
msgh_size = Out0P->Head.msgh_size;

if ((Out0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
((msgh_size != (mach_msg_size_t)sizeof(__Reply)) &&
(msgh_size != (mach_msg_size_t)sizeof(mig_reply_error_t) ||
Out0P->RetCode == KERN_SUCCESS)))
{ return MIG_TYPE_ERROR ; }
#endif /* __MigTypeCheck */

if (Out0P->RetCode != KERN_SUCCESS) {
#ifdef __NDR_convert__mig_reply_error_t__defined
__NDR_convert__mig_reply_error_t((mig_reply_error_t *)Out0P);
#endif /* __NDR_convert__mig_reply_error_t__defined */
return ((mig_reply_error_t *)Out0P)->RetCode;
}

#if defined(__NDR_convert__int_rep__Reply__rpc_jack_client_sync_notify_t__RetCode__defined) || \
defined(__NDR_convert__int_rep__Reply__rpc_jack_client_sync_notify_t__result__defined)
if (Out0P->NDR.int_rep != NDR_record.int_rep) {
#if defined(__NDR_convert__int_rep__Reply__rpc_jack_client_sync_notify_t__RetCode__defined)
__NDR_convert__int_rep__Reply__rpc_jack_client_sync_notify_t__RetCode(&Out0P->RetCode, Out0P->NDR.int_rep);
#endif /* __NDR_convert__int_rep__Reply__rpc_jack_client_sync_notify_t__RetCode__defined */
#if defined(__NDR_convert__int_rep__Reply__rpc_jack_client_sync_notify_t__result__defined)
__NDR_convert__int_rep__Reply__rpc_jack_client_sync_notify_t__result(&Out0P->result, Out0P->NDR.int_rep);
#endif /* __NDR_convert__int_rep__Reply__rpc_jack_client_sync_notify_t__result__defined */
}
#endif /* defined(__NDR_convert__int_rep...) */

#if 0 || \
defined(__NDR_convert__char_rep__Reply__rpc_jack_client_sync_notify_t__result__defined)
if (Out0P->NDR.char_rep != NDR_record.char_rep) {
#if defined(__NDR_convert__char_rep__Reply__rpc_jack_client_sync_notify_t__result__defined)
__NDR_convert__char_rep__Reply__rpc_jack_client_sync_notify_t__result(&Out0P->result, Out0P->NDR.char_rep);
#endif /* __NDR_convert__char_rep__Reply__rpc_jack_client_sync_notify_t__result__defined */
}
#endif /* defined(__NDR_convert__char_rep...) */

#if 0 || \
defined(__NDR_convert__float_rep__Reply__rpc_jack_client_sync_notify_t__result__defined)
if (Out0P->NDR.float_rep != NDR_record.float_rep) {
#if defined(__NDR_convert__float_rep__Reply__rpc_jack_client_sync_notify_t__result__defined)
__NDR_convert__float_rep__Reply__rpc_jack_client_sync_notify_t__result(&Out0P->result, Out0P->NDR.float_rep);
#endif /* __NDR_convert__float_rep__Reply__rpc_jack_client_sync_notify_t__result__defined */
}
#endif /* defined(__NDR_convert__float_rep...) */

return MACH_MSG_SUCCESS;
}
#endif /* !defined(__MIG_check__Reply__rpc_jack_client_sync_notify_t__defined) */
#endif /* __MIG_check__Reply__JackRPCClient_subsystem__ */
#endif /* ( __MigTypeCheck || __NDR_convert__ ) */


/* Routine rpc_jack_client_sync_notify */
mig_external kern_return_t rpc_jack_client_sync_notify
(
mach_port_t client_port,
int refnum,
client_name_t client_name,
int notify,
message_t message,
int value1,
int value2,
int *result
)
{

#ifdef __MigPackStructs
#pragma pack(4)
#endif
typedef struct {
mach_msg_header_t Head;
NDR_record_t NDR;
int refnum;
client_name_t client_name;
int notify;
message_t message;
int value1;
int value2;
} Request;
#ifdef __MigPackStructs
#pragma pack()
#endif

#ifdef __MigPackStructs
#pragma pack(4)
#endif
typedef struct {
mach_msg_header_t Head;
NDR_record_t NDR;
kern_return_t RetCode;
int result;
mach_msg_trailer_t trailer;
} Reply;
#ifdef __MigPackStructs
#pragma pack()
#endif

#ifdef __MigPackStructs
#pragma pack(4)
#endif
typedef struct {
mach_msg_header_t Head;
NDR_record_t NDR;
kern_return_t RetCode;
int result;
} __Reply;
#ifdef __MigPackStructs
#pragma pack()
#endif
/*
* typedef struct {
* mach_msg_header_t Head;
* NDR_record_t NDR;
* kern_return_t RetCode;
* } mig_reply_error_t;
*/

union {
Request In;
Reply Out;
} Mess;

Request *InP = &Mess.In;
Reply *Out0P = &Mess.Out;

mach_msg_return_t msg_result;

#ifdef __MIG_check__Reply__rpc_jack_client_sync_notify_t__defined
kern_return_t check_result;
#endif /* __MIG_check__Reply__rpc_jack_client_sync_notify_t__defined */

__DeclareSendRpc(1000, "rpc_jack_client_sync_notify")

InP->NDR = NDR_record;

InP->refnum = refnum;

(void) mig_strncpy(InP->client_name, client_name, 64);

InP->notify = notify;

(void) mig_strncpy(InP->message, message, 256);

InP->value1 = value1;

InP->value2 = value2;

InP->Head.msgh_bits =
MACH_MSGH_BITS(19, MACH_MSG_TYPE_MAKE_SEND_ONCE);
/* msgh_size passed as argument */
InP->Head.msgh_request_port = client_port;
InP->Head.msgh_reply_port = mig_get_reply_port();
InP->Head.msgh_id = 1000;

__BeforeSendRpc(1000, "rpc_jack_client_sync_notify")
msg_result = mach_msg(&InP->Head, MACH_SEND_MSG|MACH_RCV_MSG|MACH_SEND_TIMEOUT|MACH_RCV_TIMEOUT|MACH_MSG_OPTION_NONE, (mach_msg_size_t)sizeof(Request), (mach_msg_size_t)sizeof(Reply), InP->Head.msgh_reply_port, 5000, MACH_PORT_NULL);
__AfterSendRpc(1000, "rpc_jack_client_sync_notify")

if (msg_result == MACH_SEND_TIMED_OUT) {
}

if (msg_result != MACH_MSG_SUCCESS) {
__MachMsgErrorWithTimeout(msg_result);
{ return msg_result; }
}


#if defined(__MIG_check__Reply__rpc_jack_client_sync_notify_t__defined)
check_result = __MIG_check__Reply__rpc_jack_client_sync_notify_t((__Reply__rpc_jack_client_sync_notify_t *)Out0P);
if (check_result != MACH_MSG_SUCCESS)
{ return check_result; }
#endif /* defined(__MIG_check__Reply__rpc_jack_client_sync_notify_t__defined) */

*result = Out0P->result;

return KERN_SUCCESS;
}

/* SimpleRoutine rpc_jack_client_async_notify */
mig_external kern_return_t rpc_jack_client_async_notify
(
mach_port_t client_port,
int refnum,
client_name_t client_name,
int notify,
message_t message,
int value1,
int value2
)
{

#ifdef __MigPackStructs
#pragma pack(4)
#endif
typedef struct {
mach_msg_header_t Head;
NDR_record_t NDR;
int refnum;
client_name_t client_name;
int notify;
message_t message;
int value1;
int value2;
} Request;
#ifdef __MigPackStructs
#pragma pack()
#endif
/*
* typedef struct {
* mach_msg_header_t Head;
* NDR_record_t NDR;
* kern_return_t RetCode;
* } mig_reply_error_t;
*/

union {
Request In;
} Mess;

Request *InP = &Mess.In;

mach_msg_return_t msg_result;

#ifdef __MIG_check__Reply__rpc_jack_client_async_notify_t__defined
kern_return_t check_result;
#endif /* __MIG_check__Reply__rpc_jack_client_async_notify_t__defined */

__DeclareSendSimple(1001, "rpc_jack_client_async_notify")

InP->NDR = NDR_record;

InP->refnum = refnum;

(void) mig_strncpy(InP->client_name, client_name, 64);

InP->notify = notify;

(void) mig_strncpy(InP->message, message, 256);

InP->value1 = value1;

InP->value2 = value2;

InP->Head.msgh_bits =
MACH_MSGH_BITS(19, 0);
/* msgh_size passed as argument */
InP->Head.msgh_request_port = client_port;
InP->Head.msgh_reply_port = MACH_PORT_NULL;
InP->Head.msgh_id = 1001;

__BeforeSendSimple(1001, "rpc_jack_client_async_notify")
msg_result = mach_msg(&InP->Head, MACH_SEND_MSG|MACH_SEND_TIMEOUT|MACH_MSG_OPTION_NONE, (mach_msg_size_t)sizeof(Request), 0, MACH_PORT_NULL, 5000, MACH_PORT_NULL);
__AfterSendSimple(1001, "rpc_jack_client_async_notify")

if (msg_result == MACH_SEND_TIMED_OUT) {
}

return msg_result;
}

+ 0
- 181
macosx/RPC/JackRPCEngine.defs View File

@@ -1,181 +0,0 @@
/*
Copyright (C) 2004 Grame
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

*/

subsystem JackRPCEngine 1000;

#include <mach/std_types.defs>
#include <mach/mach_types.defs>
import "Jackdefs.h";

ServerPrefix server_;

type client_name_t = c_string[64];
type client_port_name_t = c_string[128];
type client_port_type_t = c_string[128];
type so_name_t = c_string[256];
type objet_data_t = c_string[256];

routine rpc_jack_client_open(
server_port : mach_port_t;
client_name : client_name_t;
pid : int;
out private_port : mach_port_make_send_t;
out shared_engine : int;
out shared_client : int;
out shared_graph : int;
out result : int);

routine rpc_jack_client_check(
server_port : mach_port_t;
client_name : client_name_t;
out client_name_res : client_name_t;
protocol : int;
options : int;
out status : int;
out result : int);

routine rpc_jack_client_close(
server_port : mach_port_t;
refnum : int;
out result : int);
routine rpc_jack_client_activate(
server_port : mach_port_t;
refnum : int;
state : int;
out result : int);

routine rpc_jack_client_deactivate(
server_port : mach_port_t;
refnum : int;
out result : int);

routine rpc_jack_port_register(
server_port : mach_port_t;
refnum : int;
name : client_port_name_t;
port_type : client_port_type_t;
flags : unsigned;
buffer_size : unsigned;
out port_index : unsigned;
out result : int);
routine rpc_jack_port_unregister(
server_port : mach_port_t;
refnum : int;
port : int;
out result : int);
routine rpc_jack_port_connect(
server_port : mach_port_t;
refnum : int;
src : int;
dst : int;
out result : int);
routine rpc_jack_port_disconnect(
server_port : mach_port_t;
refnum : int;
src : int;
dst : int;
out result : int);
routine rpc_jack_port_connect_name(
server_port : mach_port_t;
refnum : int;
src : client_port_name_t;
dst : client_port_name_t;
out result : int);
routine rpc_jack_port_disconnect_name(
server_port : mach_port_t;
refnum : int;
src : client_port_name_t;
dst : client_port_name_t;
out result : int);
routine rpc_jack_port_rename(
server_port : mach_port_t;
refnum : int;
src : int;
name : client_port_name_t;
out result : int);

routine rpc_jack_set_buffer_size(
server_port : mach_port_t;
buffer_size : int;
out result : int);
routine rpc_jack_set_freewheel(
server_port : mach_port_t;
onoff : int;
out result : int);

routine rpc_jack_release_timebase(
server_port : mach_port_t;
refnum : int;
out result : int);
routine rpc_jack_set_timebase_callback(
server_port : mach_port_t;
refnum : int;
conditional : int;
out result : int);
routine rpc_jack_get_internal_clientname(
server_port : mach_port_t;
refnum : int;
int_ref : int;
out client_name_res : client_name_t;
out result : int);
routine rpc_jack_internal_clienthandle(
server_port : mach_port_t;
refnum : int;
client_name : client_name_t;
out int_ref : int;
out status : int;
out result : int);
routine rpc_jack_internal_clientload(
server_port : mach_port_t;
refnum : int;
client_name : client_name_t;
so_name : so_name_t;
objet_data : objet_data_t;
options : int;
out status : int;
out int_ref : int;
out result : int);
routine rpc_jack_internal_clientunload(
server_port : mach_port_t;
refnum : int;
int_ref : int;
out status : int;
out result : int);

simpleroutine rpc_jack_client_rt_notify(
client_port : mach_port_t;
refnum : int;
notify : int;
value : int;
waittime timeout : int);


+ 0
- 1040
macosx/RPC/JackRPCEngine.h
File diff suppressed because it is too large
View File


+ 0
- 6817
macosx/RPC/JackRPCEngineServer.c
File diff suppressed because it is too large
View File


+ 0
- 6302
macosx/RPC/JackRPCEngineUser.c
File diff suppressed because it is too large
View File


+ 0
- 25
macosx/RPC/Jackdefs.h View File

@@ -1,25 +0,0 @@
/*
Copyright (C) 2004-2006 Grame

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

*/

typedef char client_name_t[64];
typedef char client_port_name_t[128];
typedef char client_port_type_t[128];
typedef char so_name_t[256];
typedef char objet_data_t[256];
typedef char message_t[256];

+ 6
- 1
posix/JackPosixThread.cpp View File

@@ -117,7 +117,7 @@ int JackPosixThread::StartImp(pthread_t* thread, int priority, int realtime, voi
if ((res = pthread_attr_setinheritsched(&attributes, PTHREAD_EXPLICIT_SCHED))) {
jack_error("Cannot request explicit scheduling for RT thread res = %d", res);
return -1;
}
}
if ((res = pthread_attr_setschedpolicy(&attributes, JACK_SCHED_POLICY))) {
jack_error("Cannot set RR scheduling class for RT thread res = %d", res);
@@ -270,6 +270,11 @@ pthread_t JackPosixThread::GetThreadID()
return fThread;
}

bool JackPosixThread::IsThread()
{
return pthread_self() == fThread;
}

void JackPosixThread::Terminate()
{
jack_log("JackPosixThread::Terminate");


+ 2
- 1
posix/JackPosixThread.h View File

@@ -68,10 +68,11 @@ class SERVER_EXPORT JackPosixThread : public detail::JackThreadInterface
int DropSelfRealTime(); // Used when called from thread itself

pthread_t GetThreadID();
bool IsThread();

static int AcquireRealTimeImp(pthread_t thread, int priority);
static int AcquireRealTimeImp(pthread_t thread, int priority, UInt64 period, UInt64 computation, UInt64 constraint)
{ return JackPosixThread::AcquireRealTimeImp(thread, priority); }
{ return JackPosixThread::AcquireRealTimeImp(thread, priority); }
static int DropRealTimeImp(pthread_t thread);
static int StartImp(pthread_t* thread, int priority, int realtime, void*(*start_routine)(void*), void* arg);
static int StopImp(pthread_t thread);


+ 2
- 2
posix/JackSocket.cpp View File

@@ -129,7 +129,7 @@ int JackClientSocket::Connect(const char* dir, const char* name, int which) // A
}

#ifdef __APPLE__
int on = 1 ;
int on = 1;
if (setsockopt(fSocket, SOL_SOCKET, SO_NOSIGPIPE, (const char*)&on, sizeof(on)) < 0) {
jack_log("setsockopt SO_NOSIGPIPE fd = %ld err = %s", fSocket, strerror(errno));
}
@@ -260,7 +260,7 @@ int JackServerSocket::Bind(const char* dir, const char* name, int which) // A re
goto error;
}

if (listen(fSocket, 1) < 0) {
if (listen(fSocket, 100) < 0) {
jack_error("Cannot enable listen on server socket err = %s", strerror(errno));
goto error;
}


+ 66
- 8
posix/JackSocketClientChannel.cpp View File

@@ -51,7 +51,7 @@ int JackSocketClientChannel::ServerCheck(const char* server_name)
}
}

int JackSocketClientChannel::Open(const char* server_name, const char* name, char* name_res, JackClient* obj, jack_options_t options, jack_status_t* status)
int JackSocketClientChannel::Open(const char* server_name, const char* name, int uuid, char* name_res, JackClient* obj, jack_options_t options, jack_status_t* status)
{
int result = 0;
jack_log("JackSocketClientChannel::Open name = %s", name);
@@ -62,7 +62,7 @@ int JackSocketClientChannel::Open(const char* server_name, const char* name, cha
}

// Check name in server
ClientCheck(name, name_res, JACK_PROTOCOL_VERSION, (int)options, (int*)status, &result);
ClientCheck(name, uuid, name_res, JACK_PROTOCOL_VERSION, (int)options, (int*)status, &result);
if (result < 0) {
int status1 = *status;
if (status1 & JackVersionError)
@@ -142,18 +142,18 @@ void JackSocketClientChannel::ServerAsyncCall(JackRequest* req, JackResult* res,
}
}

void JackSocketClientChannel::ClientCheck(const char* name, char* name_res, int protocol, int options, int* status, int* result)
void JackSocketClientChannel::ClientCheck(const char* name, int uuid, char* name_res, int protocol, int options, int* status, int* result)
{
JackClientCheckRequest req(name, protocol, options);
JackClientCheckRequest req(name, protocol, options, uuid);
JackClientCheckResult res;
ServerSyncCall(&req, &res, result);
*status = res.fStatus;
strcpy(name_res, res.fName);
}

void JackSocketClientChannel::ClientOpen(const char* name, int pid, int* shared_engine, int* shared_client, int* shared_graph, int* result)
void JackSocketClientChannel::ClientOpen(const char* name, int pid, int uuid, int* shared_engine, int* shared_client, int* shared_graph, int* result)
{
JackClientOpenRequest req(name, pid);
JackClientOpenRequest req(name, pid, uuid);
JackClientOpenResult res;
ServerSyncCall(&req, &res, result);
*shared_engine = res.fSharedEngine;
@@ -246,6 +246,64 @@ void JackSocketClientChannel::SetFreewheel(int onoff, int* result)
ServerSyncCall(&req, &res, result);
}

void JackSocketClientChannel::SessionNotify(int refnum, const char* target, jack_session_event_type_t type, const char* path, jack_session_command_t ** result)
{
JackSessionNotifyRequest req(refnum, path, type, target);
JackSessionNotifyResult res;
int intresult;
ServerSyncCall(&req, &res, &intresult);

jack_session_command_t *session_command = (jack_session_command_t *)malloc( sizeof(jack_session_command_t) * (res.fCommandList.size()+1) );
int i=0;
for (std::list<JackSessionCommand>::iterator ci=res.fCommandList.begin(); ci!=res.fCommandList.end(); ci++) {
session_command[i].uuid = strdup( ci->fUUID );
session_command[i].client_name = strdup( ci->fClientName );
session_command[i].command = strdup( ci->fCommand );
session_command[i].flags = ci->fFlags;

i+=1;
}
session_command[i].uuid = NULL;
session_command[i].client_name = NULL;
session_command[i].command = NULL;
session_command[i].flags = (jack_session_flags_t)0;


*result = session_command;
}

void JackSocketClientChannel::SessionReply(int refnum, int* result)
{
JackSessionReplyRequest req(refnum);
JackResult res;
ServerSyncCall(&req, &res, result);
}

void JackSocketClientChannel::GetUUIDForClientName( int refnum, const char *client_name, char *uuid_res, int *result )
{
JackGetUUIDRequest req(client_name);
JackUUIDResult res;
ServerSyncCall(&req, &res, result);
strncpy( uuid_res, res.fUUID, JACK_UUID_SIZE );
}

void JackSocketClientChannel::GetClientNameForUUID( int refnum, const char *uuid, char *name_res, int *result )
{
JackGetClientNameRequest req(uuid);
JackClientNameResult res;
ServerSyncCall(&req, &res, result);
strncpy( name_res, res.fName, JACK_CLIENT_NAME_SIZE );
}

void JackSocketClientChannel::ReserveClientName( int refnum, const char *client_name, const char *uuid, int *result )
{
JackReserveNameRequest req(refnum, client_name, uuid);
JackResult res;
ServerSyncCall(&req, &res, result);
}

void JackSocketClientChannel::ReleaseTimebase(int refnum, int* result)
{
JackReleaseTimebaseRequest req(refnum);
@@ -277,9 +335,9 @@ void JackSocketClientChannel::InternalClientHandle(int refnum, const char* clien
*status = res.fStatus;
}

void JackSocketClientChannel::InternalClientLoad(int refnum, const char* client_name, const char* so_name, const char* objet_data, int options, int* status, int* int_ref, int* result)
void JackSocketClientChannel::InternalClientLoad(int refnum, const char* client_name, const char* so_name, const char* objet_data, int options, int* status, int* int_ref, int uuid, int* result)
{
JackInternalClientLoadRequest req(refnum, client_name, so_name, objet_data, options);
JackInternalClientLoadRequest req(refnum, client_name, so_name, objet_data, options, uuid);
JackInternalClientLoadResult res;
ServerSyncCall(&req, &res, result);
*int_ref = res.fIntRefNum;


+ 19
- 9
posix/JackSocketClientChannel.h View File

@@ -38,11 +38,11 @@ class JackSocketClientChannel : public detail::JackClientChannelInterface, publi

private:

JackClientSocket fRequestSocket; // Socket to communicate with the server
JackServerSocket fNotificationListenSocket; // Socket listener for server notification
JackClientSocket* fNotificationSocket; // Socket for server notification
JackClientSocket fRequestSocket; // Socket to communicate with the server
JackServerSocket fNotificationListenSocket; // Socket listener for server notification
JackClientSocket* fNotificationSocket; // Socket for server notification
JackThread fThread; // Thread to execute the event loop
JackClient* fClient;
JackClient* fClient;

void ServerSyncCall(JackRequest* req, JackResult* res, int* result);
void ServerAsyncCall(JackRequest* req, JackResult* res, int* result);
@@ -52,7 +52,7 @@ class JackSocketClientChannel : public detail::JackClientChannelInterface, publi
JackSocketClientChannel();
virtual ~JackSocketClientChannel();

int Open(const char* server_name, const char* name, char* name_res, JackClient* obj, jack_options_t options, jack_status_t* status);
int Open(const char* server_name, const char* name, int uuid, char* name_res, JackClient* obj, jack_options_t options, jack_status_t* status);
void Close();

int Start();
@@ -60,9 +60,9 @@ class JackSocketClientChannel : public detail::JackClientChannelInterface, publi

int ServerCheck(const char* server_name);

void ClientCheck(const char* name, char* name_res, int protocol, int options, int* status, int* result);
void ClientOpen(const char* name, int pid, int* shared_engine, int* shared_client, int* shared_graph, int* result);
void ClientOpen(const char* name, int* ref, JackEngineControl** shared_engine, JackGraphManager** shared_manager, JackClientInterface* client, int* result)
void ClientCheck(const char* name, int uuid, char* name_res, int protocol, int options, int* status, int* result);
void ClientOpen(const char* name, int pid, int uuid, int* shared_engine, int* shared_client, int* shared_graph, int* result);
void ClientOpen(const char* name, int* ref, int uuid, JackEngineControl** shared_engine, JackGraphManager** shared_manager, JackClientInterface* client, int* result)
{}
void ClientClose(int refnum, int* result);

@@ -88,12 +88,22 @@ class JackSocketClientChannel : public detail::JackClientChannelInterface, publi

void GetInternalClientName(int refnum, int int_ref, char* name_res, int* result);
void InternalClientHandle(int refnum, const char* client_name, int* status, int* int_ref, int* result);
void InternalClientLoad(int refnum, const char* client_name, const char* so_name, const char* objet_data, int options, int* status, int* int_ref, int* result);
void InternalClientLoad(int refnum, const char* client_name, const char* so_name, const char* objet_data, int options, int* status, int* int_ref, int uuid, int* result);
void InternalClientUnload(int refnum, int int_ref, int* status, int* result);

// Session Stuff
void SessionNotify(int refnum, const char* target, jack_session_event_type_t type, const char* path, jack_session_command_t** result);
void SessionReply(int refnum, int* result);
void GetUUIDForClientName( int refnum, const char *client_name, char *uuid_res, int *result );
void GetClientNameForUUID( int refnum, const char *uuid, char *name_res, int *result );
void ReserveClientName( int refnum, const char *client_name, const char *uuid, int *result );

// JackRunnableInterface interface
bool Init();
bool Execute();


bool IsChannelThread() { return fThread.IsThread(); }
};

} // end of namespace


+ 71
- 5
posix/JackSocketServerChannel.cpp View File

@@ -102,14 +102,20 @@ void JackSocketServerChannel::ClientCreate()
}
}

void JackSocketServerChannel::ClientAdd(int fd, char* name, int pid, int* shared_engine, int* shared_client, int* shared_graph, int* result)
void JackSocketServerChannel::ClientAdd(int fd, char* name, int pid, int uuid, int* shared_engine, int* shared_client, int* shared_graph, int* result)
{
jack_log("JackSocketServerChannel::ClientAdd");
int refnum = -1;
*result = fServer->GetEngine()->ClientExternalOpen(name, pid, &refnum, shared_engine, shared_client, shared_graph);
*result = fServer->GetEngine()->ClientExternalOpen(name, pid, uuid, &refnum, shared_engine, shared_client, shared_graph);
if (*result == 0) {
fSocketTable[fd].first = refnum;
fRebuild = true;
#ifdef __APPLE__
int on = 1;
if (setsockopt(fd, SOL_SOCKET, SO_NOSIGPIPE, (const char*)&on, sizeof(on)) < 0) {
jack_log("setsockopt SO_NOSIGPIPE fd = %ld err = %s", fd, strerror(errno));
}
#endif
} else {
jack_error("Cannot create new client");
}
@@ -170,7 +176,7 @@ bool JackSocketServerChannel::HandleRequest(int fd)
JackClientCheckRequest req;
JackClientCheckResult res;
if (req.Read(socket) == 0)
res.fResult = fServer->GetEngine()->ClientCheck(req.fName, res.fName, req.fProtocol, req.fOptions, &res.fStatus);
res.fResult = fServer->GetEngine()->ClientCheck(req.fName, req.fUUID, res.fName, req.fProtocol, req.fOptions, &res.fStatus);
if (res.Write(socket) < 0)
jack_error("JackRequest::ClientCheck write error name = %s", req.fName);
break;
@@ -181,7 +187,7 @@ bool JackSocketServerChannel::HandleRequest(int fd)
JackClientOpenRequest req;
JackClientOpenResult res;
if (req.Read(socket) == 0)
ClientAdd(fd, req.fName, req.fPID, &res.fSharedEngine, &res.fSharedClient, &res.fSharedGraph, &res.fResult);
ClientAdd(fd, req.fName, req.fPID, req.fUUID, &res.fSharedEngine, &res.fSharedClient, &res.fSharedGraph, &res.fResult);
if (res.Write(socket) < 0)
jack_error("JackRequest::ClientOpen write error name = %s", req.fName);
break;
@@ -369,7 +375,7 @@ bool JackSocketServerChannel::HandleRequest(int fd)
JackInternalClientLoadRequest req;
JackInternalClientLoadResult res;
if (req.Read(socket) == 0)
res.fResult = fServer->InternalClientLoad(req.fName, req.fDllName, req.fLoadInitName, req.fOptions, &res.fIntRefNum, &res.fStatus);
res.fResult = fServer->InternalClientLoad(req.fName, req.fDllName, req.fLoadInitName, req.fOptions, &res.fIntRefNum, req.fUUID, &res.fStatus);
if (res.Write(socket) < 0)
jack_error("JackRequest::InternalClientLoad write error name = %s", req.fName);
break;
@@ -400,6 +406,66 @@ bool JackSocketServerChannel::HandleRequest(int fd)
break;
}

case JackRequest::kSessionNotify: {
jack_log("JackRequest::SessionNotify");
JackSessionNotifyRequest req;
JackSessionNotifyResult res;
if (req.Read(socket) == 0) {
fServer->GetEngine()->SessionNotify(req.fRefNum, req.fDst, req.fEventType, req.fPath, socket);
}
break;
}

case JackRequest::kSessionReply: {
jack_log("JackRequest::SessionReply");
JackSessionReplyRequest req;
JackResult res;
if (req.Read(socket) == 0) {
fServer->GetEngine()->SessionReply(req.fRefNum);
res.fResult = 0;
}
if (res.Write(socket) < 0)
jack_error("JackRequest::SessionReply write error");
break;
}

case JackRequest::kGetClientByUUID: {
jack_log("JackRequest::GetClientNameForUUID");
JackGetClientNameRequest req;
JackClientNameResult res;
if (req.Read(socket) == 0) {
fServer->GetEngine()->GetClientNameForUUID(req.fUUID, res.fName, &res.fResult);
}
if (res.Write(socket) < 0)
jack_error("JackRequest::GetClientNameForUUID write error");
break;
}

case JackRequest::kGetUUIDByClient: {
jack_log("JackRequest::GetUUIDForClientName");
JackGetUUIDRequest req;
JackUUIDResult res;
if (req.Read(socket) == 0) {
fServer->GetEngine()->GetUUIDForClientName(req.fName, res.fUUID, &res.fResult);
res.fResult = 0;
}
if (res.Write(socket) < 0)
jack_error("JackRequest::GetUUIDForClientName write error");
break;
}

case JackRequest::kReserveClientName: {
jack_log("JackRequest::ReserveClientName");
JackReserveNameRequest req;
JackResult res;
if (req.Read(socket) == 0) {
fServer->GetEngine()->ReserveClientName(req.fName, req.fUUID, &res.fResult);
}
if (res.Write(socket) < 0)
jack_error("JackRequest::ReserveClientName write error");
break;
}

default:
jack_error("Unknown request %ld", header.fType);
break;


+ 4
- 4
posix/JackSocketServerChannel.h View File

@@ -39,10 +39,10 @@ class JackSocketServerChannel : public JackRunnableInterface

private:

JackServerSocket fRequestListenSocket; // Socket to create request socket for the client
JackServerSocket fRequestListenSocket; // Socket to create request socket for the client
JackThread fThread; // Thread to execute the event loop
JackServer* fServer;
pollfd* fPollTable;
JackServer* fServer;
pollfd* fPollTable;
bool fRebuild;
std::map<int, std::pair<int, JackClientSocket*> > fSocketTable;

@@ -50,7 +50,7 @@ class JackSocketServerChannel : public JackRunnableInterface
void BuildPoolTable();

void ClientCreate();
void ClientAdd(int fd, char* name, int pid, int* shared_engine, int* shared_client, int* shared_graph, int* result);
void ClientAdd(int fd, char* name, int pid, int uuid, int* shared_engine, int* shared_client, int* shared_graph, int* result);
void ClientRemove(int fd, int refnum);
void ClientKill(int fd);



+ 18
- 8
windows/JackWinNamedPipeClientChannel.cpp View File

@@ -48,7 +48,7 @@ int JackWinNamedPipeClientChannel::ServerCheck(const char* server_name)
}
}

int JackWinNamedPipeClientChannel::Open(const char* server_name, const char* name, char* name_res, JackClient* obj, jack_options_t options, jack_status_t* status)
int JackWinNamedPipeClientChannel::Open(const char* server_name, const char* name, int uuid, char* name_res, JackClient* obj, jack_options_t options, jack_status_t* status)
{
int result = 0;
jack_log("JackWinNamedPipeClientChannel::Open name = %s", name);
@@ -67,7 +67,7 @@ int JackWinNamedPipeClientChannel::Open(const char* server_name, const char* nam
}

// Check name in server
ClientCheck(name, name_res, JACK_PROTOCOL_VERSION, (int)options, (int*)status, &result);
ClientCheck(name, uuid, name_res, JACK_PROTOCOL_VERSION, (int)options, (int*)status, &result);
if (result < 0) {
jack_error("Client name = %s conflits with another running client", name);
goto error;
@@ -142,18 +142,18 @@ void JackWinNamedPipeClientChannel::ServerAsyncCall(JackRequest* req, JackResult
}
}

void JackWinNamedPipeClientChannel::ClientCheck(const char* name, char* name_res, int protocol, int options, int* status, int* result)
void JackWinNamedPipeClientChannel::ClientCheck(const char* name, int uuid, char* name_res, int protocol, int options, int* status, int* result)
{
JackClientCheckRequest req(name, protocol, options);
JackClientCheckRequest req(name, protocol, options, uuid);
JackClientCheckResult res;
ServerSyncCall(&req, &res, result);
*status = res.fStatus;
strcpy(name_res, res.fName);
}

void JackWinNamedPipeClientChannel::ClientOpen(const char* name, int pid, int* shared_engine, int* shared_client, int* shared_graph, int* result)
void JackWinNamedPipeClientChannel::ClientOpen(const char* name, int pid, int uuid, int* shared_engine, int* shared_client, int* shared_graph, int* result)
{
JackClientOpenRequest req(name, pid);
JackClientOpenRequest req(name, pid, uuid);
JackClientOpenResult res;
ServerSyncCall(&req, &res, result);
*shared_engine = res.fSharedEngine;
@@ -246,6 +246,16 @@ void JackWinNamedPipeClientChannel::SetFreewheel(int onoff, int* result)
ServerSyncCall(&req, &res, result);
}

void JackWinNamedPipeClientChannel::SessionNotify(int refnum, const char* target, jack_session_event_type_t type, const char* path, jack_session_command_t** result)
{
JackSessionNotifyRequest req(refnum, target, type, path);
JackResult res;
int intresult;
ServerSyncCall(&req, &res, &intresult);

*result = NULL;
}

void JackWinNamedPipeClientChannel::ReleaseTimebase(int refnum, int* result)
{
JackReleaseTimebaseRequest req(refnum);
@@ -277,9 +287,9 @@ void JackWinNamedPipeClientChannel::InternalClientHandle(int refnum, const char*
*status = res.fStatus;
}

void JackWinNamedPipeClientChannel::InternalClientLoad(int refnum, const char* client_name, const char* so_name, const char* objet_data, int options, int* status, int* int_ref, int* result)
void JackWinNamedPipeClientChannel::InternalClientLoad(int refnum, const char* client_name, const char* so_name, const char* objet_data, int options, int* status, int* int_ref, int uuid, int* result)
{
JackInternalClientLoadRequest req(refnum, client_name, so_name, objet_data, options);
JackInternalClientLoadRequest req(refnum, client_name, so_name, objet_data, options, uuid);
JackInternalClientLoadResult res;
ServerSyncCall(&req, &res, result);
*int_ref = res.fIntRefNum;


+ 4
- 4
windows/JackWinNamedPipeClientChannel.h View File

@@ -51,7 +51,7 @@ class JackWinNamedPipeClientChannel : public detail::JackClientChannelInterface,
JackWinNamedPipeClientChannel();
virtual ~JackWinNamedPipeClientChannel();

int Open(const char* server_name, const char* name, char* name_res, JackClient* obj, jack_options_t options, jack_status_t* status);
int Open(const char* server_name, const char* name, int uuid, char* name_res, JackClient* obj, jack_options_t options, jack_status_t* status);
void Close();

int Start();
@@ -59,8 +59,8 @@ class JackWinNamedPipeClientChannel : public detail::JackClientChannelInterface,

int ServerCheck(const char* server_name);

void ClientCheck(const char* name, char* name_res, int protocol, int options, int* status, int* result);
void ClientOpen(const char* name, int pid, int* shared_engine, int* shared_client, int* shared_graph, int* result);
void ClientCheck(const char* name, int uuid, char* name_res, int protocol, int options, int* status, int* result);
void ClientOpen(const char* name, int pid, int uuid, int* shared_engine, int* shared_client, int* shared_graph, int* result);
void ClientOpen(const char* name, int* ref, JackEngineControl** shared_engine, JackGraphManager** shared_manager, JackClientInterface* client, int* result)
{}
void ClientClose(int refnum, int* result);
@@ -87,7 +87,7 @@ class JackWinNamedPipeClientChannel : public detail::JackClientChannelInterface,

void GetInternalClientName(int refnum, int int_ref, char* name_res, int* result);
void InternalClientHandle(int refnum, const char* client_name, int* status, int* int_ref, int* result);
void InternalClientLoad(int refnum, const char* client_name, const char* so_name, const char* objet_data, int options, int* status, int* int_ref, int* result);
void InternalClientLoad(int refnum, const char* client_name, const char* so_name, const char* objet_data, int options, int* status, int* int_ref, int uuid, int* result);
void InternalClientUnload(int refnum, int int_ref, int* status, int* result);

// JackRunnableInterface interface


+ 69
- 12
windows/JackWinNamedPipeServerChannel.cpp View File

@@ -53,7 +53,7 @@ JackClientPipeThread::~JackClientPipeThread()
delete fPipe;
}

int JackClientPipeThread::Open(JackServer* server) // Open the Server/Client connection
int JackClientPipeThread::Open(JackServer* server) // Open the Server/Client connection
{
// Start listening
if (fThread.Start() != 0) {
@@ -65,13 +65,13 @@ int JackClientPipeThread::Open(JackServer* server) // Open the Server/Client con
return 0;
}

void JackClientPipeThread::Close() // Close the Server/Client connection
void JackClientPipeThread::Close() // Close the Server/Client connection
{
jack_log("JackClientPipeThread::Close %x %ld", this, fRefNum);
/*
TODO : solve WIN32 thread Kill issue
This would hang.. since Close will be followed by a delete,
all ressources will be desallocated at the end.
TODO : solve WIN32 thread Kill issue
This would hang.. since Close will be followed by a delete,
all ressources will be desallocated at the end.
*/

fThread.Kill();
@@ -115,7 +115,7 @@ bool JackClientPipeThread::HandleRequest()
JackClientCheckRequest req;
JackClientCheckResult res;
if (req.Read(fPipe) == 0)
res.fResult = fServer->GetEngine()->ClientCheck(req.fName, res.fName, req.fProtocol, req.fOptions, &res.fStatus);
res.fResult = fServer->GetEngine()->ClientCheck(req.fName, req.fUUID, res.fName, req.fProtocol, req.fOptions, &res.fStatus);
res.Write(fPipe);
break;
}
@@ -125,7 +125,7 @@ bool JackClientPipeThread::HandleRequest()
JackClientOpenRequest req;
JackClientOpenResult res;
if (req.Read(fPipe) == 0)
ClientAdd(req.fName, req.fPID, &res.fSharedEngine, &res.fSharedClient, &res.fSharedGraph, &res.fResult);
ClientAdd(req.fName, req.fPID, req.fUUID, &res.fSharedEngine, &res.fSharedClient, &res.fSharedGraph, &res.fResult);
res.Write(fPipe);
break;
}
@@ -297,7 +297,7 @@ bool JackClientPipeThread::HandleRequest()
JackInternalClientLoadRequest req;
JackInternalClientLoadResult res;
if (req.Read(fPipe) == 0)
res.fResult = fServer->InternalClientLoad(req.fName, req.fDllName, req.fLoadInitName, req.fOptions, &res.fIntRefNum, &res.fStatus);
res.fResult = fServer->InternalClientLoad(req.fName, req.fDllName, req.fLoadInitName, req.fOptions, &res.fIntRefNum, req.fUUID, &res.fStatus);
res.Write(fPipe);
break;
}
@@ -326,6 +326,63 @@ bool JackClientPipeThread::HandleRequest()
break;
}

case JackRequest::kSessionNotify: {
jack_log("JackRequest::SessionNotify");
JackSessionNotifyRequest req;
JackSessionNotifyResult res;
if (req.Read(fPipe) == 0) {
fServer->GetEngine()->SessionNotify(req.fRefNum, req.fDst, req.fEventType, req.fPath);
}
res.Write(fPipe);
break;
}
case JackRequest::kSessionReply: {
jack_log("JackRequest::SessionReply");
JackSessionReplyRequest req;
JackResult res;
if (req.Read(fPipe) == 0) {
fServer->GetEngine()->SessionReply(req.fRefNum);
res.fResult = 0;
}
break;
}
case JackRequest::kGetClientByUUID: {
jack_log("JackRequest::GetClientNameForUUID");
JackGetClientNameRequest req;
JackClientNameResult res;
if (req.Read(fPipe) == 0) {
fServer->GetEngine()->GetClientNameForUUID(req.fUUID, res.fName, &res.fResult);
}
res.Write(fPipe);
break;
}
case JackRequest::kGetUUIDByClient: {
jack_log("JackRequest::GetUUIDForClientName");
JackGetUUIDRequest req;
JackUUIDResult res;
if (req.Read(fPipe) == 0) {
fServer->GetEngine()->GetUUIDForClientName(req.fName, res.fUUID, &res.fResult);
res.fResult = 0;
}
res.Write(fPipe);
break;
}
case JackRequest::kReserveClientName: {
jack_log("JackRequest::ReserveClientName");
JackReserveNameRequest req;
JackResult res;
if (req.Read(fPipe) == 0) {
fServer->GetEngine()->ReserveClientName(req.fName, req.fUUID, &res.fResult);
res.fResult = 0;
}
res.Write(fPipe);
break;
}

default:
jack_log("Unknown request %ld", header.fType);
break;
@@ -358,7 +415,7 @@ void JackClientPipeThread::ClientKill()
{
jack_log("JackClientPipeThread::ClientKill ref = %d", fRefNum);

if (fRefNum == -1) { // Correspond to an already removed client.
if (fRefNum == -1) { // Correspond to an already removed client.
jack_log("Kill a closed client");
} else if (fRefNum == 0) { // Correspond to a still not opened client.
jack_log("Kill a not opened client");
@@ -401,10 +458,10 @@ int JackWinNamedPipeServerChannel::Open(const char* server_name, JackServer* ser
void JackWinNamedPipeServerChannel::Close()
{
/* TODO : solve WIN32 thread Kill issue
This would hang the server... since we are quitting it, its not really problematic,
all ressources will be desallocated at the end.
This would hang the server... since we are quitting it, its not really problematic,
all ressources will be desallocated at the end.

fRequestListenPipe.Close();
fRequestListenPipe.Close();
fThread.Stop();
*/



+ 5
- 0
windows/JackWinThread.cpp View File

@@ -235,6 +235,11 @@ pthread_t JackWinThread::GetThreadID()
return fThread;
}

bool JackWinThread::IsThread()
{
return GetCurrentThread() == fThread;
}

void JackWinThread::Terminate()
{
jack_log("JackWinThread::Terminate");


Loading…
Cancel
Save