Browse Source

rebase from trunk 4041:4083

git-svn-id: http://subversion.jackaudio.org/jack/jack2/branches/libjacknet@4084 0c269be4-1314-0410-8aa9-9f06e86f4224
tags/1.9.8
sletz 13 years ago
parent
commit
4828d0c835
100 changed files with 3182 additions and 19382 deletions
  1. +33
    -2
      ChangeLog
  2. +2
    -1
      README
  3. +134
    -8
      common/JackAPI.cpp
  4. +17
    -17
      common/JackAudioDriver.cpp
  5. +24
    -4
      common/JackChannel.h
  6. +103
    -9
      common/JackClient.cpp
  7. +14
    -1
      common/JackClient.h
  8. +13
    -5
      common/JackClientControl.h
  9. +4
    -1
      common/JackConstants.h
  10. +5
    -5
      common/JackControlAPI.cpp
  11. +10
    -10
      common/JackDebugClient.cpp
  12. +3
    -3
      common/JackDebugClient.h
  13. +17
    -8
      common/JackDriverLoader.cpp
  14. +3
    -3
      common/JackDriverLoader.h
  15. +189
    -12
      common/JackEngine.cpp
  16. +26
    -9
      common/JackEngine.h
  17. +10
    -10
      common/JackError.cpp
  18. +10
    -10
      common/JackError.h
  19. +2
    -2
      common/JackExternalClient.cpp
  20. +2
    -2
      common/JackExternalClient.h
  21. +6
    -6
      common/JackInternalClient.cpp
  22. +5
    -5
      common/JackInternalClient.h
  23. +9
    -4
      common/JackInternalClientChannel.h
  24. +5
    -5
      common/JackLibAPI.cpp
  25. +3
    -3
      common/JackLibClient.cpp
  26. +2
    -2
      common/JackLibClient.h
  27. +41
    -4
      common/JackLockedEngine.h
  28. +296
    -306
      common/JackNetOneDriver.cpp
  29. +1
    -0
      common/JackNotification.h
  30. +375
    -74
      common/JackRequest.h
  31. +16
    -16
      common/JackServer.cpp
  32. +3
    -3
      common/JackServer.h
  33. +6
    -6
      common/JackServerAPI.cpp
  34. +1
    -0
      common/JackThread.h
  35. +10
    -0
      common/JackTools.cpp
  36. +4
    -0
      common/JackTools.h
  37. +4
    -3
      common/Jackdmp.cpp
  38. +4
    -1
      common/jack/jack.h
  39. +14
    -0
      common/jack/midiport.h
  40. +229
    -0
      common/jack/session.h
  41. +47
    -43
      common/jack/types.h
  42. +13
    -6
      common/varargs.h
  43. +5
    -9
      common/wscript
  44. +1
    -1
      dbus/controller_iface_patchbay.c
  45. +73
    -25
      dbus/jackdbus.c
  46. +1
    -1
      doxyfile
  47. +3
    -1
      example-clients/lsp.c
  48. +43
    -45
      example-clients/netsource.c
  49. +184
    -0
      example-clients/session_notify.c
  50. +202
    -0
      example-clients/simple_session_client.c
  51. +2
    -0
      example-clients/wscript
  52. +328
    -341
      linux/alsa/JackAlsaDriver.cpp
  53. +4
    -2
      linux/firewire/JackFFADODriver.cpp
  54. +4
    -2
      linux/freebob/JackFreebobDriver.cpp
  55. +2
    -2
      macosx/Jack-Info.plist
  56. +55
    -0
      macosx/JackCompilerDeps_os.h
  57. +0
    -250
      macosx/JackMacEngineRPC.cpp
  58. +0
    -47
      macosx/JackMacLibClientRPC.cpp
  59. +0
    -334
      macosx/JackMachClientChannel.cpp
  60. +0
    -99
      macosx/JackMachClientChannel.h
  61. +0
    -67
      macosx/JackMachNotifyChannel.cpp
  62. +0
    -53
      macosx/JackMachNotifyChannel.h
  63. +0
    -295
      macosx/JackMachPort.cpp
  64. +0
    -88
      macosx/JackMachPort.h
  65. +0
    -174
      macosx/JackMachServerChannel.cpp
  66. +0
    -76
      macosx/JackMachServerChannel.h
  67. +0
    -70
      macosx/JackMachServerNotifyChannel.cpp
  68. +0
    -55
      macosx/JackMachServerNotifyChannel.h
  69. +20
    -13
      macosx/JackPlatformPlug_os.h
  70. +211
    -150
      macosx/Jackdmp.xcodeproj/project.pbxproj
  71. +0
    -47
      macosx/RPC/JackRPCClient.defs
  72. +0
    -194
      macosx/RPC/JackRPCClient.h
  73. +0
    -1373
      macosx/RPC/JackRPCClientServer.c
  74. +0
    -466
      macosx/RPC/JackRPCClientUser.c
  75. +0
    -181
      macosx/RPC/JackRPCEngine.defs
  76. +0
    -1040
      macosx/RPC/JackRPCEngine.h
  77. +0
    -6817
      macosx/RPC/JackRPCEngineServer.c
  78. +0
    -6302
      macosx/RPC/JackRPCEngineUser.c
  79. +0
    -25
      macosx/RPC/Jackdefs.h
  80. +3
    -8
      macosx/coreaudio/JackCoreAudioDriver.cpp
  81. +0
    -8
      macosx/coreaudio/JackCoreAudioDriver.h
  82. +1
    -1
      posix/JackCompilerDeps_os.h
  83. +6
    -1
      posix/JackPosixThread.cpp
  84. +2
    -1
      posix/JackPosixThread.h
  85. +2
    -2
      posix/JackSocket.cpp
  86. +66
    -8
      posix/JackSocketClientChannel.cpp
  87. +19
    -9
      posix/JackSocketClientChannel.h
  88. +71
    -5
      posix/JackSocketServerChannel.cpp
  89. +4
    -4
      posix/JackSocketServerChannel.h
  90. +2
    -0
      solaris/oss/JackBoomerDriver.cpp
  91. +1
    -4
      solaris/oss/JackBoomerDriver.h
  92. +2
    -2
      solaris/oss/JackOSSDriver.cpp
  93. +26
    -26
      tests/test.cpp
  94. +18
    -8
      windows/JackWinNamedPipeClientChannel.cpp
  95. +11
    -9
      windows/JackWinNamedPipeClientChannel.h
  96. +71
    -14
      windows/JackWinNamedPipeServerChannel.cpp
  97. +7
    -7
      windows/JackWinNamedPipeServerChannel.h
  98. +5
    -0
      windows/JackWinThread.cpp
  99. +12
    -11
      windows/JackWinThread.h
  100. BIN
      windows/Setup/JackRouter.dll

