Browse Source

rebase from trunk 4180:4238

git-svn-id: http://subversion.jackaudio.org/jack/jack2/branches/libjacknet@4239 0c269be4-1314-0410-8aa9-9f06e86f4224
tags/1.9.8
sletz 13 years ago
parent
commit
7254ce1ebc
85 changed files with 5314 additions and 3836 deletions
  1. +29
    -0
      ChangeLog
  2. +31
    -36
      README
  3. +1
    -1
      common/JackAPI.cpp
  4. +5
    -5
      common/JackAudioAdapter.cpp
  5. +12
    -12
      common/JackAudioAdapterInterface.h
  6. +23
    -4
      common/JackAudioDriver.cpp
  7. +3
    -0
      common/JackAudioDriver.h
  8. +17
    -17
      common/JackAudioPort.cpp
  9. +2
    -2
      common/JackClient.cpp
  10. +6
    -6
      common/JackClient.h
  11. +49
    -30
      common/JackControlAPI.cpp
  12. +10
    -2
      common/JackControlAPI.h
  13. +48
    -0
      common/JackDebugClient.cpp
  14. +11
    -1
      common/JackDebugClient.h
  15. +57
    -2
      common/JackDriver.cpp
  16. +5
    -0
      common/JackDriver.h
  17. +17
    -11
      common/JackDriverLoader.cpp
  18. +12
    -21
      common/JackDriverLoader.h
  19. +8
    -9
      common/JackEngine.cpp
  20. +1
    -1
      common/JackGraphManager.cpp
  21. +1
    -1
      common/JackGraphManager.h
  22. +8
    -8
      common/JackInternalClient.cpp
  23. +1
    -1
      common/JackInternalClientChannel.h
  24. +2
    -2
      common/JackLibClient.h
  25. +9
    -9
      common/JackLibGlobals.h
  26. +33
    -33
      common/JackLibSampleRateResampler.cpp
  27. +10
    -8
      common/JackLibSampleRateResampler.h
  28. +6
    -6
      common/JackLoopbackDriver.cpp
  29. +8
    -8
      common/JackMidiDriver.cpp
  30. +2
    -2
      common/JackMidiPort.cpp
  31. +2
    -2
      common/JackMidiPort.h
  32. +29
    -13
      common/JackNetOneDriver.cpp
  33. +1
    -1
      common/JackPort.cpp
  34. +3
    -3
      common/JackPort.h
  35. +18
    -18
      common/JackResampler.cpp
  36. +17
    -16
      common/JackResampler.h
  37. +56
    -37
      common/JackServer.cpp
  38. +7
    -5
      common/JackServer.h
  39. +8
    -8
      common/JackServerAPI.cpp
  40. +140
    -57
      common/JackServerGlobals.cpp
  41. +4
    -0
      common/JackServerGlobals.h
  42. +11
    -6
      common/JackThreadedDriver.cpp
  43. +11
    -10
      common/JackThreadedDriver.h
  44. +39
    -23
      common/JackWeakAPI.cpp
  45. +107
    -70
      common/Jackdmp.cpp
  46. +123
    -95
      common/jack/control.h
  47. +98
    -93
      common/netjack.c
  48. +13
    -13
      common/netjack.h
  49. +98
    -103
      common/netjack_packet.c
  50. +6
    -6
      common/varargs.h
  51. +21
    -2
      dbus/controller.c
  52. +1158
    -406
      doxyfile
  53. +1
    -1
      example-clients/alsa_in.c
  54. +1
    -1
      example-clients/alsa_out.c
  55. +11
    -4
      example-clients/connect.c
  56. +12
    -12
      example-clients/control.c
  57. +104
    -99
      example-clients/netsource.c
  58. +30
    -25
      example-clients/server_control.cpp
  59. +16
    -16
      example-clients/wscript
  60. +14
    -8
      linux/JackLinuxTime.c
  61. +5
    -5
      linux/alsa/JackAlsaAdapter.cpp
  62. +24
    -24
      linux/alsa/JackAlsaAdapter.h
  63. +136
    -2062
      linux/alsa/JackAlsaDriver.cpp
  64. +8
    -79
      linux/alsa/JackAlsaDriver.h
  65. +2172
    -0
      linux/alsa/alsa_driver.c
  66. +120
    -75
      linux/alsa/alsa_driver.h
  67. +18
    -6
      linux/firewire/JackFFADODriver.cpp
  68. +17
    -5
      linux/freebob/JackFreebobDriver.cpp
  69. +3
    -1
      linux/wscript
  70. +2
    -0
      macosx/Jackdmp.xcodeproj/project.pbxproj
  71. +11
    -11
      macosx/coreaudio/JackCoreAudioAdapter.cpp
  72. +48
    -42
      macosx/coreaudio/JackCoreAudioDriver.cpp
  73. +57
    -54
      macosx/coremidi/JackCoreMidiDriver.cpp
  74. +6
    -6
      macosx/coremidi/JackCoreMidiDriver.h
  75. +1
    -1
      posix/JackSocketServerChannel.cpp
  76. +2
    -0
      posix/JackSystemDeps_os.h
  77. +55
    -55
      windows/JackRouter/JackRouter.cpp
  78. +1
    -1
      windows/JackWinNamedPipeServerChannel.cpp
  79. +5
    -5
      windows/JackWinProcessSync.cpp
  80. BIN
      windows/Setup/JackRouter.dll
  81. +1
    -1
      windows/portaudio/JackPortAudioAdapter.cpp
  82. +19
    -8
      windows/portaudio/JackPortAudioDriver.cpp
  83. +2
    -2
      windows/portaudio/JackPortAudioDriver.h
  84. +4
    -1
      windows/winmme/JackWinMMEDriver.cpp
  85. +11
    -1
      wscript

+ 29
- 0
ChangeLog View File

@@ -34,9 +34,38 @@ Valerio Pilo
Jackdmp changes log
---------------------------

2011-03-29 Stephane Letz <letz@grame.fr>

* Synchronize JackWeakAPI.cpp with new APIs.

2011-03-28 Stephane Letz <letz@grame.fr>

* Correction of jack_connect/jack_disconnect: use of jack_activate and volatile keyword for thread shared variable.
* Correction of JackNetOneDriver for latest CELT API.

2011-03-24 Stephane Letz <letz@grame.fr>

* Implement renaming in JackDriver::Open to avoid name collision (thanks Devin Anderson).
* Correct alsa_driver_restart (thanks Devin Anderson).

2011-03-23 Stephane Letz <letz@grame.fr>

* Devin Anderson server-ctl-proposal branch merged on trunk: improved control API, slave backend reworked.

2011-03-14 Stephane Letz <letz@grame.fr>

* Correct JackEngine::NotifyGraphReorder, update JackDebugClient with latest API.

2011-03-13 Stephane Letz <letz@grame.fr>

* Rework internal slave driver management, JackServerGlobals now handle same parameters as jackdmp.

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

* Correct JackNetMaster::SetBufferSize.
* Use jack_default_audio_sample_t instead of float consistently, fix ticket #201."
* -X now allows to add several slave backends, add -I to load several internal clients.


2011-03-10 Stephane Letz <letz@grame.fr>



+ 31
- 36
README View File

