~ubuntu-branches/ubuntu/saucy/jack-audio-connection-kit/saucy

« back to all changes in this revision

Viewing changes to config/os/macosx/README

  • Committer: Bazaar Package Importer
  • Author(s): Luca Falavigna
  • Date: 2008-12-06 11:05:15 UTC
  • mfrom: (4.1.3 sid)
  • Revision ID: james.westby@ubuntu.com-20081206110515-xa9v9pajr9jqvfvg
Tags: 0.115.6-1ubuntu1
* Merge from Debian unstable, remaining Ubuntu changes:
  - Redirect stderr in bash completion (Debian #504488).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
Darwin/MacOSX port for Jack : architecture changes in the implementation
 
3
========================================================================
 
4
 
 
5
Build Dependencies
 
6
==================
 
7
 
 
8
Apple Developer Tools
 
9
  gcc 2.95.x or 3.x, the standard OSX 10.3 gcc-3.3 compiler works fine
 
10
  MacOSX10.3 SDK package
 
11
 
 
12
GNU tools
 
13
  autoconf >= 2.57
 
14
  automake >= 1.6.3
 
15
 
 
16
optional tools
 
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)
 
22
 
 
23
All non-Apple tools are available from `fink' or `darwinports'.
 
24
 
 
25
Since fink is not well-integrated with OS X, you must define a bunch
 
26
of environment variables...
 
27
 
 
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"
 
33
 
 
34
 
 
35
Shared memory
 
36
=============
 
37
 
 
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...
 
40
 
 
41
  ./configure --disable-posix-shm
 
42
 
 
43
 
 
44
Jack server audio cycle
 
45
========================
 
46
 
 
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.
 
50
 
 
51
 
 
52
External client activation
 
53
===========================
 
54
 
 
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.
 
61
 
 
62
This Linux implementation works also on Darwin/MacOSX but is not very
 
63
efficient : audio gliches occur quite frequently.
 
64
 
 
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
 
70
loop.
 
71
 
 
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.
 
75
 
 
76
 
 
77
Real-time threads
 
78
==================
 
79
 
 
80
The Darwin/MacOSX system use a special class of scheduling for
 
81
real-time threads.
 
82
 
 
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.
 
87
 
 
88
 
 
89
Compilation and installation
 
90
=============================
 
91
 
 
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.
 
97
 
 
98
Several packages need to be installed before compiling Jack :
 
99
 
 
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.
 
103
 
 
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.
 
108
 
 
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.
 
114
 
 
115
 
 
116
Several targets are available in the Project Builder project :
 
117
 
 
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.
 
125
 
 
126
Server, driver and library installation :
 
127
-----------------------------------------
 
128
 
 
129
First copy the Jack.framework in /Library/Framework. Then as root : 
 
130
 
 
131
  # cp jack_portaudio   /usr/local/lib
 
132
  # cp jackd            /usr/local/bin
 
133
 
 
134
Launching Jack server :
 
135
-----------------------
 
136
 
 
137
By default buffer size is 128 frames and sample rate is 44100.
 
138
 
 
139
  $ jackd  -v -R -d coreaudio 
 
140
 
 
141
To setup a 32 frames buffer and a 4800 Hz sample rate : 
 
142
 
 
143
  $ jackd  -v -R -d coreaudio -p 32 -r 48000  
 
144
 
 
145
Performances
 
146
=============
 
147
 
 
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
 
150
problems.
 
151
 
 
152
 
 
153
Known problems or unimplemented features
 
154
=========================================
 
155
 
 
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)
 
160
 
 
161
- xruns detection and report: not implemented.
 
162
 
 
163
 
 
164
Possible improvements
 
165
======================
 
166
 
 
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.
 
170
 
 
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
 
175
jack/version.h.in
 
176
 
 
177
- Better separation of Linux and Darwin/MacOSX only code.
 
178
 
 
179
The Jack port for Darwin/MacOSX version has be done by:
 
180
 
 
181
Grame Research Laboratory
 
182
9, rue du Garet 69001 Lyon - France
 
183
Mail : letz@grame.fr