+ 33
- 2
ChangeLog View File

@@ -26,11 +26,42 @@ Josh Green
Mario Lang
Arnold Krille
Jan Engelhardt
Adrian Knoth
Adrian Knoth
David Garcia Garzon
---------------------------
Jackdmp changes log
---------------------------
---------------------------

2010-11-05 Stephane Letz <letz@grame.fr>

* In jackdmp.cpp, jackctl_setup_signals moved before jackctl_server_start.
* Correct symbols export in backends.

2010-11-03 Stephane Letz <letz@grame.fr>

* Improve backend error handling: fatal error returned by Read/Write now cause a Process failure (so a thread exit for blocking backends). Recoverable ones (XRuns..) are now treated internally in ALSA, FreeBob and FFADO backends.

2010-10-30 Stephane Letz <letz@grame.fr>

* Correct JackServer::Open to avoid a race when control API is used on OSX.

2010-10-29 Stephane Letz <letz@grame.fr>

* Correct lsp.c code.
* Add note about unique port-name requirement.

2010-09-08 Stephane Letz <letz@grame.fr>

* Sync JackAlsaDriver::alsa_driver_check_card_type with JACK1 backend.

2010-08-30 Stephane Letz <letz@grame.fr>
* Version 1.9.7 started.

2010-08-25 Stephane Letz <letz@grame.fr>
* In JackCoreAudioDriver, fix an issue when no value is given for input.

2010-08-23 Stephane Letz <letz@grame.fr>


+ 2
- 1
README View File

