2
Darwin/MacOSX port for Jack : architecture changes in the implementation
3
========================================================================
9
gcc 2.95.x or 3.x, the standard OSX 10.3 gcc-3.3 compiler works fine
10
MacOSX10.3 SDK package
17
libtool >= 1.5 (to build from CVS)
18
pkg-config >= 0.15.0 (to build from CVS)
19
doxygen (to build documentation)
20
libsndfile >= 1.0.0 (for some example-clients)
21
GNU readline (for some example-clients)
23
All non-Apple tools are available from `fink' or `darwinports'.
25
Since fink is not well-integrated with OS X, you must define a bunch
26
of environment variables...
28
export ACLOCAL_FLAGS="-I /sw/share/aclocal"
29
export CFLAGS="-I/sw/include"
30
export CPPFLAGS=$CFLAGS
31
export LDFLAGS="-L/sw/lib"
32
export PKG_CONFIG_PATH="/sw/lib/pkgconfig:/usr/lib/pkgconfig:/usr/local/lib/pkgconfig:/opt/local/lib/pkgconfig"
38
The system V shared memory is not very reliable on Darwin/MacOSX, so
39
POSIX shared memory API is the preferred default. To override, use...
41
./configure --disable-posix-shm
44
Jack server audio cycle
45
========================
47
On Linux, the jack server audio cycle (jack_run_cycle function) is
48
called in a real-time SCHED_FIFO thread. On Darwin/MacOSX, the
49
jack_run_cycle is directly called inside the CoreAudio audio callback.
52
External client activation
53
===========================
55
Jack Linux implementation use system fifo/pipe to trigger the clients
56
real-time callback from the server : the first client of an external
57
subgraph is triggered, does it's job and wakes up the next one in the
58
list, and so on until the last client that wakes up the Jack
59
server. This avoid uneeded context switches between the server and
60
clients and thus is more efficient.
62
This Linux implementation works also on Darwin/MacOSX but is not very
63
efficient : audio gliches occur quite frequently.
65
A more efficient system for external client activation has been
66
developed. It use low-level mach messages system to implement fast IPC
67
between the Jack server and the running clients. The Darwin/MacOSX has
68
a very efficient Remote Procedure Call (RPC) implementation that can
69
be used: the Jack server activate each external client in turn in a
72
On the client side, each client uses an additionnal thread only used
73
for the real-time process callback, that will be triggered by the Jack
74
server using this fast RPC mechanism.
80
The Darwin/MacOSX system use a special class of scheduling for
83
Since the server audio cycle is called directly from the CoreAudio
84
callback, there is nothing special to do on the server side. On the
85
client side, the thread used to call the "process" callback from the
86
server is made real-time, using the mach thread API.
89
Compilation and installation
90
=============================
92
- In the jack/jack folder, you'll have to produce the version.h
93
manually from the version.h.in file ): Edit the version.h.in, replace
94
the JACK_PROTOCOL_VERSION value with the one found in configure.in and
95
save as a new version.h file. You should get something like "#define
96
jack_protocol_version 6" in the file.
98
Several packages need to be installed before compiling Jack :
100
- Fink dlcompat (fink.sourceforge.net) : this package define the
101
dlopen, dlsym... API used in Jack to load drivers and internal
102
clients. The package has to be installed before compiling Jack.
104
- fakepoll is a implementation of the poll function using select. The
105
Fink version of poll does not work correctly, thus the public domain
106
"fakepoll" code has been used instead. It is directly included in the
107
Jack Darwin/MacOSX port.
109
- PortAudio (www.portaudio.com) : PortAudio is a free, cross platform,
110
open-source, audio I/O library. The Jack CoreAudio driver actually is
111
implemented using PortAudio. The PortAudio source code for MacOSX has
112
to be installed and compiled to produce a framework called
113
"PortAudio.framework" that will be used in the Jack link phase.
116
Several targets are available in the Project Builder project :
118
- jackd : build the Jack server ("jackd" executable)
119
- jack framework : build the "Jack.framework" library.
120
- driver : build the PortAudio driver as a "jack_portaudio.so" shared library.
121
- jack_metro : build the "jack_metro" executable.
122
- jack_lsp : build the "jack_lsp" executable.
123
- jack_connect : build the "jack_connect" executable.
124
- jack_disconnect : build the "jack_disconnect" executable.
126
Server, driver and library installation :
127
-----------------------------------------
129
First copy the Jack.framework in /Library/Framework. Then as root :
131
# cp jack_portaudio /usr/local/lib
132
# cp jackd /usr/local/bin
134
Launching Jack server :
135
-----------------------
137
By default buffer size is 128 frames and sample rate is 44100.
139
$ jackd -v -R -d coreaudio
141
To setup a 32 frames buffer and a 4800 Hz sample rate :
143
$ jackd -v -R -d coreaudio -p 32 -r 48000
148
The Darwin/MacOSX implementation is quite efficient: on a G4/867 Mhz,
149
the Jack server can run with a 32 frames buffer size without noticable
153
Known problems or unimplemented features
154
=========================================
156
- thread cancellation : the pthread API pthread_cancel is not
157
completely available on Darwin/MacOSX. Thread cannot be cancelled in
158
the general case: they must use explicit cancelation points like
159
"pthread_testcancel" (see the "jack_client_thread" function)
161
- xruns detection and report: not implemented.
164
Possible improvements
165
======================
167
- The audio driver is built on top of PortAudio. It may be more
168
efficient to directly use the CoreAudio API in order to avoid
169
additional buffer copy and interleaving/disinterleaving operations.
171
- The project uses Project Builder. It would be helpful to work on
172
the autoconf and automake tools as the Linux version. In this case,
173
the macosx/config.h file would have to be removed and generated by
174
configure, and jack/version.h will be generated automatically from
177
- Better separation of Linux and Darwin/MacOSX only code.
179
The Jack port for Darwin/MacOSX version has be done by:
181
Grame Research Laboratory
182
9, rue du Garet 69001 Lyon - France