JackGlobalsServer.cpp 12.5 KB
Newer Older
sletz's avatar
sletz committed
1
/*
sletz's avatar
sletz committed
2
Copyright (C) 2004-2008 Grame
sletz's avatar
sletz committed
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

*/
sletz's avatar
Cleanup    
sletz committed
19

20
21
22
23
#if defined(HAVE_CONFIG_H)
#include "config.h"
#endif

sletz's avatar
sletz committed
24
#ifdef WIN32
sletz's avatar
Cleanup    
sletz committed
25
26
#pragma warning (disable : 4786)
#endif
sletz's avatar
sletz committed
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56

#include "JackGlobals.h"

// OSX
#if defined(__APPLE__)
#include "JackCoreAudioDriver.h"
#include "JackMachServerNotifyChannel.h"
#include "JackMachNotifyChannel.h"
#include "JackMachServerChannel.h"
#include "JackMachClientChannel.h"
#include "JackMachThread.h"
#include "JackMachSemaphore.h"
#include "JackProcessSync.h"

#include "JackSocketServerNotifyChannel.h"
#include "JackSocketNotifyChannel.h"
#include "JackSocketServerChannel.h"
#include "JackSocketClientChannel.h"
#include "JackPosixThread.h"
#include "JackPosixSemaphore.h"
#include "JackFifo.h"
#endif

// WINDOWS
#ifdef WIN32
#include "JackWinProcessSync.h"
#include "JackWinNamedPipeServerNotifyChannel.h"
#include "JackWinNamedPipeNotifyChannel.h"
#include "JackWinNamedPipeServerChannel.h"
#include "JackWinNamedPipeClientChannel.h"
57
#include "JackWinEvent.h"
58
#include "JackWinSemaphore.h"
sletz's avatar
sletz committed
59
60
61
62
63
#include "JackWinThread.h"
#endif

// LINUX
#ifdef __linux__
64
#include "linux/alsa/JackAlsaDriver.h"
sletz's avatar
sletz committed
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#include "JackProcessSync.h"
#include "JackSocketServerNotifyChannel.h"
#include "JackSocketNotifyChannel.h"
#include "JackSocketServerChannel.h"
#include "JackSocketClientChannel.h"
#include "JackPosixThread.h"
#include "JackPosixSemaphore.h"
#include "JackFifo.h"
#endif

// COMMON
#include "JackDummyDriver.h"
#include "JackAudioDriver.h"

using namespace std;