@@ -214,7 +214,8 @@ Note : To experiment with the -S option, jackdmp must be launched in a console.
1.9.2 : Solaris version. New "profiling" tools. Rework the mutex/signal classes. Support for BIG_ENDIAN machines in NetJack2. D-BUS based device reservation to better coexist with PulseAudio on Linux. Add auto_connect parameter in netmanager and netadapter. Use Torben Hohn PI controler code for adapters. Client incorrect re-naming fixed : now done at socket and fifo level. Virtualize and allow overriding of thread creation function, to allow Wine support (from JACK1).
1.9.3 : New JackBoomerDriver class for Boomer driver on Solaris. Add mixed 32/64 bits mode (off by default). Native MIDI backend (JackCoreMidiDriver, JackWinMMEDriver). In ALSA audio card reservation code, tries to open the card even if reservation fails. Clock source setting on Linux. Add jackctl_server_switch_master API. Fix transport callback (timebase master, sync) issue when used after jack_activate (RT thread was not running). D-Bus access for jackctl_server_add_slave/jackctl_server_remove_slave API. Cleanup "loopback" stuff in server. Torben Hohn fix for InitTime and GetMicroSeconds in JackWinTime.c. New jack_free function added in jack.h. Reworked Torben Hohn fix for server restart issue on Windows. Correct jack_set_error_function, jack_set_info_function and jack_set_thread_creator functions. Correct JackFifo::TimedWait for EINTR handling. Move DBus based audio device reservation code in ALSA backend compilation. Correct JackTransportEngine::MakeAllLocating, sync callback has to be called in this case also. NetJack2 code : better error checkout, method renaming. Tim Bechmann patch : hammerfall, only release monitor thread, if it has been created. Tim Bechmann memops.c optimization patches. In combined --dbus and --classic compilation code, use PulseAudio acquire/release code. Big rewrite of Solaris boomer driver, seems to work in duplex mode at least. Loopback backend reborn as a dynamically loadable separated backend.
1.9.4 : Solaris boomer backend now working in capture or playback only mode. Add a -G parameter in CoreAudio backend (the computation value in RT thread expressed as percent of period). Use SNDCTL_DSP_SYNCGROUP/SNDCTL_DSP_SYNCSTART API to synchronize input and output in Solaris boomer backend. Big endian bug fix in memops.c. Fix issues in JackNetDriver::DecodeTransportData and JackNetDriver::Initialize. Correct CPU timing in JackNetDriver, now take cycle begin time after Read. Simplify transport in NetJack2: master only can control transport. Change CoreAudio notification thread setup for OSX Snow Leopard. Correct server temporary mode : now set a global and quit after server/client message handling is finished. Add a string parameter to server ==> client notification, add a new JackInfoShutdownCallback type. CoreAudio backend now issue a JackInfoShutdownCallback when an unrecoverable error is detected (sampling rate change, stream configuration changeÉ). Correct jackdmp.cpp (failures case were not correct..). Improve JackCoreAudioDriver code. Raise default port number to 2048. Correct JackProcessSync::LockedTimedWait. Correct JACK_MESSAGE_SIZE value, particularly in OSX RPC code. Now start server channel thread only when backend has been started (so in JackServer::Start). Should solve race conditions at start time. jack_verbose moved to JackGlobals class. Improve aggregate device management in JackCoreAudioDriver : now a "private" device only and cleanup properly. Aggregate device code added to JackCoreAudioAdapter. Implement "hog mode" (exclusive access of the audio device) in JackCoreAudioDriver. Fix jack_set_sample_rate_callback to have he same behavior as in JACK1. Dynamic system version detection in JackCoreAudioDriver to either create public or private aggregate device. In JackCoreAudioDriver, force the SR value to the wanted one *before* creating aggregate device (otherwise creation will fail). In JackCoreAudioDriver, better cleanup of AD when intermediate open failure. In JackCoreAudioDriver::Start, wait for the audio driver to effectively start (use the MeasureCallback). In JackCoreAudioDriver, improve management of input/output channels: -1 is now used internally to indicate a wanted max value. In JackCoreAudioDriver::OpenAUHAL, correct stream format setup and cleanup. Correct crash bug in JackAudioAdapterInterface when not input is used in adapter (temporary fixÉ). Sync JackCoreAudioAdapter code on JackCoreAudioDriver one. JACK_SCHED_POLICY switched to SCHED_FIFO. Now can aggregate device that are themselves AD. No reason to make jack_on_shutdown deprecated, so revert the incorrect change. Thread AcquireRealTime and DropRealTime were (incorrectly) using fThread field. Use pthread_self()) (or GetCurrentThread() on Windows) to get the calling thread. Correctly save and restore RT mode state in freewheel mode. Correct freewheel code on client side. Fix AcquireRealTime and DropRealTime: now distinguish when called from another thread (AcquireRealTime/DropRealTime) and from the thread itself (AcquireSelfRealTime/DropSelfRealTime). Correct JackPosixThread::StartImp : thread priority setting now done in the RT case only. Correct JackGraphManager::GetBuffer for the "client loop with one connection" case : buffer must be copied. Correct JackInfoShutdownCallback prototype, two new JackClientProcessFailure and JackClientZombie JackStatus code. Correct JackCoreAudio driver when empty strings are given as -C, -P or -d parameter. Better memory allocation error checking on client (library) side. Better memory allocation error checking in ringbuffer.c, weak import improvements. Memory allocation error checking for jack_client_new and jack_client_open (server and client side). Memory allocation error checking in server for RPC. Simplify server temporary mode : now use a JackTemporaryException. Lock/Unlock shared memory segments (to test...). Sync with JACK1 : -r parameter now used for no-realtime, realtime (-R) is now default, usable backend given vie platform. In JackCoreAudio driver, (possibly) clock drift compensation when needed in aggregated devices. In JackCoreAudio driver, clock drift compensation in aggregated devices working. In JackCoreAudio driver, clock drift compensation semantic changed a bit : when on, does not activate if not needed (same clock domain). Sync JackCoreAudioAdapter code with JackCoreAudioDriver.
1.9.5 : Dynamic choice of maximum port number. More robust sample rate change handling code in JackCoreAudioDriver. Devin Anderson patch for Jack FFADO driver issues with lost MIDI bytes between periods (and more). Fix port_rename callback : now both old name and new name are given as parameters. Special code in JackCoreAudio driver to handle completely buggy Digidesign CoreAudio user-land driver. Ensure that client-side message buffer thread calls thread_init callback if/when it is set by the client (backport of JACK1 rev 3838). Check dynamic port-max value. Fix JackCoreMidiDriver::ReadProcAux when ring buffer is full (thanks Devin Anderson). Josh Green ALSA driver capture only patch. When threads are cancelled, the exception has to be rethrown. Use a QUIT notification to properly quit the server channel, the server channel thread can then be 'stopped' instead of 'canceled'. Mario Lang alsa_io time calculation overflow patch. Shared memory manager was calling abort in case of fatal error, now return an error in caller. Change JackEngineProfiling and JackAudioAdapterInterface gnuplot scripts to output SVG instead of PDF.
1.9.5 : Dynamic choice of maximum port number. More robust sample rate change handling code in JackCoreAudioDriver. Devin Anderson patch for Jack FFADO driver issues with lost MIDI bytes between periods (and more). Fix port_rename callback : now both old name and new name are given as parameters. Special code in JackCoreAudio driver to handle completely buggy Digidesign CoreAudio user-land driver. Ensure that client-side message buffer thread calls thread_init callback if/when it is set by the client (backport of JACK1 rev 3838). Check dynamic port-max value. Fix JackCoreMidiDriver::ReadProcAux when ring buffer is full (thanks Devin Anderson). Josh Green ALSA driver capture only patch. When threads are cancelled, the exception has to be rethrown. Use a QUIT notification to properly quit the server channel, the server channel thread can then be 'stopped' instead of 'canceled'. Mario Lang alsa_io time calculation overflow patch. Shared memory manager was calling abort in case of fatal error, now return an error in caller. Change JackEngineProfiling and JackAudioAdapterInterface gnuplot scripts to output SVG instead of PDF.
1.9.6 : Improve JackCoreAudioDriver and JackCoreAudioAdapter : when no devices are described, takes default input and output and aggregate them.Correct JackGraphManager::DeactivatePort. Correct JackMachServerChannel::Execute : keep running even in error cases. Raise JACK_PROTOCOL_VERSION number. Arnold Krille firewire patch. Raise JACK_DRIVER_PARAM_STRING_MAX and JACK_PARAM_STRING_MAX to 127 otherwise some audio drivers cannot be loaded on OSX. Fix some file header to have library side code use LGPL. On Windows, now use TRE library for regexp (BSD license instead of GPL license). ffado-portname-sync.patch from ticket #163 applied. Remove call to exit in library code. Make jack_connect/jack_disconnect wait for effective port connection/disconnection. Add tests to validate intclient.h API. On Linux, inter-process synchronization primitive switched to POSIX semaphore. In JackCoreAudioDriver, move code called in MeasureCallback to be called once in IO thread. David Garcia Garzon netone patch. Fix from Fernando Lopez-Lezcano for compilation on fc13. Fix JackPosixSemaphore::TimedWait : same behavior as JackPosixSemaphore::Wait regarding EINTR. David Garcia Garzon unused_pkt_buf_field_jack2 netone patch. Arnold Krille firewire snooping patch. Jan Engelhardt patch for get_cycles on SPARC. Adrian Knoth hurd.patch, kfreebsd-fix.patch and alpha_ia64-sigsegv.patch from ticket 177. Adrian Knoth fix for linux cycle.h (ticket 188). In JackCoreAudioDriver, fix an issue when no value is given for input.
This is a work in progress but the implementation is now stable enough to be tested. jackdmp has been used successfully with the following applications : Ardour, Hydrogen, Jamin, Qjackctl, Jack-Rack, SooperLooper, AlsaPlayer...