@@ -1,14 +1,14 @@
-----------------------------------------------
jackdmp for Linux, MacOSX, Windows and Solaris
-----------------------------------------------
-----------------------------------------------------------
jackdmp (aka JACK2) for Linux, MacOSX, Windows and Solaris
-----------------------------------------------------------
jackdmp is a C++ version of the JACK low-latency audio server for multi-processor machines. It is a new implementation of the JACK server core features that aims in removing some limitations of the current design. The activation system has been changed for a data flow model and lock-free programming techniques for graph access have been used to have a more dynamic and robust system.
jackdmp is a C++ version of the JACK low-latency audio server for multi-processor machines. It is a new implementation of the JACK server core features that aims in removing some limitations of the JACK1 design. The activation system has been changed for a data flow model and lock-free programming techniques for graph access have been used to have a more dynamic and robust system.
- jackdmp use a new client activation model that allows simultaneous client execution (on a smp machine) when parallel clients exist in the graph (client that have the same inputs). This activation model allows to better use available CPU on a smp machine, but also works on mono-processor machine.
- jackdmp use a lock-free way to access (read/write) the client graph, thus allowing connections/disconnection to be done without interrupting the audio stream. The result is that connections/disconnections are glitch-free.
- jackdmp can work in 2 different mode at the server level :
- jackdmp can work in 2 different modes at the server level :
- synchronous activation : in a given cycle, the server waits for all clients to be finished (similar to normal jackd)
@@ -20,7 +20,7 @@ The audible result of this mode is that if a client is not activated during one
Linux version
--------------
The published version still uses fifos for server/client synchronization. The use of POSIX named semaphore is implemented but still a bit unstable. Sockets are used for server/client communications. The ALSA backend derived from jackd implementation is used. To build jackdmp, a "waf" (http://code.google.com/p/waf/) based compilation system is available. The code has to be compiled on a machine where ALSA and possibly frebob (FFADO) headers and libraries are corrected installed.
The published version still uses fifos for server/client synchronization. The use of POSIX named semaphore is implemented but still a bit unstable. Sockets are used for server/client communications. The ALSA backend derived from jackd implementation is used. To build jackdmp, a "waf" (http://code.google.com/p/waf/) based compilation system is available. The code has to be compiled on a machine where ALSA and possibly freeboot (FFADO) headers and libraries are corrected installed.

In the top folder do :
@@ -54,7 +54,7 @@ In the top folder do :
./waf build
sudo ./waf install

(Note : you may have to use "pfexec" instead of "sudo" on systems where sudo is not there.)
(Note : you may have to use "pfexec" instead of "sudo" on systems where sudo is not there).
Various compilation options can be seen using ./waf --help.
@@ -68,43 +68,37 @@ Starting the server :

- for best performances, the server has to be started with privileges that allows to use "real-time" threads, for example using the "pfexec" command (or configurating the system with "priocntl" first), for instance : pfexec jackd -R -S -P59 -d oss

- audio cards info can be retrieved using "ossinfo" tool (for instance ossinfo -v3). Some card needs to be configurated first using "ossxmix" then the correct buffer size has to be used, for instance : pfexec jackd -R -S -P59 -d oss -p 512
- audio cards info can be retrieved using "ossinfo" tool (for instance ossinfo -v3). Some card needs to be configured first using "ossxmix" then the correct buffer size has to be used, for instance : pfexec jackd -R -S -P59 -d oss -p 512
------------
OSX version
------------
The published version uses Mach semaphores for server/client synchronization. MIG generated Remote Procedure Calls (RPC) are used for server/client communications. The CoreAudio backend derived from jackd implementation is used.
The package contains :
- the compiled binaries with "install" and "remove" scripts located in bin/osx
- the source code with an XCode project
- the component needed to use CoreAudio applications with JACK (the JackRouter JACK/CoreAudio bridge)
The published version uses Mach semaphores for server/client synchronization. Sockets are used for server/client communications. The CoreAudio backend derived from JACK1 implementation is used.

Starting with 0.70 version, the OSX project can compile 32/64 bits binaries for PPC and Intel machines. On a 64 bits machine, using the "jackdmp" in a terminal will start the 64 bits version. Using the "arch" command possibly allows to force starting in 32 bits (see man arch). The JackPilot and JackRouter binaries are now also released as 32/64 bits versions for PPC and Intel machines. By default the JackPilot application will start in 32 bits mode (even on a 64 bits machine) and launch the 32 bits jackdmp. Unchecking the "Launch in 32 bits mode" box in the JackPilot info (GetInfo = %I in the Finder...) allows to start JackPilot in 64 bits then launch the 64 bits jackdmp version. Very few audio applications are already 64 bits aware: Apple AU Lab (included in Developer tools) can be launched in 64 bit, here again by unchecking the "Launch in 32 bits mode" box in the AU Lab info.
WARNING !! WARNING !!
Users of the "official" JackOSX package (found at www.jackosx.com) MUST uninstall JackOSX (using the script located in /Applications/Jack) before installing and testing jackdmp. The "official" JackOSX package can then be re-installed by using the JackOSX installer again.
JackOSX package (found at www.jackosx.com) is the preferred way to Jackdmp on OSX.
---------------------------------
Mac Intel special considerations
---------------------------------
- New Mac Intel use 2 different coreaudio device for input/output. Jackdmp cannot directly handle 2 devices to do duplex processing. An "aggregate" device has to be built in this case.
- New Mac Intel use 2 different CoreAudio device for input/output. Jackdmp cannot directly handle 2 devices to do duplex processing. An "aggregate" device has to be built in this case.
Use the "/Applications/Utilities/Audio MIDI Setup" tool to build and aggregate device that combine both input and output in a single duplex device, then select it when launching jackdmp, with something like :
jackdmp -R -d coreaudio -n "~:Aggregate:0"
or directly with the JackPilot tool.
or directly with the JackPilot tool.

Starting from 1.9.6 version, the CoreAudio diver can now dynamically aggregate devices. So using "Audio MIDI Setup" tool is not mandatory anymore.
- CoreAudio applications running under Rosetta emulator cannot access an Intel version of Jackdmp.
Using Jackdmp with Qjackctl :
Using jackdmp with QjackCtl :

To start jackdmp server in Qjackctl, the complete server path has to be added, like /usr/local/bin/jackdmp in Setup/Server Path.
To start jackdmp server in QjackCtl, the complete server path has to be added, like /usr/local/bin/jackdmp in Setup/Server Path.
----------------
Windows version
@@ -124,7 +118,9 @@ The binary elements are :

- jack_dummy.dll : the "dummy" driver.

- jack_net.dll : the NetJack driver.
- jack_net.dll : the NetJack2 driver.

- jack_netone.dll : the NetJack1 driver.

- netmanager.dll : the "in server" client NetJack Manager.

@@ -132,13 +128,13 @@ The binary elements are :

- netadapter.dll : the network to audio card adapter (to be used on a slave machine started with an audio driver).
- jack_connect.exe, jack_disconnect.exe, jack_lsp.exe, jack_metro.exe, jack_load.exe, jack_unload.exe tools.
- jack_connect.exe, jack_disconnect.exe, jack_lsp.exe, jack_metro.exe, jack_load.exe, jack_unload.exe, jack_netsource.exe tools.
- JackRouter.dll : an ASIO/JACK driver that allows ASIO compatible applications to become JACK clients and access the JACK server. ASIO "jackified" applications appear with their names. Ableton Live, Samplitude, Reason, Arturia applications have been successfully tested. To install it, use "regsvr32 JackRouter.dll" in a terminal (use regsvr32 /u JackRouter.dll to uninstall). [VISTA special note: regsvr32 has to be used with "administrator" priviledges to properly register JackRouter.dll (Start Menu -> All Programs -> Accessories -> Right Click on Command Prompt -> Run As Administrator)]. A JackRouter.ini file is used by the driver to read parameters : an [IO] section allows to setup the number of input/output jack ports for the application and a [AUTO_CONNECT] section allows to setup jack ports autoconnection mode to machine input/output.
- JackRouter.dll : an ASIO/JACK driver that allows ASIO compatible applications to become JACK clients and access the JACK server. ASIO "jackified" applications appear with their names. Ableton Live, Samplitude, Reason, Arturia applications have been successfully tested. To install it, use "regsvr32 JackRouter.dll" in a terminal (use regsvr32 /u JackRouter.dll to uninstall). [VISTA special note: regsvr32 has to be used with "administrator" rights to properly register JackRouter.dll (Start Menu -> All Programs -> Accessories -> Right Click on Command Prompt -> Run As Administrator)]. A JackRouter.ini file is used by the driver to read parameters : an [IO] section allows to setup the number of input/output jack ports for the application and a [AUTO_CONNECT] section allows to setup jack ports auto connection mode to machine input/output.
WARNING !! WARNING !!
Depending of the used interface and driver settings, the PortAudio layer may add additionnal buffering between the real card interrupt and the jack server callback. This usually result in *unregular* calls of the jack server callback (for example if jack server used a 256 frames buffer and the card used a 512 frames, the jack server callback will be called twice every card interrupt). For proper functionning of jack server and clients in this case, the jack server has to be started in "synchronous" mode, using the "-S" parameter.
Depending of the used interface and driver settings, the PortAudio layer may add additional buffering between the real card interrupt and the jack server callback. This usually result in *unregular* calls of the jack server callback (for example if jack server used a 256 frames buffer and the card used a 512 frames, the jack server callback will be called twice every card interrupt). For proper functioning of jack server and clients in this case, the jack server has to be started in "synchronous" mode, using the "-S" parameter.
----------------------------
Known problems, limitations
@@ -150,7 +146,7 @@ Known problems, limitations
Automatic server launch
----------------------------

Starting from the 0.64 version, automatic server launch from client is implemented : when the server is not yet running, and if the client uses the "jack_client_open" API, the server will be started automatically. The server configuration is saved in a ".jackdrc" file located in the user home folder. The Qjackctl tool allows to save its configuration in this . jackdrc (setting can be done in Qjackctl Setup/Misc). If no configuration file is found, a default setup will be used.
Starting from the 0.64 version, automatic server launch from client is implemented : when the server is not yet running, QjackCtl if the client uses the "jack_client_open" API, the server will be started automatically. The server configuration is saved in a ".jackdrc" file located in the user home folder. The QjackCtl tool allows to save its configuration in this .jackdrc (setting can be done in QjackCtl Setup/Misc). If no configuration file is found, a default setup will be used.

WARNING : automatic server launch is not implemented on Windows
@@ -158,7 +154,7 @@ WARNING : automatic server launch is not implemented on Windows
Validations tools
------------------
jackdmp can possibly validate client applications by checking they are using the API in a correct manner (calling functions in the right order, correctly desallocating ressources....) and produce a log file. A JACK_CLIENT_DEBUG environment variable must be used to activate client validation : use "export JACK_CLIENT_DEBUG=on".
jackdmp can possibly validate client applications by checking they are using the API in a correct manner (calling functions in the right order, correctly deallocating resources....) and produce a log file. A JACK_CLIENT_DEBUG environment variable must be used to activate client validation : use "export JACK_CLIENT_DEBUG=on".
--------------
Documentation
@@ -182,7 +178,7 @@ Note : To experiment with the -S option, jackdmp must be launched in a console.
0.42 : Patch from Nick Mainsbridge. Correct default mode for ALSA driver. Correct XCode project.
0.43 : Correct freewheel mode. Optimize ALSA and coreaudio drivers. Correct OSX installation script.
0.44 : Patch from Dmitry Daikov : use clock_gettime by default for timing. Correct dirty buffer issue in CoreAudio driver. Updated doc.
0.45 : Script to remove the OSX binary stuff. Correct an export symbol issue that was preventing Qjacktcl to work on OSX. Fix the consequences of the asynchronous semantic of connections/disconnections.
0.45 : Script to remove the OSX binary stuff. Correct an export symbol issue that was preventing QjackCtl to work on OSX. Fix the consequences of the asynchronous semantic of connections/disconnections.
0.46 : Fix a bug in loop management. Fix a bug in driver loading/unloading code. Internal code cleanup for better 64 bits architecture support. Compilation on OSX/Intel. Add the -d option for coreaudio driver (display CoreAudio devices internal name).
0.47 : More fix for 64 bits compilation. Correct ALSA driver. Create a specific folder for jackdmp drivers. Use /dev/shm as default for fifo and sockets. "Install" and "Remove" script for smoother use with regular jack.
0.48 : Finish software monitoring implementation for ALSA and CoreAudio drivers. Simpler shared library management on OSX.
@@ -199,25 +195,26 @@ Note : To experiment with the -S option, jackdmp must be launched in a console.
0.59 : Various fixes in Windows version. Signal handling in the Windows server. Improved JackRouter ASIO/Jack bridge on Windows. Rename global "verbose" in "jack_verbose" to avoid symbol clash with PureData. Add a new cpu testing/loading client. Correct server SetBufferSize in case of failure. Correct PortAudio driver help. Use -D to setup ADDON_DIR on OSX and Linux. Synchronize ALSA backend with jack one.
0.60 : Improve audio driver synchronous code to better handle possible time-out cases. Correct JackWinEnvent::Allocate (handle the ERROR_ALREADY_EXISTS case). Correct JackEngine::ClientExternalNew.
0.61 : Tom Szilagyi memory leak fix in ringbuffer.c. Move client refnum management in JackEngine. Shared_ports renamed to shared_graph. Add call to the init callback (set up using the jack_set_thread_init_callback API) in Real-Time and Notification threads. Define a new 'kActivateClient' notification. New server/client data transfer model to fix a 64 bits system bug. Fix a device name reversal bug in ALSA driver. Implement thread.h API.
0.62 : More client debug code : check if the client is still valid in every JackDebugClient method, check if the library context is still valid in every API call. Uses a time out value of 10 sec in freewheel mode (like jack). More robust activation/deactivation code, especially in case of client crash. New LockAllMemory and UnlockAllMemory functions. Use pthread_attr_setstacksize in JackPosixThread class. Add Pieter Palmers FreeBob driver. Thibault LeMeur ALSA driver patch. Thom Johansen fix for port buffer alignment issues. Better error checking in PortAudio driver.
0.62 : More client debug code : check if the client is still valid in every JackDebugClient method, check if the library context is still valid in every API call. Uses a time out value of 10 sec in freewheel mode (like jack). More robust activation/deactivation code, especially in case of client crash. New LockAllMemory and UnlockAllMemory functions. Use pthread_attr_setstacksize in JackPosixThread class. Add Pieter Palmers FreeBob driver. Thibault LeMeur ALSA driver patch. Thom Johansen fix for port buffer alignment issues. Better error checking in PortAudio driver.
0.63 : Correct back JackAlsaDriver::Read method. Dmitry Baikov patch for JackGraphManager.cpp. Merge JackGraphManager Remove and Release method in a unique Release method. Dmitry Baikov jackmp-time patch : add jack_get_time, jack_time_to_frames, jack_frames_to_time. Add missing -D__SMP__in OSX project. Add new jack_port_set_alias, jack_port_unset_alias and jack_port_get_aliases API. Steven Chamberlain patch to fix jack_port_by_id export. Steven Chamberlain patch to fix jack_port_type. Test for jack_port_type behaviour in jack_test.cpp tool. Add jack_set_client_registration_callback API. Add "callback exiting" and "jack_frame_time" tests in jack_test.
0.64 : Checking in the server to avoid calling the clients if no callback are registered. Correct deprecated jack_set_sample_rate_callback to return 0 instead of -1. Dmitry Baikov buffer size patch. Correct notification for kActivateClient event. Correct JackEngine::ClientCloseAux (when called from JackEngine::ClientExternalOpen). Correct JackWinEvent::Allocate. Automatic client renaming. Add "systemic" latencies management in CoreAudio driver. Automatic server launch. Removes unneeded 'volatile' for JackTransportEngine::fWriteCounter.
0.65 : Fix backend port alias management (renaming in system:xxx). Fix a bug in JackLibClient::Open introduced when adding automatic client renaming. Fix a bug in jack_test. Correct JackShmMem destructor. Correct end case in JackClient::Execute. Correct JackMachSemaphore::Disconnect. Implement server temporary (-T) mode. Make "Rename" a method of JackPort class, call it from driver Attach method. Server/library protocol checking implementation.
0.66 : Internal cleanup. Windows JackRouter.dll version 0.16 : use of "jack_client_open" API to allow automatic client renaming, better Windows VISTA support, new JackRouter.ini file.
0.67 : Correct jack_client_open "status" management. Rename server_name from "default" to "jackdmp_default" to avoid conflict with regular jackd server. Fix a resource leak issue in JackCoreAudioDriver::Close(). Better implement "jack_client_open" when linking a client with the server library. Correct "jack_register_server" in shm.c. Add missing timestamps.c and timestamps.h files. Correctly export public headers in OSX frameworks. Suppress JackEngine::ClientInternalCloseIm method. Use .jackdrc file (instead of .jackdmprc). Install script now creates a link "jackd ==> jackdmp" so that automatic launch can work correctly. Paul Davis patch for -r (--replace-registry) feature. Internal loadable client implementation. Fix JackEngine::Close() method. Windows JackRouter.dll version 0.17: 32 integer sample format.
0.68 : Internal loadable client implementation, winpipe version added. Reorganize jack headers. Improve Linux install/remove scripts. Use LIB_DIR variable for 64 bits related compilation (drivers location). More generic Linux script. Correct jack_acquire_real_time_scheduling on OSX. Merge of Dmitry Baikov MIDI branch. Correct JackGraphManager::GetPortsAux to use port type. Remove JackEngineTiming class: code moved in JackEngineControl. Add midiseq and midisine examples. Cleanup old zombification code. Linux Makefile now install jack headers. Use of JACK_CLIENT_DEBUG environment variable to activate debug client mode. Definition of JACK_LOCATION variable using -D in the Makefile. Restore jack 0.103.0 MIDI API version. Fix a bug in freewheel management in async mode: drivers now receive the kStartFreewheelCallback and kStopFreewheelCallback notifications. Server and user directory related code moved in a JackTools file. Client name rewritting to remove path characters (used in fifo naming). Correct ALSA driver Attach method: internal driver may have changed the buffer_size and sample_rate values. Add JackWinSemaphore class. Add an implementation for obsolete jack_internal_client_new and jack_internal_client_close. Add missing jack_port_type_size. Use of JackWinSemaphore instead of JackWinEvent for inter-process synchronization. Correct types.h for use with MINGW on Windows. Move OSX start/stop notification mechanism in Jackdmp.cpp. Correct CheckPort in JackAPI.cpp.
0.68 : Internal loadable client implementation, winpipe version added. Reorganize jack headers. Improve Linux install/remove scripts. Use LIB_DIR variable for 64 bits related compilation (drivers location). More generic Linux script. Correct jack_acquire_real_time_scheduling on OSX. Merge of Dmitry Baikov MIDI branch. Correct JackGraphManager::GetPortsAux to use port type. Remove JackEngineTiming class: code moved in JackEngineControl. Add midiseq and midisine examples. Cleanup old zombification code. Linux Makefile now install jack headers. Use of JACK_CLIENT_DEBUG environment variable to activate debug client mode. Definition of JACK_LOCATION variable using -D in the Makefile. Restore jack 0.103.0 MIDI API version. Fix a bug in freewheel management in async mode: drivers now receive the kStartFreewheelCallback and kStopFreewheelCallback notifications. Server and user directory related code moved in a JackTools file. Client name rewriting to remove path characters (used in fifo naming). Correct ALSA driver Attach method: internal driver may have changed the buffer_size and sample_rate values. Add JackWinSemaphore class. Add an implementation for obsolete jack_internal_client_new and jack_internal_client_close. Add missing jack_port_type_size. Use of JackWinSemaphore instead of JackWinEvent for inter-process synchronization. Correct types.h for use with MINGW on Windows. Move OSX start/stop notification mechanism in Jackdmp.cpp. Correct CheckPort in JackAPI.cpp.
0.69 : On OSX, use CFNotificationCenterPostNotificationWithOptions with kCFNotificationDeliverImmediately | kCFNotificationPostToAllSessions for server ==> JackRouter plugin notification. On OSX, use jack server name in notification system. Correct fPeriodUsecs computation in JackAudioDriver::SetBufferSize and JackAudioDriver::SetSampleRate. Correct JackMachNotifyChannel::ClientNotify. Correct bug in CoreAudio driver sample rate management. Add a sample_rate change listener in CoreAudio driver. Correct sample_rate management in JackCoreAudioDriver::Open. Better handling in sample_rate change listener. Pieter Palmers FFADO driver and scons based build. Pieter Palmers second new build system: scons and Makefile based build. Tim Blechmann scons patch. Change string management for proper compilation with gcc 4.2.2. JackLog cleanup. Cleanup in CoreAudio driver. Tim Blechmann patch for JackGraphManager::GetPortsAux memory leak, Tim Blechmann patch for scons install. Dmitry Baikov MIDI patch : alsa_seqmidi and alsa_rammidi drivers. CoreAudio driver improvement : detect and notify abnormal situations (stopped driver in case of SR change...).
0.70 : Updated API to match jack 0.109.0 version. Update in usx2y.c and JackPort.cpp to match jackd 0.109.2. Latest jack_lsp code from jack SVN. Add jack_mp_thread_wait client example. Add jack_thread_wait client example. Remove checking thread in CoreAudio driver, better device state change recovery strategy: the driver is stopped and restarted. Move transport related methods from JackEngine to JackServer. Tim Blechmann sse optimization patch for JackaudioPort::MixAudioBuffer, use of Apple Accelerate framework on OSX. Remove use of assert in JackFifo, JackMachSemaphore, and JackPosixSemaphore: print an error instead. Correct "server_connect": close the communication channel. More robust external API. Use SetAlias for port naming. Use jackd midi port naming scheme. Notify ports unregistration in JackEngine::ClientCloseAux. Fix in JackClient::Error(): when RT thread is failing and calling Shutdown, Shutdown was not desactivating the client correctly.
0.71 : Add port register/unregister notification in JackAlsaDriver. Correct JACK_port_unregister in MIDI backend. Add TimeCallback in JackDebugClient class. Correct jack_get_time propotype. Correct JackSocketClientChannel::ClientClose to use ServerSyncCall instead of ServerAsyncCall. Better documentation in jack.h. libjackdmp.so renamed to libjackservermp.so and same for OSX framework. Define an internal jack_client_open_aux needed for library wrapper feature. Remove unneeded jack_port_connect API. Correct jack_port_get_connections function (should return NULL when no connections). In thread model, execute a dummy cycle to be sure thread has the correct properties (ensure thread creation is finished). Fix engine real-time notification (was broken since ??). Implements wrapper layer. Correct jack_port_get_total_latency. Correct all backend playback port latency in case of "asynchronous" mode (1 buffer more). Add test for jack_cycle_wait, jack_cycle_wait and jack_set_process_thread API. RT scheduling for OSX thread (when used in dummy driver). Add -L (extra output latency in aynchronous mode) in CoreAudio driver. New JackLockedEngine decorator class to serialize access from ALSA Midi thread, command thread and in-server clients. Use engine in JackAlsaDriver::port_register and JackAlsaDriver::port_unregister. Fix connect notification to deliver *one* notification only. Correct JackClient::Activate so that first kGraphOrderCallback can be received by the client notification thread. New jack_server_control client to test notifications when linked to the server library. Synchronise transport.h with latest jackd version (Video handling). Transport timebase fix. Dmitry Baikov patch for alsa_rawmidi driver. Pieter Palmers patch for FFADO driver. Add an Init method for blocking drivers to be decorated using JackThreadedDriver class. Correct PortRegister, port name checking must be done on server side. Correct a missing parameter in the usage message of jack_midiseq. New SetNonBlocking method for JackSocket. Correct a dirty port array issue in JackGraphManager::GetPortsAux.
1.9.0 : Waf based build system : Nedko Arnaudov, Grame for preliminary OSX support. Control API, dbus based server control access : Nedko Arnaudov, Grame. NetJack2 components (in progress) : jack_net backend, netmanager, audioadapter, netadapter : Romain Moret, Grame. Code restructuring to help port on other architectures : Michael Voigt. Code cleanup/optimization : Tim Blechmann. Improve handling of server internal clients that can now be loaded/unloaded using the new server control API : Grame. A lot of bug fix and improvements.
1.9.1 : Fix jackctl_server_unload_internal. Filter SIGPIPE to avoid having client get a SIGPIPE when trying to access a died server. Libjack shutdown handler does not "deactivate" (fActive = false) the client anymore, so that jack_deactivate correctly does the job later on. Better isolation of server and clients system resources to allow starting the server in several user account at the same time. Report ringbuffer.c fixes from jack1. Client and library global context cleanup in case of incorrect shutdown handling (that is applications not correctly closing client after server has shutdown). Use JACK_DRIVER_DIR variable in internal clients loader. For ALSA driver, synchronize with latest jack1 memops functions. Synchronize jack2 public headers with jack1 ones. Implement jack_client_real_time_priority and jack_client_max_real_time_priority API. Use up to BUFFER_SIZE_MAX frames in midi ports, fix for ticket #117. Cleanup server starting code for clients directly linked with libjackserver.so. JackMessageBuffer was using thread "Stop" scheme in destructor, now use the safer thread "Kill" way. Synchronize ALSA backend code with JACK1 one. Set default mode to 'slow' in JackNetDriver and JackNetAdapter. Simplify audio packet order verification. Fix JackNetInterface::SetNetBufferSize for socket buffer size computation and JackNetMasterInterface::DataRecv if synch packet is received, various cleanup. Better recovery of network overload situations, now "resynchronize" by skipping cycles.". Support for BIG_ENDIAN machines in NetJack2. Support for BIG_ENDIAN machines in NetJack2 for MIDI ports. Support for "-h" option in internal clients to print the parameters. In NetJack2, fix a bug when capture or playback only channels are used. Add a JACK_INTERNAL_DIR environment variable to be used for internal clients. Add a resample quality parameter in audioadapter. Now correctly return an error if JackServer::SetBufferSize could not change the buffer size (and was just restoring the current one). Use PRIu32 kind of macro in JackAlsaDriver again. Add a resample quality parameter in netadapter.
1.9.1 : Fix jackctl_server_unload_internal. Filter SIGPIPE to avoid having client get a SIGPIPE when trying to access a died server. Libjack shutdown handler does not "deactivate" (fActive = false) the client anymore, so that jack_deactivate correctly does the job later on. Better isolation of server and clients system resources to allow starting the server in several user account at the same time. Report ringbuffer.c fixes from JACK1. Client and library global context cleanup in case of incorrect shutdown handling (that is applications not correctly closing client after server has shutdown). Use JACK_DRIVER_DIR variable in internal clients loader. For ALSA driver, synchronize with latest JACK1 memops functions. Synchronize JACK2 public headers with JACK1 ones. Implement jack_client_real_time_priority and jack_client_max_real_time_priority API. Use up to BUFFER_SIZE_MAX frames in midi ports, fix for ticket #117. Cleanup server starting code for clients directly linked with libjackserver.so. JackMessageBuffer was using thread "Stop" scheme in destructor, now use the safer thread "Kill" way. Synchronize ALSA backend code with JACK1 one. Set default mode to 'slow' in JackNetDriver and JackNetAdapter. Simplify audio packet order verification. Fix JackNetInterface::SetNetBufferSize for socket buffer size computation and JackNetMasterInterface::DataRecv if synch packet is received, various cleanup. Better recovery of network overload situations, now "resynchronize" by skipping cycles.". Support for BIG_ENDIAN machines in NetJack2. Support for BIG_ENDIAN machines in NetJack2 for MIDI ports. Support for "-h" option in internal clients to print the parameters. In NetJack2, fix a bug when capture or playback only channels are used. Add a JACK_INTERNAL_DIR environment variable to be used for internal clients. Add a resample quality parameter in audioadapter. Now correctly return an error if JackServer::SetBufferSize could not change the buffer size (and was just restoring the current one). Use PRIu32 kind of macro in JackAlsaDriver again. Add a resample quality parameter in netadapter.
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.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.
1.9.7 : Sync JackAlsaDriver::alsa_driver_check_card_type with JACK1 backend. Correct JackServer::Open to avoid a race when control API is used on OSX. 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. In jackdmp.cpp, jackctl_setup_signals moved before jackctl_server_start. Correct symbols export in backends on OSX. ALSA backend : suspend/resume handling. Correct dummy driver. Adrian Knoth jack_lsp patch. Remove JackPortIsActive flag. New latency API implementation. ComputeTotalLatencies now a client/server call. Add latent test client for latency API. Also print playback and capture latency in jack_lsp. jack_client_has_session_callback implementation. Check requested buffer size and limit to 1..8192 - avoids weird behaviour caused by jack_bufsize foobar. jack_port_type_get_buffer_size implementation. Stop using alloca and allocate buffer on the heap for alsa_io. Rename jdelay to jack_iodelay as per Fons' request. Call buffer size callback in activate (actually this is done on client side in the RT thread Init method). Add jack_midi_dump client. Synchronize net JACK1 with JACK1 version. Synchronize jack_connect/jack_disconnect with JACK1 version. Correct JackNetMaster::SetBufferSize. Use jack_default_audio_sample_t instead of float consistently, fix ticket #201. -X now allows to add several slave backends, add -I to load several internal clients. Rework internal slave driver management, JackServerGlobals now handle same parameters as jackdmp. Correct JackEngine::NotifyGraphReorder, update JackDebugClient with latest API. Devin Anderson server-ctl-proposal branch merged on trunk: improved control API, slave backend reworked. Implement renaming in JackDriver::Open to avoid name collision (thanks Devin Anderson). Correct alsa_driver_restart (thanks Devin Anderson). Correction of jack_connect/jack_disconnect: use of jack_activate and volatile keyword for thread shared variable. Correction of JackNetOneDriver for latest CELT API. Synchronize JackWeakAPI.cpp with new APIs.
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...
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...
------------------------------------
General known problems, limitations
@@ -225,9 +222,7 @@ General known problems, limitations
- zombification of clients is not implemented
- the number of server audio ports is fixed
- memory locking is not implemented
- memory locking is implemented for shared data only
The package is available at http://www.grame.fr/~letz/jackdmp.html


+ 1
- 1
common/JackAPI.cpp View File

@@ -116,7 +116,7 @@ extern "C"
EXPORT int jack_set_xrun_callback(jack_client_t *,
JackXRunCallback xrun_callback, void *arg);
EXPORT int jack_set_latency_callback(jack_client_t *client,
JackLatencyCallback callback, void *arg);
JackLatencyCallback latency_callback, void *arg);

EXPORT int jack_activate(jack_client_t *client);
EXPORT int jack_deactivate(jack_client_t *client);


+ 5
- 5
common/JackAudioAdapter.cpp View File

@@ -36,17 +36,17 @@ namespace Jack
int JackAudioAdapter::Process (jack_nframes_t frames, void* arg)
{
JackAudioAdapter* adapter = static_cast<JackAudioAdapter*>(arg);
float* inputBuffer[adapter->fAudioAdapter->GetInputs()];
float* outputBuffer[adapter->fAudioAdapter->GetOutputs()];
jack_default_audio_sample_t* inputBuffer[adapter->fAudioAdapter->GetInputs()];
jack_default_audio_sample_t* outputBuffer[adapter->fAudioAdapter->GetOutputs()];

// Always clear output
for (int i = 0; i < adapter->fAudioAdapter->GetInputs(); i++) {
inputBuffer[i] = (float*)jack_port_get_buffer(adapter->fCapturePortList[i], frames);
memset(inputBuffer[i], 0, frames * sizeof(float));
inputBuffer[i] = (jack_default_audio_sample_t*)jack_port_get_buffer(adapter->fCapturePortList[i], frames);
memset(inputBuffer[i], 0, frames * sizeof(jack_default_audio_sample_t));
}

for (int i = 0; i < adapter->fAudioAdapter->GetOutputs(); i++) {
outputBuffer[i] = (float*)jack_port_get_buffer(adapter->fPlaybackPortList[i], frames);
outputBuffer[i] = (jack_default_audio_sample_t*)jack_port_get_buffer(adapter->fPlaybackPortList[i], frames);
}

adapter->fAudioAdapter->PullAndPush(inputBuffer, outputBuffer, frames);


+ 12
- 12
common/JackAudioAdapterInterface.h View File

@@ -88,18 +88,18 @@ namespace Jack

JackResampler** fCaptureRingBuffer;
JackResampler** fPlaybackRingBuffer;
unsigned int fQuality;
unsigned int fRingbufferCurSize;
jack_time_t fPullAndPushTime;
bool fRunning;
bool fAdaptative;
void ResetRingBuffers();
void AdaptRingBufferSize();
void GrowRingBufferSize();
public:

JackAudioAdapterInterface ( jack_nframes_t buffer_size, jack_nframes_t sample_rate, jack_nframes_t ring_buffer_size = DEFAULT_ADAPTATIVE_SIZE):
@@ -140,15 +140,15 @@ namespace Jack
{}

virtual void Reset();
virtual void Create();
virtual void Destroy();
virtual int Open()
{
return 0;
}
virtual int Close()
{
return 0;
@@ -157,7 +157,7 @@ namespace Jack
virtual int SetHostBufferSize ( jack_nframes_t buffer_size )
{
fHostBufferSize = buffer_size;
if (fAdaptative)
if (fAdaptative)
AdaptRingBufferSize();
return 0;
}
@@ -165,7 +165,7 @@ namespace Jack
virtual int SetAdaptedBufferSize ( jack_nframes_t buffer_size )
{
fAdaptedBufferSize = buffer_size;
if (fAdaptative)
if (fAdaptative)
AdaptRingBufferSize();
return 0;
}
@@ -197,7 +197,7 @@ namespace Jack
SetAdaptedSampleRate ( sample_rate );
return 0;
}
void SetInputs ( int inputs )
{
jack_log ( "JackAudioAdapterInterface::SetInputs %d", inputs );
@@ -222,8 +222,8 @@ namespace Jack
return fPlaybackChannels;
}
int PushAndPull(float** inputBuffer, float** outputBuffer, unsigned int frames);
int PullAndPush(float** inputBuffer, float** outputBuffer, unsigned int frames);
int PushAndPull(jack_default_audio_sample_t** inputBuffer, jack_default_audio_sample_t** outputBuffer, unsigned int frames);
int PullAndPush(jack_default_audio_sample_t** inputBuffer, jack_default_audio_sample_t** outputBuffer, unsigned int frames);
};



+ 23
- 4
common/JackAudioDriver.cpp View File

@@ -138,14 +138,13 @@ int JackAudioDriver::Attach()

// Monitor ports
if (fWithMonitorPorts) {
jack_log("Create monitor port ");
jack_log("Create monitor port");
snprintf(name, sizeof(name) - 1, "%s:monitor_%u", fClientControl.fName, i + 1);
if ((port_index = fGraphManager->AllocatePort(fClientControl.fRefNum, name, JACK_DEFAULT_AUDIO_TYPE, JackPortIsOutput, fEngineControl->fBufferSize)) == NO_PORT) {
jack_error("Cannot register monitor port for %s", name);
return -1;
} else {
port = fGraphManager->GetPort(port_index);
port->SetAlias(alias);
range.min = range.max = fEngineControl->fBufferSize;
port->SetLatencyRange(JackCaptureLatency, &range);
fMonitorPortList[i] = port_index;
@@ -178,8 +177,8 @@ int JackAudioDriver::Write()
{
for (int i = 0; i < fPlaybackChannels; i++) {
if (fGraphManager->GetConnectionsNum(fPlaybackPortList[i]) > 0) {
float* buffer = GetOutputBuffer(i);
int size = sizeof(float) * fEngineControl->fBufferSize;
jack_default_audio_sample_t* buffer = GetOutputBuffer(i);
int size = sizeof(jack_default_audio_sample_t) * fEngineControl->fBufferSize;
// Monitor ports
if (fWithMonitorPorts && fGraphManager->GetConnectionsNum(fMonitorPortList[i]) > 0)
memcpy(GetMonitorBuffer(i), buffer, size);
@@ -313,6 +312,26 @@ int JackAudioDriver::ProcessGraphSync()
return res;
}

int JackAudioDriver::Start()
{
int res = JackDriver::Start();
if ((res >= 0) && fIsMaster) {
res = StartSlaves();
}
return res;
}

int JackAudioDriver::Stop()
{
int res = JackDriver::Stop();
if (fIsMaster) {
if (StopSlaves() < 0) {
res = -1;
}
}
return res;
}

void JackAudioDriver::WaitUntilNextCycle()
{
int wait_time_usec = (int((float(fEngineControl->fBufferSize) / (float(fEngineControl->fSampleRate))) * 1000000.0f));


+ 3
- 0
common/JackAudioDriver.h View File

@@ -92,6 +92,9 @@ class SERVER_EXPORT JackAudioDriver : public JackDriver
virtual int Attach();
virtual int Detach();

virtual int Start();
virtual int Stop();

virtual int Write();

virtual int SetBufferSize(jack_nframes_t buffer_size);


+ 17
- 17
common/JackAudioPort.cpp View File

@@ -38,11 +38,11 @@ static void AudioBufferInit(void* buffer, size_t buffer_size, jack_nframes_t)
memset(buffer, 0, buffer_size);
}

static inline void MixAudioBuffer(float* mixbuffer, float* buffer, jack_nframes_t frames)
static inline void MixAudioBuffer(jack_default_audio_sample_t* mixbuffer, jack_default_audio_sample_t* buffer, jack_nframes_t frames)
{
#ifdef __APPLE__
// It seems that a vector mult only operation does not exist...
float gain = 1.0f;
jack_default_audio_sample_t gain = jack_default_audio_sample_t(1.0);
vDSP_vsma(buffer, 1, &gain, mixbuffer, 1, mixbuffer, 1, frames);
#else
jack_nframes_t frames_group = frames / 4;
@@ -57,14 +57,14 @@ static inline void MixAudioBuffer(float* mixbuffer, float* buffer, jack_nframes_
buffer += 4;
frames_group--;
#else
register float mixFloat1 = *mixbuffer;
register float sourceFloat1 = *buffer;
register float mixFloat2 = *(mixbuffer + 1);
register float sourceFloat2 = *(buffer + 1);
register float mixFloat3 = *(mixbuffer + 2);
register float sourceFloat3 = *(buffer + 2);
register float mixFloat4 = *(mixbuffer + 3);
register float sourceFloat4 = *(buffer + 3);
register jack_default_audio_sample_t mixFloat1 = *mixbuffer;
register jack_default_audio_sample_t sourceFloat1 = *buffer;
register jack_default_audio_sample_t mixFloat2 = *(mixbuffer + 1);
register jack_default_audio_sample_t sourceFloat2 = *(buffer + 1);
register jack_default_audio_sample_t mixFloat3 = *(mixbuffer + 2);
register jack_default_audio_sample_t sourceFloat3 = *(buffer + 2);
register jack_default_audio_sample_t mixFloat4 = *(mixbuffer + 3);
register jack_default_audio_sample_t sourceFloat4 = *(buffer + 3);

buffer += 4;
frames_group--;
@@ -84,8 +84,8 @@ static inline void MixAudioBuffer(float* mixbuffer, float* buffer, jack_nframes_
}

while (frames > 0) {
register float mixFloat1 = *mixbuffer;
register float sourceFloat1 = *buffer;
register jack_default_audio_sample_t mixFloat1 = *mixbuffer;
register jack_default_audio_sample_t sourceFloat1 = *buffer;
buffer++;
frames--;
mixFloat1 += sourceFloat1;
@@ -104,8 +104,8 @@ static void AudioBufferMixdown(void* mixbuffer, void** src_buffers, int src_coun
jack_nframes_t frames_group = nframes / 4;
jack_nframes_t remaining_frames = nframes % 4;

float * source = static_cast<float*>(src_buffers[0]);
float * target = static_cast<float*>(mixbuffer);
jack_default_audio_sample_t * source = static_cast<jack_default_audio_sample_t*>(src_buffers[0]);
jack_default_audio_sample_t * target = static_cast<jack_default_audio_sample_t*>(mixbuffer);

while (frames_group > 0)
{
@@ -120,19 +120,19 @@ static void AudioBufferMixdown(void* mixbuffer, void** src_buffers, int src_coun
target[i] = source[i];

#else
memcpy(mixbuffer, src_buffers[0], nframes * sizeof(float));
memcpy(mixbuffer, src_buffers[0], nframes * sizeof(jack_default_audio_sample_t));
#endif

// Mix remaining buffers
for (int i = 1; i < src_count; ++i) {
buffer = src_buffers[i];
MixAudioBuffer(static_cast<float*>(mixbuffer), static_cast<float*>(buffer), nframes);
MixAudioBuffer(static_cast<jack_default_audio_sample_t*>(mixbuffer), static_cast<jack_default_audio_sample_t*>(buffer), nframes);
}
}

static size_t AudioBufferSize()
{
return GetEngineControl()->fBufferSize * sizeof(float);
return GetEngineControl()->fBufferSize * sizeof(jack_default_audio_sample_t);
}

const JackPortType gAudioPortType =


+ 2
- 2
common/JackClient.cpp View File

@@ -496,8 +496,8 @@ bool JackClient::Init()

// Setup RT
if (GetEngineControl()->fRealTime) {
if (fThread.AcquireRealTime(GetEngineControl()->fClientPriority) < 0) {
jack_error("JackClient::AcquireRealTime error");
if (fThread.AcquireSelfRealTime(GetEngineControl()->fClientPriority) < 0) {
jack_error("JackClient::AcquireSelfRealTime error");
}
}



+ 6
- 6
common/JackClient.h View File

@@ -44,7 +44,7 @@ struct JackEngineControl;
\brief The base class for clients: share part of the implementation for JackInternalClient and JackLibClient.
*/

class JackClient : public JackClientInterface, public JackRunnableInterface
class SERVER_EXPORT JackClient : public JackClientInterface, public JackRunnableInterface
{
friend class JackDebugClient;

@@ -195,15 +195,15 @@ class JackClient : public JackClientInterface, public JackRunnableInterface
// RT Thread
jack_nframes_t CycleWait();
void CycleSignal(int status);
int SetProcessThread(JackThreadCallback fun, void *arg);
virtual 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* GetClientNameByUUID(const char* uuid);
int ReserveClientName(const char* client_name, const char* uuid);
int ClientHasSessionCallback(const char* client_name);
virtual char* GetUUIDForClientName(const char* client_name);
virtual char* GetClientNameByUUID(const char* uuid);
virtual int ReserveClientName(const char* client_name, const char* uuid);
virtual int ClientHasSessionCallback(const char* client_name);

// JackRunnableInterface interface
bool Init();


+ 49
- 30
common/JackControlAPI.cpp View File

@@ -78,15 +78,15 @@ struct jackctl_server
/* int32_t, msecs; if zero, use period size. */
union jackctl_parameter_value client_timeout;
union jackctl_parameter_value default_client_timeout;
/* uint32_t, clock source type */
union jackctl_parameter_value clock_source;
union jackctl_parameter_value default_clock_source;
/* uint32_t, max port number */
union jackctl_parameter_value port_max;
union jackctl_parameter_value default_port_max;
/* bool */
union jackctl_parameter_value replace_registry;
union jackctl_parameter_value default_replace_registry;
@@ -366,7 +366,7 @@ jackctl_internals_load(
}

while (descriptor_node_ptr != NULL)
{
{
internal_ptr = (struct jackctl_internal *)malloc(sizeof(struct jackctl_internal));
if (internal_ptr == NULL)
{
@@ -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());
}
}
@@ -539,7 +539,7 @@ jackctl_setup_signals(
* explicitly reset it
*/

pthread_sigmask(SIG_BLOCK, &signals, 0);
pthread_sigmask(SIG_BLOCK, &signals, 0);

/* install a do-nothing handler because otherwise pthreads
behaviour is undefined when we enter sigwait.
@@ -745,7 +745,7 @@ EXPORT jackctl_server_t * jackctl_server_create(
{
goto fail_free_parameters;
}
value.ui = PORT_NUM;
if (jackctl_add_parameter(
&server_ptr->parameters,
@@ -795,7 +795,7 @@ EXPORT jackctl_server_t * jackctl_server_create(
{
goto fail_free_parameters;
}
/* Allowed to fail */
jackctl_internals_load(server_ptr);

@@ -826,6 +826,11 @@ EXPORT const JSList * jackctl_server_get_drivers_list(jackctl_server *server_ptr
EXPORT bool jackctl_server_stop(jackctl_server *server_ptr)
{
server_ptr->engine->Stop();
return true;
}

EXPORT bool jackctl_server_close(jackctl_server *server_ptr)
{
server_ptr->engine->Close();
delete server_ptr->engine;

@@ -853,7 +858,7 @@ EXPORT const JSList * jackctl_server_get_parameters(jackctl_server *server_ptr)
}

EXPORT bool
jackctl_server_start(
jackctl_server_open(
jackctl_server *server_ptr,
jackctl_driver *driver_ptr)
{
@@ -882,7 +887,7 @@ jackctl_server_start(

if (!server_ptr->realtime.b && server_ptr->client_timeout.i == 0)
server_ptr->client_timeout.i = 500; /* 0.5 sec; usable when non realtime. */
/* check port max value before allocating server */
if (server_ptr->port_max.ui > PORT_NUM_MAX) {
jack_error("JACK server started with too much ports %d (when port max can be %d)", server_ptr->port_max.ui, PORT_NUM_MAX);
@@ -896,7 +901,7 @@ jackctl_server_start(
server_ptr->client_timeout.i,
server_ptr->realtime.b,
server_ptr->realtime_priority.i,
server_ptr->port_max.ui,
server_ptr->port_max.ui,
server_ptr->verbose.b,
(jack_timer_type_t)server_ptr->clock_source.ui,
server_ptr->name.str);
@@ -913,18 +918,8 @@ jackctl_server_start(
goto fail_delete;
}

rc = server_ptr->engine->Start();
if (rc < 0)
{
jack_error("JackServer::Start() failed with %d", rc);
goto fail_close;
}

return true;

fail_close:
server_ptr->engine->Close();

fail_delete:
delete server_ptr->engine;
server_ptr->engine = NULL;
@@ -946,6 +941,19 @@ fail:
return false;
}

EXPORT bool
jackctl_server_start(
jackctl_server *server_ptr)
{
int rc = server_ptr->engine->Start();
bool result = rc >= 0;
if (! result)
{
jack_error("JackServer::Start() failed with %d", rc);
}
return result;
}

EXPORT const char * jackctl_driver_get_name(jackctl_driver *driver_ptr)
{
return driver_ptr->desc_ptr->name;
@@ -1179,7 +1187,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, -1, &status);
server_ptr->engine->InternalClientLoad2(internal->desc_ptr->name, internal->desc_ptr->name, internal->set_parameters, JackNullOption, &internal->refnum, -1, &status);
return (internal->refnum > 0);
} else {
return false;
@@ -1192,6 +1200,7 @@ EXPORT bool jackctl_server_unload_internal(
{
int status;
if (server_ptr->engine != NULL && internal->refnum > 0) {
// Client object is internally kept in JackEngine, and will be desallocated in InternalClientUnload
return ((server_ptr->engine->GetEngine()->InternalClientUnload(internal->refnum, &status)) == 0);
} else {
return false;
@@ -1201,8 +1210,13 @@ EXPORT bool jackctl_server_unload_internal(
EXPORT bool jackctl_server_add_slave(jackctl_server * server_ptr, jackctl_driver * driver_ptr)
{
if (server_ptr->engine != NULL) {
driver_ptr->info = server_ptr->engine->AddSlave(driver_ptr->desc_ptr, driver_ptr->set_parameters);
return (driver_ptr->info != 0);
if (server_ptr->engine->IsRunning()) {
jack_error("cannot add a slave in a running server");
return false;
} else {
driver_ptr->info = server_ptr->engine->AddSlave(driver_ptr->desc_ptr, driver_ptr->set_parameters);
return (driver_ptr->info != 0);
}
} else {
return false;
}
@@ -1211,9 +1225,14 @@ EXPORT bool jackctl_server_add_slave(jackctl_server * server_ptr, jackctl_driver
EXPORT bool jackctl_server_remove_slave(jackctl_server * server_ptr, jackctl_driver * driver_ptr)
{
if (server_ptr->engine != NULL) {
server_ptr->engine->RemoveSlave(driver_ptr->info);
delete driver_ptr->info;
return true;
if (server_ptr->engine->IsRunning()) {
jack_error("cannot remove a slave from a running server");
return false;
} else {
server_ptr->engine->RemoveSlave(driver_ptr->info);
delete driver_ptr->info;
return true;
}
} else {
return false;
}


+ 10
- 2
common/JackControlAPI.h View File

@@ -101,13 +101,21 @@ jackctl_server_get_drivers_list(
jackctl_server_t * server);

EXPORT bool
jackctl_server_start(
jackctl_server_open(
jackctl_server_t * server,
jackctl_driver_t * driver);

EXPORT bool
jackctl_server_start(
jackctl_server_t * server);

EXPORT bool
jackctl_server_stop(
jackctl_server_t * server);
jackctl_server_t * server);

EXPORT bool
jackctl_server_close(
jackctl_server_t * server);

EXPORT const JSList *
jackctl_server_get_parameters(


+ 48
- 0
common/JackDebugClient.cpp View File

@@ -505,6 +505,54 @@ int JackDebugClient::SetPortRenameCallback(JackPortRenameCallback callback, void
return fClient->SetPortRenameCallback(callback, arg);
}

int JackDebugClient::SetSessionCallback(JackSessionCallback callback, void *arg)
{
CheckClient("SetSessionCallback");
return fClient->SetSessionCallback(callback, arg);
}

int JackDebugClient::SetLatencyCallback(JackLatencyCallback callback, void *arg)
{
CheckClient("SetLatencyCallback");
return fClient->SetLatencyCallback(callback, arg);
}

jack_session_command_t* JackDebugClient::SessionNotify(const char* target, jack_session_event_type_t type, const char* path)
{
CheckClient("SessionNotify");
return fClient->SessionNotify(target, type, path);
}

int JackDebugClient::SessionReply(jack_session_event_t* ev)
{
CheckClient("SessionReply");
return fClient->SessionReply(ev);
}

char* JackDebugClient::GetUUIDForClientName(const char* client_name)
{
CheckClient("GetUUIDForClientName");
return fClient->GetUUIDForClientName(client_name);
}

char* JackDebugClient::GetClientNameByUUID(const char* uuid)
{
CheckClient("GetClientNameByUUID");
return fClient->GetClientNameByUUID(uuid);
}

int JackDebugClient::ReserveClientName(const char* client_name, const char* uuid)
{
CheckClient("ReserveClientName");
return fClient->ReserveClientName(client_name, uuid);
}

int JackDebugClient::ClientHasSessionCallback(const char* client_name)
{
CheckClient("ClientHasSessionCallback");
return fClient->ClientHasSessionCallback(client_name);
}

JackClientControl* JackDebugClient::GetClientControl() const
{
CheckClient("GetClientControl");


+ 11
- 1
common/JackDebugClient.h View File

@@ -46,7 +46,7 @@ PortFollower;
\brief A "decorator" debug client to validate API use.
*/

class JackDebugClient : public JackClient
class SERVER_EXPORT JackDebugClient : public JackClient
{
protected:

@@ -121,6 +121,8 @@ class JackDebugClient : public JackClient
int SetPortRegistrationCallback(JackPortRegistrationCallback callback, void* arg);
int SetPortConnectCallback(JackPortConnectCallback callback, void *arg);
int SetPortRenameCallback(JackPortRenameCallback callback, void *arg);
int SetSessionCallback(JackSessionCallback callback, void *arg);
int SetLatencyCallback(JackLatencyCallback callback, void *arg);

// Internal clients
char* GetInternalClientName(int ref);
@@ -128,6 +130,14 @@ class JackDebugClient : public JackClient
int InternalClientLoad(const char* client_name, jack_options_t options, jack_status_t* status, jack_varargs_t* va);
void InternalClientUnload(int ref, jack_status_t* status);

// Session API
jack_session_command_t* SessionNotify(const char* target, jack_session_event_type_t type, const char* path);
int SessionReply(jack_session_event_t* ev);
char* GetUUIDForClientName(const char* client_name);
char* GetClientNameByUUID(const char* uuid);
int ReserveClientName(const char* client_name, const char* uuid);
int ClientHasSessionCallback(const char* client_name);

JackClientControl* GetClientControl() const;
void CheckClient(const char* function_name) const;



+ 57
- 2
common/JackDriver.cpp View File

@@ -47,6 +47,7 @@ JackDriver::JackDriver(const char* name, const char* alias, JackLockedEngine* en
fBeginDateUst = 0;
fDelayedUsecs = 0.f;
fIsMaster = true;
fIsRunning = false;
}

JackDriver::JackDriver()
@@ -56,6 +57,7 @@ JackDriver::JackDriver()
fGraphManager = NULL;
fBeginDateUst = 0;
fIsMaster = true;
fIsRunning = false;
}

JackDriver::~JackDriver()
@@ -80,7 +82,7 @@ int JackDriver::Open()
return 0;
}

int JackDriver::Open (bool capturing,
int JackDriver::Open(bool capturing,
bool playing,
int inchannels,
int outchannels,
@@ -93,6 +95,15 @@ int JackDriver::Open (bool capturing,
jack_log("JackDriver::Open capture_driver_name = %s", capture_driver_name);
jack_log("JackDriver::Open playback_driver_name = %s", playback_driver_name);
int refnum = -1;
char name_res[JACK_CLIENT_NAME_SIZE + 1];
int status;

// Check name and possibly rename
if (fEngine->ClientCheck(fClientControl.fName, -1, name_res, JACK_PROTOCOL_VERSION, (int)JackNullOption, (int*)&status) < 0) {
jack_error("Client name = %s conflits with another running client", fClientControl.fName);
return -1;
}
strcpy(fClientControl.fName, name_res);

if (fEngine->ClientInternalOpen(fClientControl.fName, &refnum, &fEngineControl, &fGraphManager, this, false) != 0) {
jack_error("Cannot allocate internal client for driver");
@@ -135,6 +146,15 @@ int JackDriver::Open(jack_nframes_t buffer_size,
jack_log("JackDriver::Open capture_driver_name = %s", capture_driver_name);
jack_log("JackDriver::Open playback_driver_name = %s", playback_driver_name);
int refnum = -1;
char name_res[JACK_CLIENT_NAME_SIZE + 1];
int status;

// Check name and possibly rename
if (fEngine->ClientCheck(fClientControl.fName, -1, name_res, JACK_PROTOCOL_VERSION, (int)JackNullOption, (int*)&status) < 0) {
jack_error("Client name = %s conflits with another running client", fClientControl.fName);
return -1;
}
strcpy(fClientControl.fName, name_res);

if (fEngine->ClientInternalOpen(fClientControl.fName, &refnum, &fEngineControl, &fGraphManager, this, false) != 0) {
jack_error("Cannot allocate internal client for driver");
@@ -288,6 +308,7 @@ int JackDriver::ProcessSlaves()
JackDriverInterface* slave = *it;
if (slave->Process() < 0)
res = -1;

}
return res;
}
@@ -324,15 +345,49 @@ int JackDriver::Write()

int JackDriver::Start()
{
fEngineControl->InitFrameTime();
if (fIsMaster) {
fEngineControl->InitFrameTime();
}
fIsRunning = true;
return 0;
}

int JackDriver::StartSlaves()
{
int res = 0;
list<JackDriverInterface*>::const_iterator it;
for (it = fSlaveList.begin(); it != fSlaveList.end(); it++) {
JackDriverInterface* slave = *it;
if (slave->Start() < 0) {
res = -1;

// XXX: We should attempt to stop all of the slaves that we've
// started here.

break;
}
}
return res;
}

int JackDriver::Stop()
{
fIsRunning = false;
return 0;
}

int JackDriver::StopSlaves()
{
int res = 0;
list<JackDriverInterface*>::const_iterator it;
for (it = fSlaveList.begin(); it != fSlaveList.end(); it++) {
JackDriverInterface* slave = *it;
if (slave->Stop() < 0)
res = -1;
}
return res;
}

bool JackDriver::IsFixedBufferSize()
{
return true;


+ 5
- 0
common/JackDriver.h View File

@@ -97,6 +97,7 @@ class SERVER_EXPORT JackDriverInterface
virtual int ProcessSlaves() = 0;

virtual bool IsRealTime() const = 0;
virtual bool IsRunning() const = 0;
};

/*!
@@ -134,6 +135,7 @@ class SERVER_EXPORT JackDriver : public JackDriverClientInterface
JackClientControl fClientControl;
std::list<JackDriverInterface*> fSlaveList;
bool fIsMaster;
bool fIsRunning;

void CycleIncTime();
void CycleTakeBeginTime();
@@ -198,7 +200,9 @@ class SERVER_EXPORT JackDriver : public JackDriverClientInterface
virtual int Write();

virtual int Start();
virtual int StartSlaves();
virtual int Stop();
virtual int StopSlaves();

virtual bool IsFixedBufferSize();
virtual int SetBufferSize(jack_nframes_t buffer_size);
@@ -208,6 +212,7 @@ class SERVER_EXPORT JackDriver : public JackDriverClientInterface
virtual JackClientControl* GetClientControl() const;

virtual bool IsRealTime() const;
virtual bool IsRunning() const { return fIsRunning; }
virtual bool Initialize(); // To be called by the wrapping thread Init method when the driver is a "blocking" one

};


+ 17
- 11
common/JackDriverLoader.cpp View File

@@ -119,7 +119,7 @@ jack_parse_driver_params (jack_driver_desc_t * desc, int argc, char* argv[], JSL
desc->name);
}

printf ("Parameters for driver '%s' (all parameters are optional):\n", desc->name);
jack_log("Parameters for driver '%s' (all parameters are optional):", desc->name);
jack_print_driver_options (desc, stdout);
return 1;
}
@@ -263,7 +263,7 @@ jackctl_parse_driver_params (jackctl_driver *driver_ptr, int argc, char* argv[])
desc->name);
}

printf ("Parameters for driver '%s' (all parameters are optional):\n", desc->name);
jack_log("Parameters for driver '%s' (all parameters are optional):", desc->name);
jack_print_driver_options (desc, stdout);
return 1;
}
@@ -446,7 +446,7 @@ jack_get_descriptor (JSList * drivers, const char * sofile, const char * symbol)
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);
@@ -603,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;
@@ -619,7 +619,7 @@ 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 {
@@ -771,9 +771,9 @@ jack_internals_load (JSList * internals) {

#endif

Jack::JackDriverClientInterface* JackDriverInfo::Open(jack_driver_desc_t* driver_desc,
Jack::JackLockedEngine* engine,
Jack::JackSynchro* synchro,
Jack::JackDriverClientInterface* JackDriverInfo::Open(jack_driver_desc_t* driver_desc,
Jack::JackLockedEngine* engine,
Jack::JackSynchro* synchro,
const JSList* params)
{
#ifdef WIN32
@@ -783,7 +783,7 @@ Jack::JackDriverClientInterface* JackDriverInfo::Open(jack_driver_desc_t* driver
#endif

fHandle = LoadDriverModule (driver_desc->file);
if (fHandle == NULL) {
#ifdef WIN32
if ((errstr = GetLastError ()) != 0) {
@@ -809,8 +809,14 @@ Jack::JackDriverClientInterface* JackDriverInfo::Open(jack_driver_desc_t* driver
jack_error("no initialize function in shared object %s\n", driver_desc->file);
return NULL;
}
fBackend = fInitialize(engine, synchro, params);
return fBackend;
}

JackDriverInfo::~JackDriverInfo()
{
delete fBackend;
if (fHandle)
UnloadDriverModule(fHandle);
}

+ 12
- 21
common/JackDriverLoader.h View File

@@ -24,14 +24,9 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#include "driver_interface.h"
#include "JackControlAPI.h"
#include "JackPlatformPlug.h"
#include "JackDriver.h"
#include "JackSystemDeps.h"

namespace Jack
{
class JackDriverClientInterface;
class JackLockedEngine;
};

typedef jack_driver_desc_t * (*JackDriverDescFunction) ();
typedef Jack::JackDriverClientInterface* (*driverInitialize) (Jack::JackLockedEngine*, Jack::JackSynchro*, const JSList*);

@@ -39,34 +34,30 @@ class JackDriverInfo
{

private:
driverInitialize fInitialize;
DRIVER_HANDLE fHandle;
Jack::JackDriverClientInterface* fBackend;
public:
JackDriverInfo():fInitialize(NULL),fHandle(NULL)
JackDriverInfo():fInitialize(NULL),fHandle(NULL),fBackend(NULL)
{}
~JackDriverInfo()
{
if (fHandle)
UnloadDriverModule(fHandle);
}
~JackDriverInfo();

Jack::JackDriverClientInterface* Open(jack_driver_desc_t* driver_desc, Jack::JackLockedEngine*, Jack::JackSynchro*, const JSList*);

Jack::JackDriverClientInterface* GetBackend()
{
return fBackend;
}
};

jack_driver_desc_t * jack_find_driver_descriptor (JSList * drivers, const char * name);
jack_driver_desc_t * jack_find_driver_descriptor(JSList * drivers, const char * name);

JSList * jack_drivers_load (JSList * drivers);
JSList * jack_internals_load (JSList * internals);
JSList * jack_drivers_load(JSList * drivers);
JSList * jack_internals_load(JSList * internals);

EXPORT int jackctl_parse_driver_params (jackctl_driver * driver_ptr, int argc, char* argv[]);
EXPORT void jack_free_driver_params(JSList * param_ptr);


+ 8
- 9
common/JackEngine.cpp View File

@@ -223,7 +223,6 @@ int JackEngine::ComputeTotalLatencies()
*/

for (it = sorted.begin(); it != sorted.end(); it++) {
jack_log("Sorted %d", *it);
NotifyClient(*it, kLatencyCallback, true, "", 0, 0);
}

@@ -322,8 +321,8 @@ void JackEngine::NotifyXRun(int refnum)

void JackEngine::NotifyGraphReorder()
{
ComputeTotalLatencies();
NotifyClients(kGraphOrderCallback, false, "", 0, 0);
ComputeTotalLatencies();
}

void JackEngine::NotifyBufferSize(jack_nframes_t buffer_size)
@@ -520,7 +519,7 @@ void JackEngine::EnsureUUID(int uuid)

for (int i = 0; i < CLIENT_NUM; i++) {
JackClientInterface* client = fClientTable[i];
if (client && (client->GetClientControl()->fSessionID==uuid)) {
if (client && (client->GetClientControl()->fSessionID == uuid)) {
client->GetClientControl()->fSessionID = GetNewUUID();
}
}
@@ -551,13 +550,13 @@ int JackEngine::GetClientRefNum(const char* name)
// Used for external clients
int JackEngine::ClientExternalOpen(const char* name, int pid, int uuid, int* ref, int* shared_engine, int* shared_client, int* shared_graph_manager)
{
char real_name[JACK_CLIENT_NAME_SIZE+1];
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);
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);
@@ -568,7 +567,7 @@ int JackEngine::ClientExternalOpen(const char* name, int pid, int uuid, int* ref
EnsureUUID(uuid);
}

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

int refnum = AllocateRefnum();
if (refnum < 0) {
@@ -762,7 +761,7 @@ int JackEngine::ClientDeactivate(int refnum)
fGraphManager->GetInputPorts(refnum, input_ports);
fGraphManager->GetOutputPorts(refnum, output_ports);

// First disconnect all ports and remove their JackPortIsActive state
// First disconnect all ports
for (int i = 0; (i < PORT_NUM_FOR_CLIENT) && (input_ports[i] != EMPTY); i++) {
PortDisconnect(refnum, input_ports[i], ALL_PORTS);
}
@@ -959,7 +958,7 @@ void JackEngine::SessionNotify(int refnum, const char *target, jack_session_even
if (client && client->GetClientControl()->fCallback[kSessionCallback]) {

// check if this is a notification to a specific client.
if (target!=NULL && strlen(target)!=0) {
if (target != NULL && strlen(target) != 0) {
if (strcmp(target, client->GetClientControl()->fName)) {
continue;
}
@@ -1019,7 +1018,7 @@ void JackEngine::GetUUIDForClientName(const char *client_name, char *uuid_res, i
for (int i = 0; i < CLIENT_NUM; i++) {
JackClientInterface* client = fClientTable[i];

if (client && (strcmp(client_name, client->GetClientControl()->fName)==0)) {
if (client && (strcmp(client_name, client->GetClientControl()->fName) == 0)) {
snprintf(uuid_res, JACK_UUID_SIZE, "%d", client->GetClientControl()->fSessionID);
*result = 0;
return;


+ 1
- 1
common/JackGraphManager.cpp View File

@@ -77,7 +77,7 @@ JackPort* JackGraphManager::GetPort(jack_port_id_t port_index)
return &fPortArray[port_index];
}

float* JackGraphManager::GetBuffer(jack_port_id_t port_index)
jack_default_audio_sample_t* JackGraphManager::GetBuffer(jack_port_id_t port_index)
{
return fPortArray[port_index].GetBuffer();
}


+ 1
- 1
common/JackGraphManager.h View File

@@ -49,7 +49,7 @@ class SERVER_EXPORT JackGraphManager : public JackShmMem, public JackAtomicState
jack_port_id_t AllocatePortAux(int refnum, const char* port_name, const char* port_type, JackPortFlags flags);
void GetConnectionsAux(JackConnectionManager* manager, const char** res, jack_port_id_t port_index);
void GetPortsAux(const char** matching_ports, const char* port_name_pattern, const char* type_name_pattern, unsigned long flags);
float* GetBuffer(jack_port_id_t port_index);
jack_default_audio_sample_t* GetBuffer(jack_port_id_t port_index);
void* GetBufferAux(JackConnectionManager* manager, jack_port_id_t port_index, jack_nframes_t frames);
jack_nframes_t ComputeTotalLatencyAux(jack_port_id_t port_index, jack_port_id_t src_port_index, JackConnectionManager* manager, int hop_count);
void RecalculateLatencyAux(jack_port_id_t port_index, jack_latency_callback_mode_t mode);


+ 8
- 8
common/JackInternalClient.cpp View File

@@ -123,7 +123,7 @@ int JackLoadableInternalClient::Init(const char* so_name)
{
char path_to_so[JACK_PATH_MAX + 1];
BuildClientPath(path_to_so, sizeof(path_to_so), so_name);
fHandle = LoadJackModule(path_to_so);
jack_log("JackLoadableInternalClient::JackLoadableInternalClient path_to_so = %s", path_to_so);

@@ -151,7 +151,7 @@ int JackLoadableInternalClient1::Init(const char* so_name)
if (JackLoadableInternalClient::Init(so_name) < 0) {
return -1;
}
fInitialize = (InitializeCallback)GetJackProc(fHandle, "jack_initialize");
if (fInitialize == NULL) {
UnloadJackModule(fHandle);
@@ -167,7 +167,7 @@ int JackLoadableInternalClient2::Init(const char* so_name)
if (JackLoadableInternalClient::Init(so_name) < 0) {
return -1;
}
fInitialize = (InternalInitializeCallback)GetJackProc(fHandle, "jack_internal_initialize");
if (fInitialize == NULL) {
UnloadJackModule(fHandle);
@@ -181,7 +181,7 @@ int JackLoadableInternalClient2::Init(const char* so_name)
JackLoadableInternalClient1::JackLoadableInternalClient1(JackServer* server, JackSynchro* table, const char* object_data)
: JackLoadableInternalClient(server, table)
{
strncpy(fObjectData, object_data, JACK_LOAD_INIT_LIMIT);
strncpy(fObjectData, object_data, JACK_LOAD_INIT_LIMIT);
}

JackLoadableInternalClient2::JackLoadableInternalClient2(JackServer* server, JackSynchro* table, const JSList* parameters)
@@ -201,7 +201,7 @@ JackLoadableInternalClient::~JackLoadableInternalClient()
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, uuid, options, status) == 0) {
if (fInitialize((jack_client_t*)this, fObjectData) == 0) {
res = 0;
@@ -210,14 +210,14 @@ int JackLoadableInternalClient1::Open(const char* server_name, const char* name,
fFinish = NULL;
}
}
return res;
}

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, uuid, options, status) == 0) {
if (fInitialize((jack_client_t*)this, fParameters) == 0) {
res = 0;
@@ -226,7 +226,7 @@ int JackLoadableInternalClient2::Open(const char* server_name, const char* name,
fFinish = NULL;
}
}
return res;
}



+ 1
- 1
common/JackInternalClientChannel.h View File

@@ -136,7 +136,7 @@ class JackInternalClientChannel : public detail::JackClientChannelInterface

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, uuid, status);
*result = fServer->InternalClientLoad1(client_name, so_name, objet_data, options, int_ref, uuid, status);
}

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


+ 2
- 2
common/JackLibClient.h View File

@@ -12,7 +12,7 @@ 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
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

*/
@@ -32,7 +32,7 @@ namespace Jack
\brief Client on the library side.
*/

class JackLibClient : public JackClient
class SERVER_EXPORT JackLibClient : public JackClient
{

private:


+ 9
- 9
common/JackLibGlobals.h View File

@@ -12,7 +12,7 @@ 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
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

*/
@@ -31,7 +31,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "JackError.h"
#include <assert.h>
#include <signal.h>

namespace Jack
{
@@ -42,13 +42,13 @@ class JackClient;
\brief Global library static structure: singleton kind of pattern.
*/

struct JackLibGlobals
struct SERVER_EXPORT JackLibGlobals
{
JackShmReadWritePtr<JackGraphManager> fGraphManager; /*! Shared memory Port manager */
JackShmReadWritePtr<JackEngineControl> fEngineControl; /*! Shared engine control */ // transport engine has to be writable
JackSynchro fSynchroTable[CLIENT_NUM]; /*! Shared synchro table */
sigset_t fProcessSignals;
static int fClientCount;
static JackLibGlobals* fGlobals;

@@ -67,7 +67,7 @@ struct JackLibGlobals
sigemptyset(&signals);
sigaddset(&signals, SIGPIPE);
sigprocmask(SIG_BLOCK, &signals, &fProcessSignals);
#endif
#endif
}

~JackLibGlobals()
@@ -83,13 +83,13 @@ struct JackLibGlobals
// TODO
#else
sigprocmask(SIG_BLOCK, &fProcessSignals, 0);
#endif
#endif
}

static void Init()
{
if (!JackGlobals::fServerRunning && fClientCount > 0) {
// Cleanup remaining clients
jack_error("Jack server was closed but clients are still allocated, cleanup...");
for (int i = 0; i < CLIENT_NUM; i++) {
@@ -101,13 +101,13 @@ struct JackLibGlobals
JackGlobals::fClientTable[CLIENT_NUM] = NULL;
}
}
// Cleanup global context
fClientCount = 0;
delete fGlobals;
fGlobals = NULL;
}
if (fClientCount++ == 0 && !fGlobals) {
jack_log("JackLibGlobals Init %x", fGlobals);
InitTime();


+ 33
- 33
common/JackLibSampleRateResampler.cpp View File

@@ -27,7 +27,7 @@ JackLibSampleRateResampler::JackLibSampleRateResampler()
{
int error;
fResampler = src_new(SRC_LINEAR, 1, &error);
if (error != 0)
if (error != 0)
jack_error("JackLibSampleRateResampler::JackLibSampleRateResampler err = %s", src_strerror(error));
}

@@ -50,7 +50,7 @@ JackLibSampleRateResampler::JackLibSampleRateResampler(unsigned int quality)
case 4:
quality = SRC_SINC_BEST_QUALITY;
break;
default:
default:
quality = SRC_LINEAR;
jack_error("Out of range resample quality");
break;
@@ -58,7 +58,7 @@ JackLibSampleRateResampler::JackLibSampleRateResampler(unsigned int quality)

int error;
fResampler = src_new(quality, 1, &error);
if (error != 0)
if (error != 0)
jack_error("JackLibSampleRateResampler::JackLibSampleRateResampler err = %s", src_strerror(error));
}

@@ -73,103 +73,103 @@ void JackLibSampleRateResampler::Reset(unsigned int new_size)
src_reset(fResampler);
}

unsigned int JackLibSampleRateResampler::ReadResample(float* buffer, unsigned int frames)
unsigned int JackLibSampleRateResampler::ReadResample(jack_default_audio_sample_t* buffer, unsigned int frames)
{
jack_ringbuffer_data_t ring_buffer_data[2];
SRC_DATA src_data;
unsigned int frames_to_write = frames;
unsigned int written_frames = 0;
int res;
jack_ringbuffer_get_read_vector(fRingBuffer, ring_buffer_data);
unsigned int available_frames = (ring_buffer_data[0].len + ring_buffer_data[1].len) / sizeof(float);
unsigned int available_frames = (ring_buffer_data[0].len + ring_buffer_data[1].len) / sizeof(jack_default_audio_sample_t);
jack_log("Output available = %ld", available_frames);
for (int j = 0; j < 2; j++) {
if (ring_buffer_data[j].len > 0) {
src_data.data_in = (float*)ring_buffer_data[j].buf;
src_data.data_in = (jack_default_audio_sample_t*)ring_buffer_data[j].buf;
src_data.data_out = &buffer[written_frames];
src_data.input_frames = ring_buffer_data[j].len / sizeof(float);
src_data.input_frames = ring_buffer_data[j].len / sizeof(jack_default_audio_sample_t);
src_data.output_frames = frames_to_write;
src_data.end_of_input = 0;
src_data.src_ratio = fRatio;
res = src_process(fResampler, &src_data);
if (res != 0) {
jack_error("JackLibSampleRateResampler::ReadResample ratio = %f err = %s", fRatio, src_strerror(res));
return 0;
}
frames_to_write -= src_data.output_frames_gen;
written_frames += src_data.output_frames_gen;
if ((src_data.input_frames_used == 0 || src_data.output_frames_gen == 0) && j == 0) {
jack_log("Output : j = %d input_frames_used = %ld output_frames_gen = %ld frames1 = %lu frames2 = %lu"
, j, src_data.input_frames_used, src_data.output_frames_gen, ring_buffer_data[0].len, ring_buffer_data[1].len);
}
jack_log("Output : j = %d input_frames_used = %ld output_frames_gen = %ld", j, src_data.input_frames_used, src_data.output_frames_gen);
jack_ringbuffer_read_advance(fRingBuffer, src_data.input_frames_used * sizeof(float));
jack_ringbuffer_read_advance(fRingBuffer, src_data.input_frames_used * sizeof(jack_default_audio_sample_t));
}
}
if (written_frames < frames) {
jack_error("Output available = %ld", available_frames);
jack_error("JackLibSampleRateResampler::ReadResample error written_frames = %ld", written_frames);
}
return written_frames;
}

unsigned int JackLibSampleRateResampler::WriteResample(float* buffer, unsigned int frames)
unsigned int JackLibSampleRateResampler::WriteResample(jack_default_audio_sample_t* buffer, unsigned int frames)
{
jack_ringbuffer_data_t ring_buffer_data[2];
SRC_DATA src_data;
unsigned int frames_to_read = frames;
unsigned int read_frames = 0;
int res;
jack_ringbuffer_get_write_vector(fRingBuffer, ring_buffer_data);
unsigned int available_frames = (ring_buffer_data[0].len + ring_buffer_data[1].len) / sizeof(float);
unsigned int available_frames = (ring_buffer_data[0].len + ring_buffer_data[1].len) / sizeof(jack_default_audio_sample_t);
jack_log("Input available = %ld", available_frames);
for (int j = 0; j < 2; j++) {
if (ring_buffer_data[j].len > 0) {
src_data.data_in = &buffer[read_frames];
src_data.data_out = (float*)ring_buffer_data[j].buf;
src_data.data_out = (jack_default_audio_sample_t*)ring_buffer_data[j].buf;
src_data.input_frames = frames_to_read;
src_data.output_frames = (ring_buffer_data[j].len / sizeof(float));
src_data.output_frames = (ring_buffer_data[j].len / sizeof(jack_default_audio_sample_t));
src_data.end_of_input = 0;
src_data.src_ratio = fRatio;
res = src_process(fResampler, &src_data);
if (res != 0) {
jack_error("JackLibSampleRateResampler::ReadResample ratio = %f err = %s", fRatio, src_strerror(res));
return 0;
}
frames_to_read -= src_data.input_frames_used;
read_frames += src_data.input_frames_used;
if ((src_data.input_frames_used == 0 || src_data.output_frames_gen == 0) && j == 0) {
jack_log("Input : j = %d input_frames_used = %ld output_frames_gen = %ld frames1 = %lu frames2 = %lu"
, j, src_data.input_frames_used, src_data.output_frames_gen, ring_buffer_data[0].len, ring_buffer_data[1].len);
}
jack_log("Input : j = %d input_frames_used = %ld output_frames_gen = %ld", j, src_data.input_frames_used, src_data.output_frames_gen);
jack_ringbuffer_write_advance(fRingBuffer, src_data.output_frames_gen * sizeof(float));
jack_ringbuffer_write_advance(fRingBuffer, src_data.output_frames_gen * sizeof(jack_default_audio_sample_t));
}
}
if (read_frames < frames) {
jack_error("Input available = %ld", available_frames);
jack_error("JackLibSampleRateResampler::ReadResample error read_frames = %ld", read_frames);
}
return read_frames;
}



+ 10
- 8
common/JackLibSampleRateResampler.h View File

@@ -21,6 +21,8 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#define __JackLibSampleRateResampler__

#include "JackResampler.h"
#include "types.h"

#include <samplerate.h>

namespace Jack
@@ -34,20 +36,20 @@ class JackLibSampleRateResampler : public JackResampler
{

private:
SRC_STATE* fResampler;
public:
JackLibSampleRateResampler();
JackLibSampleRateResampler(unsigned int quality);
virtual ~JackLibSampleRateResampler();
unsigned int ReadResample(float* buffer, unsigned int frames);
unsigned int WriteResample(float* buffer, unsigned int frames);
unsigned int ReadResample(jack_default_audio_sample_t* buffer, unsigned int frames);
unsigned int WriteResample(jack_default_audio_sample_t* buffer, unsigned int frames);
void Reset(unsigned int new_size);
};
}



+ 6
- 6
common/JackLoopbackDriver.cpp View File

@@ -34,7 +34,7 @@ int JackLoopbackDriver::Process()
{
// Loopback copy
for (int i = 0; i < fCaptureChannels; i++) {
memcpy(GetInputBuffer(i), GetOutputBuffer(i), sizeof(float) * fEngineControl->fBufferSize);
memcpy(GetInputBuffer(i), GetOutputBuffer(i), sizeof(jack_default_audio_sample_t) * fEngineControl->fBufferSize);
}

fGraphManager->ResumeRefNum(&fClientControl, fSynchroTable); // Signal all clients
@@ -54,7 +54,7 @@ extern "C"
{
#endif

SERVER_EXPORT jack_driver_desc_t * driver_get_descriptor()
SERVER_EXPORT jack_driver_desc_t * driver_get_descriptor()
{
jack_driver_desc_t * desc;
unsigned int i;
@@ -65,7 +65,7 @@ extern "C"

desc->nparams = 1;
desc->params = (jack_driver_param_desc_t*)calloc (desc->nparams, sizeof (jack_driver_param_desc_t));
i = 0;
strcpy(desc->params[i].name, "channels");
desc->params[i].character = 'c';
@@ -77,12 +77,12 @@ extern "C"
return desc;
}

SERVER_EXPORT Jack::JackDriverClientInterface* driver_initialize(Jack::JackLockedEngine* engine, Jack::JackSynchro* table, const JSList* params)
SERVER_EXPORT Jack::JackDriverClientInterface* driver_initialize(Jack::JackLockedEngine* engine, Jack::JackSynchro* table, const JSList* params)
{
const JSList * node;
const jack_driver_param_t * param;
int channels = 2;
for (node = params; node; node = jack_slist_next (node)) {
param = (const jack_driver_param_t *) node->data;

@@ -93,7 +93,7 @@ extern "C"
break;
}
}
Jack::JackDriverClientInterface* driver = new Jack::JackLoopbackDriver(engine, table);
if (driver->Open(1, 1, channels, channels, false, "loopback", "loopback", 0, 0) == 0) {
return driver;


+ 8
- 8
common/JackMidiDriver.cpp View File

@@ -60,11 +60,11 @@ int JackMidiDriver::Open(bool capturing,
{
fCaptureChannels = inchannels;
fPlaybackChannels = outchannels;
for (int i = 0; i < fCaptureChannels; i++) {
fRingBuffer[i] = jack_ringbuffer_create(sizeof(float) * BUFFER_SIZE_MAX);
fRingBuffer[i] = jack_ringbuffer_create(sizeof(jack_default_audio_sample_t) * BUFFER_SIZE_MAX);
}
return JackDriver::Open(capturing, playing, inchannels, outchannels, monitor, capture_driver_name, playback_driver_name, capture_latency, playback_latency);
}

@@ -141,11 +141,11 @@ int JackMidiDriver::ProcessNull()
int JackMidiDriver::Process()
{
// Read input buffers for the current cycle
if (Read() < 0) {
if (Read() < 0) {
jack_error("JackMidiDriver::Process: read error, skip cycle");