namespace Jack
{

#ifdef WIN32
sletz's avatar
sletz committed
85
86
87
88
89
90
91
92
JackSynchro* JackFactoryWindowsClient::MakeSynchro() {return NULL;}
JackServerNotifyChannelInterface* JackFactoryWindowsClient::MakeServerNotifyChannel() {return NULL;}
JackClientChannelInterface* JackFactoryWindowsClient::MakeClientChannel() {return NULL;}
JackNotifyChannelInterface* JackFactoryWindowsClient::MakeNotifyChannel() {return NULL;}
JackServerChannelInterface* JackFactoryWindowsClient::MakeServerChannel() {return NULL;}
JackSyncInterface* JackFactoryWindowsClient::MakeInterProcessSync() {return NULL;}
JackThread* JackFactoryWindowsClient::MakeThread(JackRunnableInterface* runnable) {return NULL;}

sletz's avatar
sletz committed
93
94
JackSynchro* JackFactoryWindowsServer::MakeSynchro()
{
sletz's avatar
sletz committed
95
    return new JackWinSemaphore();
sletz's avatar
sletz committed
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
}

JackServerNotifyChannelInterface* JackFactoryWindowsServer::MakeServerNotifyChannel()
{
    return new JackWinNamedPipeServerNotifyChannel();
}

JackClientChannelInterface* JackFactoryWindowsServer::MakeClientChannel()
{
    return NULL;
} // Not used

JackNotifyChannelInterface* JackFactoryWindowsServer::MakeNotifyChannel()
{
    return new JackWinNamedPipeNotifyChannel();
}

JackServerChannelInterface* JackFactoryWindowsServer::MakeServerChannel()
{
    return new JackWinNamedPipeServerChannel();
}

JackSyncInterface* JackFactoryWindowsServer::MakeInterProcessSync()
{
    return new JackWinProcessSync();
}

JackThread* JackFactoryWindowsServer::MakeThread(JackRunnableInterface* runnable)
{
    return new JackWinThread(runnable);
}
#endif

#ifdef __linux__

#if defined(SOCKET_RPC_POSIX_SEMA)
JackSynchro* JackFactoryLinuxServer::MakeSynchro()
{
    return new JackPosixSemaphore();
}

JackServerNotifyChannelInterface* JackFactoryLinuxServer::MakeServerNotifyChannel()
{
    return new JackSocketServerNotifyChannel();
}

JackClientChannelInterface* JackFactoryLinuxServer::MakeClientChannel()
{
    return NULL;
} // Not used

JackNotifyChannelInterface* JackFactoryLinuxServer::MakeNotifyChannel()
{
    return new JackSocketNotifyChannel();
}

JackServerChannelInterface* JackFactoryLinuxServer::MakeServerChannel()
{
    return new JackSocketServerChannel();
}

JackSyncInterface* JackFactoryLinuxServer::MakeInterProcessSync()
{
    return new JackProcessSync();
}

JackThread* JackFactoryLinuxServer::MakeThread(JackRunnableInterface* runnable)
{
    return new JackPosixThread(runnable, PTHREAD_CANCEL_ASYNCHRONOUS);
}
#endif

#if defined(SOCKET_RPC_FIFO_SEMA)
sletz's avatar
sletz committed
169
170
171
172
173
174
175
176
JackSynchro* JackFactoryLinuxClient::MakeSynchro() {return NULL;}
JackServerNotifyChannelInterface* JackFactoryLinuxClient::MakeServerNotifyChannel() {return NULL;}
JackClientChannelInterface* JackFactoryLinuxClient::MakeClientChannel() {return NULL;}
JackNotifyChannelInterface* JackFactoryLinuxClient::MakeNotifyChannel() {return NULL;}
JackServerChannelInterface* JackFactoryLinuxClient::MakeServerChannel() {return NULL;}
JackSyncInterface* JackFactoryLinuxClient::MakeInterProcessSync() {return NULL;}
JackThread* JackFactoryLinuxClient::MakeThread(JackRunnableInterface* runnable) {return NULL;}

sletz's avatar
sletz committed
177
178
179
180
181
182
183
184
185
186
187
188
189
JackSynchro* JackFactoryLinuxServer::MakeSynchro()
{
    return new JackFifo();
}

JackServerNotifyChannelInterface* JackFactoryLinuxServer::MakeServerNotifyChannel()
{
    return new JackSocketServerNotifyChannel();
}

JackClientChannelInterface* JackFactoryLinuxServer::MakeClientChannel()
{
    return NULL;
sletz's avatar
Cleanup    
sletz committed
190
191
} // Not used

sletz's avatar
sletz committed
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
JackNotifyChannelInterface* JackFactoryLinuxServer::MakeNotifyChannel()
{
    return new JackSocketNotifyChannel();
}

JackServerChannelInterface* JackFactoryLinuxServer::MakeServerChannel()
{
    return new JackSocketServerChannel();
}

JackSyncInterface* JackFactoryLinuxServer::MakeInterProcessSync()
{
    return new JackProcessSync();
}

JackThread* JackFactoryLinuxServer::MakeThread(JackRunnableInterface* runnable)
{
    return new JackPosixThread(runnable, PTHREAD_CANCEL_ASYNCHRONOUS);
}
#endif

#if defined(SOCKET_RPC_FIFO_SEMA_DUMMY)
JackSynchro* JackFactoryLinuxServer::MakeSynchro()
{
    return new JackFifo();
}

JackServerNotifyChannelInterface* JackFactoryLinuxServer::MakeServerNotifyChannel()
{
    return new JackSocketServerNotifyChannel();
}

JackClientChannelInterface* JackFactoryLinuxServer::MakeClientChannel()
{
    return NULL;
sletz's avatar
Cleanup    
sletz committed
227
228
} // Not used

sletz's avatar
sletz committed
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
JackNotifyChannelInterface* JackFactoryLinuxServer::MakeNotifyChannel()
{
    return new JackSocketNotifyChannel();
}

JackServerChannelInterface* JackFactoryLinuxServer::MakeServerChannel()
{
    return new JackSocketServerChannel();
}

JackSyncInterface* JackFactoryLinuxServer::MakeInterProcessSync()
{
    return new JackProcessSync();
}

JackThread* JackFactoryLinuxServer::MakeThread(JackRunnableInterface* runnable)
{
    return new JackPosixThread(runnable, PTHREAD_CANCEL_ASYNCHRONOUS);
}
#endif

#endif

#if defined(__APPLE__)

sletz's avatar
sletz committed
254
#if defined(MACH_RPC_MACH_SEMA)
sletz's avatar
sletz committed
255
// Mach RPC + Mach Semaphore
sletz's avatar
sletz committed
256
257
258
259
260
261
262
263
JackSynchro* JackFactoryOSXClient::MakeSynchro() {return NULL;}
JackServerNotifyChannelInterface* JackFactoryOSXClient::MakeServerNotifyChannel() {return NULL;}
JackClientChannelInterface* JackFactoryOSXClient::MakeClientChannel() {return NULL;}
JackNotifyChannelInterface* JackFactoryOSXClient::MakeNotifyChannel() {return NULL;}
JackServerChannelInterface* JackFactoryOSXClient::MakeServerChannel() {return NULL;}
JackSyncInterface* JackFactoryOSXClient::MakeInterProcessSync() {return NULL;}
JackThread* JackFactoryOSXClient::MakeThread(JackRunnableInterface* runnable) {return NULL;}

sletz's avatar
sletz committed
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
JackSynchro* JackFactoryOSXServer::MakeSynchro()
{
    return new JackMachSemaphore();
}

JackServerNotifyChannelInterface* JackFactoryOSXServer::MakeServerNotifyChannel()
{
    return new JackMachServerNotifyChannel();
}

JackClientChannelInterface* JackFactoryOSXServer::MakeClientChannel()
{
    return NULL;
} // Not used

JackNotifyChannelInterface* JackFactoryOSXServer::MakeNotifyChannel()
{
    return new JackMachNotifyChannel();
}

JackServerChannelInterface* JackFactoryOSXServer::MakeServerChannel()
{
    return new JackMachServerChannel();
}

JackSyncInterface* JackFactoryOSXServer::MakeInterProcessSync()
{
    return new JackProcessSync();
}

JackThread* JackFactoryOSXServer::MakeThread(JackRunnableInterface* runnable)
{
    return new JackMachThread(runnable, PTHREAD_CANCEL_ASYNCHRONOUS);
}
#endif

sletz's avatar
sletz committed
300
#if defined(SOCKET_RPC_POSIX_SEMA)
sletz's avatar
sletz committed
301
302
303
304
305
306
307
308
309
310
311
312
313
314
// Socket RPC + Posix Semaphore
JackSynchro* JackFactoryOSXServer::MakeSynchro()
{
    return new JackPosixSemaphore();
}

JackServerNotifyChannelInterface* JackFactoryOSXServer::MakeServerNotifyChannel()
{
    return new JackSocketServerNotifyChannel();
}

JackClientChannelInterface* JackFactoryOSXServer::MakeClientChannel()
{
    return NULL;
sletz's avatar
Cleanup    
sletz committed
315
316
} // Not used

sletz's avatar
sletz committed
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
JackNotifyChannelInterface* JackFactoryOSXServer::MakeNotifyChannel()
{
    return new JackSocketNotifyChannel();
}

JackServerChannelInterface* JackFactoryOSXServer::MakeServerChannel()
{
    return new JackSocketServerChannel();
}

JackSyncInterface* JackFactoryOSXServer::MakeInterProcessSync()
{
    return new JackProcessSync();
}

JackThread* JackFactoryOSXServer::MakeThread(JackRunnableInterface* runnable)
{
    return new JackMachThread(runnable, PTHREAD_CANCEL_ASYNCHRONOUS);
}
#endif

sletz's avatar
sletz committed
338
#if defined(SOCKET_RPC_FIFO_SEMA)
sletz's avatar
sletz committed
339
340
341
342
343
344
345
346
347
348
349
350
351
352
// Socket RPC + Fifo Semaphore
JackSynchro* JackFactoryOSXServer::MakeSynchro()
{
    return new JackFifo();
}

JackServerNotifyChannelInterface* JackFactoryOSXServer::MakeServerNotifyChannel()
{
    return new JackSocketServerNotifyChannel();
}

JackClientChannelInterface* JackFactoryOSXServer::MakeClientChannel()
{
    return NULL;
sletz's avatar
Cleanup    
sletz committed
353
354
} // Not used

sletz's avatar
sletz committed
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
JackNotifyChannelInterface* JackFactoryOSXServer::MakeNotifyChannel()
{
    return new JackSocketNotifyChannel();
}

JackServerChannelInterface* JackFactoryOSXServer::MakeServerChannel()
{
    return new JackSocketServerChannel();
}

JackSyncInterface* JackFactoryOSXServer::MakeInterProcessSync()
{
    return new JackProcessSync();
}

JackThread* JackFactoryOSXServer::MakeThread(JackRunnableInterface* runnable)
{
    return new JackMachThread(runnable, PTHREAD_CANCEL_ASYNCHRONOUS);
}
#endif

sletz's avatar
sletz committed
376
#if defined(MACH_RPC_FIFO_SEMA)
sletz's avatar
sletz committed
377
378
379
380
381
382
383
384
385
386
387
388
389
390
// Mach RPC + Fifo Semaphore
JackSynchro* JackFactoryOSXServer::MakeSynchro()
{
    return new JackFifo();
}

JackServerNotifyChannelInterface* JackFactoryOSXServer::MakeServerNotifyChannel()
{
    return new JackMachServerNotifyChannel();
}

JackClientChannelInterface* JackFactoryOSXServer::MakeClientChannel()
{
    return NULL;
sletz's avatar
Cleanup    
sletz committed
391
392
} // Not used

sletz's avatar
sletz committed
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
JackNotifyChannelInterface* JackFactoryOSXServer::MakeNotifyChannel()
{
    return new JackMachNotifyChannel();
}

JackServerChannelInterface* JackFactoryOSXServer::MakeServerChannel()
{
    return new JackMachServerChannel();
}

JackSyncInterface* JackFactoryOSXServer::MakeInterProcessSync()
{
    return new JackProcessSync();
}

JackThread* JackFactoryOSXServer::MakeThread(JackRunnableInterface* runnable)
{
    return new JackMachThread(runnable, PTHREAD_CANCEL_ASYNCHRONOUS);
}
#endif

sletz's avatar
sletz committed
414
#if defined(MACH_RPC_POSIX_SEMA)
sletz's avatar
sletz committed
415
416
417
418
419
420
421
422
423
424
425
426
427
428
// Mach RPC + Posix Semaphore
JackSynchro* JackFactoryOSXServer::MakeSynchro()
{
    return new JackPosixSemaphore();
}

JackServerNotifyChannelInterface* JackFactoryOSXServer::MakeServerNotifyChannel()
{
    return new JackMachServerNotifyChannel();
}

JackClientChannelInterface* JackFactoryOSXServer::MakeClientChannel()
{
    return NULL;
sletz's avatar
Cleanup    
sletz committed
429
430
} // Not used

sletz's avatar
sletz committed
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
JackNotifyChannelInterface* JackFactoryOSXServer::MakeNotifyChannel()
{
    return new JackMachNotifyChannel();
}

JackServerChannelInterface* JackFactoryOSXServer::MakeServerChannel()
{
    return new JackMachServerChannel();
}

JackSyncInterface* JackFactoryOSXServer::MakeInterProcessSync()
{
    return new JackProcessSync();
}

JackThread* JackFactoryOSXServer::MakeThread(JackRunnableInterface* runnable)
{
    return new JackMachThread(runnable, PTHREAD_CANCEL_ASYNCHRONOUS);
}
#endif

sletz's avatar
sletz committed
452
#if defined(SOCKET_RPC_MACH_SEMA)
sletz's avatar
sletz committed
453
454
455
456
457
458
459
460
461
462
463
464
465
466
// Socket RPC + Mac Semaphore
JackSynchro* JackFactoryOSXServer::MakeSynchro()
{
    return new JackMachSemaphore();
}

JackServerNotifyChannelInterface* JackFactoryOSXServer::MakeServerNotifyChannel()
{
    return new JackSocketServerNotifyChannel();
}

JackClientChannelInterface* JackFactoryOSXServer::MakeClientChannel()
{
    return NULL;
sletz's avatar
Cleanup    
sletz committed
467
468
} // Not used

sletz's avatar
sletz committed
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
JackNotifyChannelInterface* JackFactoryOSXServer::MakeNotifyChannel()
{
    return new JackSocketNotifyChannel();
}

JackServerChannelInterface* JackFactoryOSXServer::MakeServerChannel()
{
    return new JackSocketServerChannel();
}

JackSyncInterface* JackFactoryOSXServer::MakeInterProcessSync()
{
    return new JackProcessSync();
}

JackThread* JackFactoryOSXServer::MakeThread(JackRunnableInterface* runnable)
{
    return new JackMachThread(runnable, PTHREAD_CANCEL_ASYNCHRONOUS);
}
#endif

#endif

} // end of namespace