+ 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);
}

+ 17
- 17
common/JackAudioDriver.cpp View File

@@ -195,7 +195,7 @@ int JackAudioDriver::ProcessNull()
ProcessGraphAsync();
}
// Keep end cycle time
// Keep end cycle time
JackDriver::CycleTakeEndTime();
WaitUntilNextCycle();
return 0;
@@ -215,14 +215,14 @@ int JackAudioDriver::ProcessAsync()
{
// Read input buffers for the current cycle
if (Read() < 0) {
jack_error("JackAudioDriver::ProcessAsync: read error, skip cycle");
return 0; // Skip cycle, but continue processing...
jack_error("JackAudioDriver::ProcessAsync: read error, stopping...");
return -1;
}

// Write output buffers from the previous cycle
if (Write() < 0) {
jack_error("JackAudioDriver::ProcessAsync: write error, skip cycle");
return 0; // Skip cycle, but continue processing...
jack_error("JackAudioDriver::ProcessAsync: write error, stopping...");
return -1;
}

if (fIsMaster) {
@@ -244,9 +244,9 @@ output buffers computed at the *current cycle* are used.
int JackAudioDriver::ProcessSync()
{
// Read input buffers for the current cycle
if (Read() < 0) {
jack_error("JackAudioDriver::ProcessSync: read error, skip cycle");
return 0; // Skip cycle, but continue processing...
if (Read() < 0) {
jack_error("JackAudioDriver::ProcessSync: read error, stopping...");
return -1;
}

if (fIsMaster) {
@@ -255,10 +255,10 @@ int JackAudioDriver::ProcessSync()
fGraphManager->ResumeRefNum(&fClientControl, fSynchroTable);
}
// Write output buffers for the current cycle
if (Write() < 0) {
jack_error("JackAudioDriver::ProcessSync: write error, skip cycle");
return 0; // Skip cycle, but continue processing...
// Write output buffers from the current cycle
if (Write() < 0) {
jack_error("JackAudioDriver::ProcessSync: write error, stopping...");
return -1;
}
// Keep end cycle time
@@ -270,10 +270,10 @@ void JackAudioDriver::ProcessGraphAsync()
{
// fBeginDateUst is set in the "low level" layer, fEndDateUst is from previous cycle
if (!fEngine->Process(fBeginDateUst, fEndDateUst))
jack_error("JackAudioDriver::ProcessAsync Process error");
jack_error("JackAudioDriver::ProcessGraphAsync: Process error");
fGraphManager->ResumeRefNum(&fClientControl, fSynchroTable);
if (ProcessSlaves() < 0)
jack_error("JackAudioDriver::ProcessAsync ProcessSlaves error");
jack_error("JackAudioDriver::ProcessGraphAsync: ProcessSlaves error");
}

void JackAudioDriver::ProcessGraphSync()
@@ -282,11 +282,11 @@ void JackAudioDriver::ProcessGraphSync()
if (fEngine->Process(fBeginDateUst, fEndDateUst)) {
fGraphManager->ResumeRefNum(&fClientControl, fSynchroTable);
if (ProcessSlaves() < 0)
jack_error("JackAudioDriver::ProcessSync ProcessSlaves error, engine may now behave abnormally!!");
jack_error("JackAudioDriver::ProcessGraphSync: ProcessSlaves error, engine may now behave abnormally!!");
if (fGraphManager->SuspendRefNum(&fClientControl, fSynchroTable, DRIVER_TIMEOUT_FACTOR * fEngineControl->fTimeOutUsecs) < 0)
jack_error("JackAudioDriver::ProcessSync SuspendRefNum error, engine may now behave abnormally!!");
jack_error("JackAudioDriver::ProcessGraphSync: SuspendRefNum error, engine may now behave abnormally!!");
} else { // Graph not finished: do not activate it
jack_error("JackAudioDriver::ProcessSync: error");
jack_error("JackAudioDriver::ProcessGraphSync: Process error");
}
}



+ 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;


+ 4
- 1
common/JackConstants.h View File

@@ -24,7 +24,7 @@
#include "config.h"
#endif

#define VERSION "1.9.6"
#define VERSION "1.9.7"

#define BUFFER_SIZE_MAX 8192

@@ -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;


+ 17
- 8
common/JackDriverLoader.cpp View File

@@ -32,7 +32,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

jack_driver_desc_t * jackctl_driver_get_desc(jackctl_driver_t * driver);

SERVER_EXPORT void jack_print_driver_options (jack_driver_desc_t* desc, FILE* file)
EXPORT void jack_print_driver_options (jack_driver_desc_t* desc, FILE* file)
{
unsigned long i;
char arg_default[JACK_DRIVER_PARAM_STRING_MAX + 1];
@@ -75,7 +75,7 @@ jack_print_driver_param_usage (jack_driver_desc_t * desc, unsigned long param, F
fprintf (file, "%s\n", desc->params[param].long_desc);
}

SERVER_EXPORT void jack_free_driver_params(JSList * driver_params)
EXPORT void jack_free_driver_params(JSList * driver_params)
{
JSList *node_ptr = driver_params;
JSList *next_node_ptr;
@@ -228,7 +228,7 @@ jack_parse_driver_params (jack_driver_desc_t * desc, int argc, char* argv[], JSL
return 0;
}

SERVER_EXPORT int
EXPORT int
jackctl_parse_driver_params (jackctl_driver *driver_ptr, int argc, char* argv[])
{
struct option * long_options;
@@ -436,17 +436,17 @@ jack_get_descriptor (JSList * drivers, const char * sofile, const char * symbol)

#ifdef WIN32
if ((so_get_descriptor == NULL) && (dlerr = GetLastError()) != 0) {
jack_log("jack_get_descriptor : dll is not a driver, err = %ld", dlerr);
jack_error("jack_get_descriptor : dll is not a driver, err = %ld", dlerr);
#else
if ((so_get_descriptor == NULL) && (dlerr = dlerror ()) != NULL) {
jack_log("jack_get_descriptor err = %s", dlerr);
jack_error("jack_get_descriptor err = %s", dlerr);
#endif

UnloadDriverModule(dlhandle);
free(filename);
return NULL;
}
if ((descriptor = so_get_descriptor ()) == NULL) {
jack_error("driver from '%s' returned NULL descriptor", filename);
UnloadDriverModule(dlhandle);
@@ -467,7 +467,7 @@ jack_get_descriptor (JSList * drivers, const char * sofile, const char * symbol)
/* check it doesn't exist already */
for (node = drivers; node; node = jack_slist_next (node)) {
other_descriptor = (jack_driver_desc_t *) node->data;
if (strcmp(descriptor->name, other_descriptor->name) == 0) {
jack_error("the drivers in '%s' and '%s' both have the name '%s'; using the first",
other_descriptor->file, filename, other_descriptor->name);
@@ -563,6 +563,8 @@ jack_drivers_load (JSList * drivers) {
desc = jack_get_descriptor (drivers, filedata.cFileName, "driver_get_descriptor");
if (desc) {
driver_list = jack_slist_append (driver_list, desc);
} else {
jack_error ("jack_get_descriptor returns null for \'%s\'", filedata.cFileName);
}

} while (FindNextFile(file, &filedata));
@@ -601,7 +603,7 @@ jack_drivers_load (JSList * drivers) {
}

while ((dir_entry = readdir(dir_stream))) {
/* check the filename is of the right format */
if (strncmp ("jack_", dir_entry->d_name, 5) != 0) {
continue;
@@ -617,8 +619,11 @@ jack_drivers_load (JSList * drivers) {
}

desc = jack_get_descriptor (drivers, dir_entry->d_name, "driver_get_descriptor");
if (desc) {
driver_list = jack_slist_append (driver_list, desc);
} else {
jack_error ("jack_get_descriptor returns null for \'%s\'", dir_entry->d_name);
}
}

@@ -687,6 +692,8 @@ jack_internals_load (JSList * internals) {
desc = jack_get_descriptor (internals, filedata.cFileName, "jack_get_descriptor");
if (desc) {
driver_list = jack_slist_append (driver_list, desc);
} else {
jack_error ("jack_get_descriptor returns null for \'%s\'", filedata.cFileName);
}

} while (FindNextFile(file, &filedata));
@@ -743,6 +750,8 @@ jack_internals_load (JSList * internals) {
desc = jack_get_descriptor (internals, dir_entry->d_name, "jack_get_descriptor");
if (desc) {
driver_list = jack_slist_append (driver_list, desc);
} else {
jack_error ("jack_get_descriptor returns null for \'%s\'", dir_entry->d_name);
}
}



+ 3
- 3
common/JackDriverLoader.h View File

@@ -68,9 +68,9 @@ jack_driver_desc_t * jack_find_driver_descriptor (JSList * drivers, const char *
JSList * jack_drivers_load (JSList * drivers);
JSList * jack_internals_load (JSList * internals);

SERVER_EXPORT int jackctl_parse_driver_params (jackctl_driver * driver_ptr, int argc, char* argv[]);
SERVER_EXPORT void jack_free_driver_params(JSList * param_ptr);
SERVER_EXPORT void jack_print_driver_options(jack_driver_desc_t* desc, FILE* file);
EXPORT int jackctl_parse_driver_params (jackctl_driver * driver_ptr, int argc, char* argv[]);
EXPORT void jack_free_driver_params(JSList * param_ptr);
EXPORT void jack_print_driver_options(jack_driver_desc_t* desc, FILE* file);

#endif


+ 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


+ 26
- 9
common/JackEngine.h View File

@@ -26,6 +26,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#include "JackMutex.h"
#include "JackTransportEngine.h"
#include "JackPlatformPlug.h"
#include <map>

namespace Jack
{
@@ -41,7 +42,7 @@ class JackExternalClient;
class SERVER_EXPORT JackEngine : public JackLockAble
{
friend class JackLockedEngine;
private:

JackGraphManager* fGraphManager;
@@ -52,6 +53,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);

@@ -69,12 +76,15 @@ class SERVER_EXPORT JackEngine : public JackLockAble

void NotifyClient(int refnum, int event, int sync, const char* message, int value1, int value2);
void NotifyClients(int event, int sync, const char* message, int value1, int value2);
void NotifyPortRegistation(jack_port_id_t port_index, bool onoff);
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)
{
return (refnum >= 0 && refnum < CLIENT_NUM && fClientTable[refnum] != NULL);
@@ -87,10 +97,10 @@ class SERVER_EXPORT JackEngine : public JackLockAble

int Open();
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);
@@ -98,10 +108,10 @@ class SERVER_EXPORT JackEngine : public JackLockAble

int ClientActivate(int refnum, bool is_real_time);
int ClientDeactivate(int refnum);
int GetClientPID(const char* name);
int GetClientRefNum(const char* name);
// Internal client management
int GetInternalClientName(int int_ref, char* name_res);
int InternalClientHandle(const char* client_name, int* status, int* int_ref);
@@ -116,7 +126,7 @@ class SERVER_EXPORT JackEngine : public JackLockAble

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

// Graph
@@ -131,6 +141,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);
};




+ 10
- 10
common/JackError.cpp View File

@@ -33,7 +33,7 @@ static bool change_thread_log_function(jack_log_function_t log_function)
&& jack_tls_set(JackGlobals::fKeyLogFunction, (void*)log_function));
}

SERVER_EXPORT int set_threaded_log_function()
EXPORT int set_threaded_log_function()
{
return change_thread_log_function(JackMessageBufferAdd);
}
@@ -88,7 +88,7 @@ static void jack_format_and_log(int level, const char *prefix, const char *fmt,
log_function(level, buffer);
}

SERVER_EXPORT void jack_error(const char *fmt, ...)
EXPORT void jack_error(const char *fmt, ...)
{
va_list ap;
va_start(ap, fmt);
@@ -96,7 +96,7 @@ SERVER_EXPORT void jack_error(const char *fmt, ...)
va_end(ap);
}

SERVER_EXPORT void jack_info(const char *fmt, ...)
EXPORT void jack_info(const char *fmt, ...)
{
va_list ap;
va_start(ap, fmt);
@@ -104,7 +104,7 @@ SERVER_EXPORT void jack_info(const char *fmt, ...)
va_end(ap);
}

SERVER_EXPORT void jack_log(const char *fmt,...)
EXPORT void jack_log(const char *fmt,...)
{
if (JackGlobals::fVerbose) {
va_list ap;
@@ -114,23 +114,23 @@ SERVER_EXPORT void jack_log(const char *fmt,...)
}
}

SERVER_EXPORT void default_jack_error_callback(const char *desc)
EXPORT void default_jack_error_callback(const char *desc)
{
fprintf(stderr, "%s\n", desc);
fflush(stderr);
}

SERVER_EXPORT void default_jack_info_callback(const char *desc)
EXPORT void default_jack_info_callback(const char *desc)
{
fprintf(stdout, "%s\n", desc);
fflush(stdout);
}

SERVER_EXPORT void silent_jack_error_callback(const char *desc)
EXPORT void silent_jack_error_callback(const char *desc)
{}

SERVER_EXPORT void silent_jack_info_callback(const char *desc)
EXPORT void silent_jack_info_callback(const char *desc)
{}

SERVER_EXPORT void (*jack_error_callback)(const char *desc) = &default_jack_error_callback;
SERVER_EXPORT void (*jack_info_callback)(const char *desc) = &default_jack_info_callback;
EXPORT void (*jack_error_callback)(const char *desc) = &default_jack_error_callback;
EXPORT void (*jack_info_callback)(const char *desc) = &default_jack_info_callback;

+ 10
- 10
common/JackError.h View File

@@ -35,27 +35,27 @@ extern "C"
#define LOG_LEVEL_INFO 1
#define LOG_LEVEL_ERROR 2

SERVER_EXPORT void jack_error(const char *fmt, ...);
EXPORT void jack_error(const char *fmt, ...);

SERVER_EXPORT void jack_info(const char *fmt, ...);
EXPORT void jack_info(const char *fmt, ...);

// like jack_info() but only if verbose mode is enabled
SERVER_EXPORT void jack_log(const char *fmt, ...);
EXPORT void jack_log(const char *fmt, ...);

SERVER_EXPORT extern void (*jack_error_callback)(const char *desc);
SERVER_EXPORT extern void (*jack_info_callback)(const char *desc);
EXPORT extern void (*jack_error_callback)(const char *desc);
EXPORT extern void (*jack_info_callback)(const char *desc);
SERVER_EXPORT extern void default_jack_error_callback(const char *desc);
SERVER_EXPORT extern void default_jack_info_callback(const char *desc);
EXPORT extern void default_jack_error_callback(const char *desc);
EXPORT extern void default_jack_info_callback(const char *desc);
SERVER_EXPORT extern void silent_jack_error_callback(const char *desc);
SERVER_EXPORT extern void silent_jack_info_callback(const char *desc);
EXPORT extern void silent_jack_error_callback(const char *desc);
EXPORT extern void silent_jack_info_callback(const char *desc);

typedef void (* jack_log_function_t)(int level, const char *message);

void jack_log_function(int level, const char *message);
SERVER_EXPORT int set_threaded_log_function();
EXPORT int set_threaded_log_function();

#ifdef __cplusplus
}


+ 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()