Dmitry Baikov jackmp-time patch: add jack_get_time, jack_time_to_frames, jack_frames_...
[jack2.git] / common / JackGlobalsServer.cpp
blob98d4992184f8c865be42c68c4e9f96baec255e6f
1 /*
2 Copyright (C) 2004-2006 Grame
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 #ifdef WIN32
21 #pragma warning (disable : 4786)
22 #endif
24 #include "JackGlobals.h"
26 // OSX
27 #if defined(__APPLE__)
28 #include "JackCoreAudioDriver.h"
29 #include "JackMachServerNotifyChannel.h"
30 #include "JackMachNotifyChannel.h"
31 #include "JackMachServerChannel.h"
32 #include "JackMachClientChannel.h"
33 #include "JackMachThread.h"
34 #include "JackMachSemaphore.h"
35 #include "JackProcessSync.h"
37 #include "JackSocketServerNotifyChannel.h"
38 #include "JackSocketNotifyChannel.h"
39 #include "JackSocketServerChannel.h"
40 #include "JackSocketClientChannel.h"
41 #include "JackPosixThread.h"
42 #include "JackPosixSemaphore.h"
43 #include "JackFifo.h"
44 #endif
46 // WINDOWS
47 #ifdef WIN32
48 #include "JackWinProcessSync.h"
49 #include "JackWinNamedPipeServerNotifyChannel.h"
50 #include "JackWinNamedPipeNotifyChannel.h"
51 #include "JackWinNamedPipeServerChannel.h"
52 #include "JackWinNamedPipeClientChannel.h"
53 #include "JackWinEvent.h"
54 #include "JackWinThread.h"
55 #endif
57 // LINUX
58 #ifdef __linux__
59 #include "JackAlsaDriver.h"
60 #include "JackProcessSync.h"
61 #include "JackSocketServerNotifyChannel.h"
62 #include "JackSocketNotifyChannel.h"
63 #include "JackSocketServerChannel.h"
64 #include "JackSocketClientChannel.h"
65 #include "JackPosixThread.h"
66 #include "JackPosixSemaphore.h"
67 #include "JackFifo.h"
68 #endif
70 // COMMON
71 #include "JackDummyDriver.h"
72 #include "JackAudioDriver.h"
75 using namespace std;
77 namespace Jack
80 #ifdef WIN32
81 JackSynchro* JackFactoryWindowsServer::MakeSynchro()
83 return new JackWinEvent();
86 JackServerNotifyChannelInterface* JackFactoryWindowsServer::MakeServerNotifyChannel()
88 return new JackWinNamedPipeServerNotifyChannel();
91 JackClientChannelInterface* JackFactoryWindowsServer::MakeClientChannel()
93 return NULL;
94 } // Not used
96 JackNotifyChannelInterface* JackFactoryWindowsServer::MakeNotifyChannel()
98 return new JackWinNamedPipeNotifyChannel();
101 JackServerChannelInterface* JackFactoryWindowsServer::MakeServerChannel()
103 return new JackWinNamedPipeServerChannel();
106 JackSyncInterface* JackFactoryWindowsServer::MakeInterProcessSync()
108 return new JackWinProcessSync();
111 JackThread* JackFactoryWindowsServer::MakeThread(JackRunnableInterface* runnable)
113 return new JackWinThread(runnable);
115 #endif
117 #ifdef __linux__
119 #if defined(SOCKET_RPC_POSIX_SEMA)
120 JackSynchro* JackFactoryLinuxServer::MakeSynchro()
122 return new JackPosixSemaphore();
125 JackServerNotifyChannelInterface* JackFactoryLinuxServer::MakeServerNotifyChannel()
127 return new JackSocketServerNotifyChannel();
130 JackClientChannelInterface* JackFactoryLinuxServer::MakeClientChannel()
132 return NULL;
133 } // Not used
135 JackNotifyChannelInterface* JackFactoryLinuxServer::MakeNotifyChannel()
137 return new JackSocketNotifyChannel();
140 JackServerChannelInterface* JackFactoryLinuxServer::MakeServerChannel()
142 return new JackSocketServerChannel();
145 JackSyncInterface* JackFactoryLinuxServer::MakeInterProcessSync()
147 return new JackProcessSync();
150 JackThread* JackFactoryLinuxServer::MakeThread(JackRunnableInterface* runnable)
152 return new JackPosixThread(runnable, PTHREAD_CANCEL_ASYNCHRONOUS);
154 #endif
156 #if defined(SOCKET_RPC_FIFO_SEMA)
157 JackSynchro* JackFactoryLinuxServer::MakeSynchro()
159 return new JackFifo();
162 JackServerNotifyChannelInterface* JackFactoryLinuxServer::MakeServerNotifyChannel()
164 return new JackSocketServerNotifyChannel();
167 JackClientChannelInterface* JackFactoryLinuxServer::MakeClientChannel()
169 return NULL;
171 // Not used
172 JackNotifyChannelInterface* JackFactoryLinuxServer::MakeNotifyChannel()
174 return new JackSocketNotifyChannel();
177 JackServerChannelInterface* JackFactoryLinuxServer::MakeServerChannel()
179 return new JackSocketServerChannel();
182 JackSyncInterface* JackFactoryLinuxServer::MakeInterProcessSync()
184 return new JackProcessSync();
187 JackThread* JackFactoryLinuxServer::MakeThread(JackRunnableInterface* runnable)
189 return new JackPosixThread(runnable, PTHREAD_CANCEL_ASYNCHRONOUS);
191 #endif
193 #if defined(SOCKET_RPC_FIFO_SEMA_DUMMY)
194 JackSynchro* JackFactoryLinuxServer::MakeSynchro()
196 return new JackFifo();
199 JackServerNotifyChannelInterface* JackFactoryLinuxServer::MakeServerNotifyChannel()
201 return new JackSocketServerNotifyChannel();
204 JackClientChannelInterface* JackFactoryLinuxServer::MakeClientChannel()
206 return NULL;
208 // Not used
209 JackNotifyChannelInterface* JackFactoryLinuxServer::MakeNotifyChannel()
211 return new JackSocketNotifyChannel();
214 JackServerChannelInterface* JackFactoryLinuxServer::MakeServerChannel()
216 return new JackSocketServerChannel();
219 JackSyncInterface* JackFactoryLinuxServer::MakeInterProcessSync()
221 return new JackProcessSync();
224 JackThread* JackFactoryLinuxServer::MakeThread(JackRunnableInterface* runnable)
226 return new JackPosixThread(runnable, PTHREAD_CANCEL_ASYNCHRONOUS);
228 #endif
230 #endif
232 #if defined(__APPLE__)
234 #if defined(MACH_RPC_MACH_SEMA)
235 // Mach RPC + Mach Semaphore
236 JackSynchro* JackFactoryOSXServer::MakeSynchro()
238 return new JackMachSemaphore();
241 JackServerNotifyChannelInterface* JackFactoryOSXServer::MakeServerNotifyChannel()
243 return new JackMachServerNotifyChannel();
246 JackClientChannelInterface* JackFactoryOSXServer::MakeClientChannel()
248 return NULL;
249 } // Not used
251 JackNotifyChannelInterface* JackFactoryOSXServer::MakeNotifyChannel()
253 return new JackMachNotifyChannel();
256 JackServerChannelInterface* JackFactoryOSXServer::MakeServerChannel()
258 return new JackMachServerChannel();
261 JackSyncInterface* JackFactoryOSXServer::MakeInterProcessSync()
263 return new JackProcessSync();
266 JackThread* JackFactoryOSXServer::MakeThread(JackRunnableInterface* runnable)
268 return new JackMachThread(runnable, PTHREAD_CANCEL_ASYNCHRONOUS);
270 #endif
272 #if defined(SOCKET_RPC_POSIX_SEMA)
273 // Socket RPC + Posix Semaphore
274 JackSynchro* JackFactoryOSXServer::MakeSynchro()
276 return new JackPosixSemaphore();
279 JackServerNotifyChannelInterface* JackFactoryOSXServer::MakeServerNotifyChannel()
281 return new JackSocketServerNotifyChannel();
284 JackClientChannelInterface* JackFactoryOSXServer::MakeClientChannel()
286 return NULL;
288 // Not used
289 JackNotifyChannelInterface* JackFactoryOSXServer::MakeNotifyChannel()
291 return new JackSocketNotifyChannel();
294 JackServerChannelInterface* JackFactoryOSXServer::MakeServerChannel()
296 return new JackSocketServerChannel();
299 JackSyncInterface* JackFactoryOSXServer::MakeInterProcessSync()
301 return new JackProcessSync();
304 JackThread* JackFactoryOSXServer::MakeThread(JackRunnableInterface* runnable)
306 return new JackMachThread(runnable, PTHREAD_CANCEL_ASYNCHRONOUS);
308 #endif
310 #if defined(SOCKET_RPC_FIFO_SEMA)
311 // Socket RPC + Fifo Semaphore
312 JackSynchro* JackFactoryOSXServer::MakeSynchro()
314 return new JackFifo();
317 JackServerNotifyChannelInterface* JackFactoryOSXServer::MakeServerNotifyChannel()
319 return new JackSocketServerNotifyChannel();
322 JackClientChannelInterface* JackFactoryOSXServer::MakeClientChannel()
324 return NULL;
326 // Not used
327 JackNotifyChannelInterface* JackFactoryOSXServer::MakeNotifyChannel()
329 return new JackSocketNotifyChannel();
332 JackServerChannelInterface* JackFactoryOSXServer::MakeServerChannel()
334 return new JackSocketServerChannel();
337 JackSyncInterface* JackFactoryOSXServer::MakeInterProcessSync()
339 return new JackProcessSync();
342 JackThread* JackFactoryOSXServer::MakeThread(JackRunnableInterface* runnable)
344 return new JackMachThread(runnable, PTHREAD_CANCEL_ASYNCHRONOUS);
346 #endif
348 #if defined(MACH_RPC_FIFO_SEMA)
349 // Mach RPC + Fifo Semaphore
350 JackSynchro* JackFactoryOSXServer::MakeSynchro()
352 return new JackFifo();
355 JackServerNotifyChannelInterface* JackFactoryOSXServer::MakeServerNotifyChannel()
357 return new JackMachServerNotifyChannel();
360 JackClientChannelInterface* JackFactoryOSXServer::MakeClientChannel()
362 return NULL;
364 // Not used
365 JackNotifyChannelInterface* JackFactoryOSXServer::MakeNotifyChannel()
367 return new JackMachNotifyChannel();
370 JackServerChannelInterface* JackFactoryOSXServer::MakeServerChannel()
372 return new JackMachServerChannel();
375 JackSyncInterface* JackFactoryOSXServer::MakeInterProcessSync()
377 return new JackProcessSync();
380 JackThread* JackFactoryOSXServer::MakeThread(JackRunnableInterface* runnable)
382 return new JackMachThread(runnable, PTHREAD_CANCEL_ASYNCHRONOUS);
384 #endif
386 #if defined(MACH_RPC_POSIX_SEMA)
387 // Mach RPC + Posix Semaphore
388 JackSynchro* JackFactoryOSXServer::MakeSynchro()
390 return new JackPosixSemaphore();
393 JackServerNotifyChannelInterface* JackFactoryOSXServer::MakeServerNotifyChannel()
395 return new JackMachServerNotifyChannel();
398 JackClientChannelInterface* JackFactoryOSXServer::MakeClientChannel()
400 return NULL;
402 // Not used
403 JackNotifyChannelInterface* JackFactoryOSXServer::MakeNotifyChannel()
405 return new JackMachNotifyChannel();
408 JackServerChannelInterface* JackFactoryOSXServer::MakeServerChannel()
410 return new JackMachServerChannel();
413 JackSyncInterface* JackFactoryOSXServer::MakeInterProcessSync()
415 return new JackProcessSync();
418 JackThread* JackFactoryOSXServer::MakeThread(JackRunnableInterface* runnable)
420 return new JackMachThread(runnable, PTHREAD_CANCEL_ASYNCHRONOUS);
422 #endif
424 #if defined(SOCKET_RPC_MACH_SEMA)
425 // Socket RPC + Mac Semaphore
426 JackSynchro* JackFactoryOSXServer::MakeSynchro()
428 return new JackMachSemaphore();
431 JackServerNotifyChannelInterface* JackFactoryOSXServer::MakeServerNotifyChannel()
433 return new JackSocketServerNotifyChannel();
436 JackClientChannelInterface* JackFactoryOSXServer::MakeClientChannel()
438 return NULL;
440 // Not used
441 JackNotifyChannelInterface* JackFactoryOSXServer::MakeNotifyChannel()
443 return new JackSocketNotifyChannel();
446 JackServerChannelInterface* JackFactoryOSXServer::MakeServerChannel()
448 return new JackSocketServerChannel();
451 JackSyncInterface* JackFactoryOSXServer::MakeInterProcessSync()
453 return new JackProcessSync();
456 JackThread* JackFactoryOSXServer::MakeThread(JackRunnableInterface* runnable)
458 return new JackMachThread(runnable, PTHREAD_CANCEL_ASYNCHRONOUS);
460 #endif
462 #endif
464 } // end of namespace