jack2 codebase
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

465 lines
11KB

  1. /*
  2. Copyright (C) 2004-2006 Grame
  3. This program is free software; you can redistribute it and/or modify
  4. it under the terms of the GNU General Public License as published by
  5. the Free Software Foundation; either version 2 of the License, or
  6. (at your option) any later version.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with this program; if not, write to the Free Software
  13. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  14. */
  15. #ifdef WIN32
  16. #pragma warning (disable : 4786)
  17. #endif
  18. #include "JackGlobals.h"
  19. // OSX
  20. #if defined(__APPLE__)
  21. #include "JackCoreAudioDriver.h"
  22. #include "JackMachServerNotifyChannel.h"
  23. #include "JackMachNotifyChannel.h"
  24. #include "JackMachServerChannel.h"
  25. #include "JackMachClientChannel.h"
  26. #include "JackMachThread.h"
  27. #include "JackMachSemaphore.h"
  28. #include "JackProcessSync.h"
  29. #include "JackSocketServerNotifyChannel.h"
  30. #include "JackSocketNotifyChannel.h"
  31. #include "JackSocketServerChannel.h"
  32. #include "JackSocketClientChannel.h"
  33. #include "JackPosixThread.h"
  34. #include "JackPosixSemaphore.h"
  35. #include "JackFifo.h"
  36. #endif
  37. // WINDOWS
  38. #ifdef WIN32
  39. #include "JackWinProcessSync.h"
  40. #include "JackWinNamedPipeServerNotifyChannel.h"
  41. #include "JackWinNamedPipeNotifyChannel.h"
  42. #include "JackWinNamedPipeServerChannel.h"
  43. #include "JackWinNamedPipeClientChannel.h"
  44. #include "JackWinEvent.h"
  45. #include "JackWinThread.h"
  46. #endif
  47. // LINUX
  48. #ifdef __linux__
  49. #include "JackAlsaDriver.h"
  50. #include "JackProcessSync.h"
  51. #include "JackSocketServerNotifyChannel.h"
  52. #include "JackSocketNotifyChannel.h"
  53. #include "JackSocketServerChannel.h"
  54. #include "JackSocketClientChannel.h"
  55. #include "JackPosixThread.h"
  56. #include "JackPosixSemaphore.h"
  57. #include "JackFifo.h"
  58. #endif
  59. // COMMON
  60. #include "JackDummyDriver.h"
  61. #include "JackAudioDriver.h"
  62. using namespace std;
  63. namespace Jack
  64. {
  65. #ifdef WIN32
  66. JackSynchro* JackFactoryWindowsServer::MakeSynchro()
  67. {
  68. return new JackWinEvent();
  69. }
  70. JackServerNotifyChannelInterface* JackFactoryWindowsServer::MakeServerNotifyChannel()
  71. {
  72. return new JackWinNamedPipeServerNotifyChannel();
  73. }
  74. JackClientChannelInterface* JackFactoryWindowsServer::MakeClientChannel()
  75. {
  76. return NULL;
  77. } // Not used
  78. JackNotifyChannelInterface* JackFactoryWindowsServer::MakeNotifyChannel()
  79. {
  80. return new JackWinNamedPipeNotifyChannel();
  81. }
  82. JackServerChannelInterface* JackFactoryWindowsServer::MakeServerChannel()
  83. {
  84. return new JackWinNamedPipeServerChannel();
  85. }
  86. JackSyncInterface* JackFactoryWindowsServer::MakeInterProcessSync()
  87. {
  88. return new JackWinProcessSync();
  89. }
  90. JackThread* JackFactoryWindowsServer::MakeThread(JackRunnableInterface* runnable)
  91. {
  92. return new JackWinThread(runnable);
  93. }
  94. #endif
  95. #ifdef __linux__
  96. #if defined(SOCKET_RPC_POSIX_SEMA)
  97. JackSynchro* JackFactoryLinuxServer::MakeSynchro()
  98. {
  99. return new JackPosixSemaphore();
  100. }
  101. JackServerNotifyChannelInterface* JackFactoryLinuxServer::MakeServerNotifyChannel()
  102. {
  103. return new JackSocketServerNotifyChannel();
  104. }
  105. JackClientChannelInterface* JackFactoryLinuxServer::MakeClientChannel()
  106. {
  107. return NULL;
  108. } // Not used
  109. JackNotifyChannelInterface* JackFactoryLinuxServer::MakeNotifyChannel()
  110. {
  111. return new JackSocketNotifyChannel();
  112. }
  113. JackServerChannelInterface* JackFactoryLinuxServer::MakeServerChannel()
  114. {
  115. return new JackSocketServerChannel();
  116. }
  117. JackSyncInterface* JackFactoryLinuxServer::MakeInterProcessSync()
  118. {
  119. return new JackProcessSync();
  120. }
  121. JackThread* JackFactoryLinuxServer::MakeThread(JackRunnableInterface* runnable)
  122. {
  123. return new JackPosixThread(runnable, PTHREAD_CANCEL_ASYNCHRONOUS);
  124. }
  125. #endif
  126. #if defined(SOCKET_RPC_FIFO_SEMA)
  127. JackSynchro* JackFactoryLinuxServer::MakeSynchro()
  128. {
  129. return new JackFifo();
  130. }
  131. JackServerNotifyChannelInterface* JackFactoryLinuxServer::MakeServerNotifyChannel()
  132. {
  133. return new JackSocketServerNotifyChannel();
  134. }
  135. JackClientChannelInterface* JackFactoryLinuxServer::MakeClientChannel()
  136. {
  137. return NULL;
  138. }
  139. // Not used
  140. JackNotifyChannelInterface* JackFactoryLinuxServer::MakeNotifyChannel()
  141. {
  142. return new JackSocketNotifyChannel();
  143. }
  144. JackServerChannelInterface* JackFactoryLinuxServer::MakeServerChannel()
  145. {
  146. return new JackSocketServerChannel();
  147. }
  148. JackSyncInterface* JackFactoryLinuxServer::MakeInterProcessSync()
  149. {
  150. return new JackProcessSync();
  151. }
  152. JackThread* JackFactoryLinuxServer::MakeThread(JackRunnableInterface* runnable)
  153. {
  154. return new JackPosixThread(runnable, PTHREAD_CANCEL_ASYNCHRONOUS);
  155. }
  156. #endif
  157. #if defined(SOCKET_RPC_FIFO_SEMA_DUMMY)
  158. JackSynchro* JackFactoryLinuxServer::MakeSynchro()
  159. {
  160. return new JackFifo();
  161. }
  162. JackServerNotifyChannelInterface* JackFactoryLinuxServer::MakeServerNotifyChannel()
  163. {
  164. return new JackSocketServerNotifyChannel();
  165. }
  166. JackClientChannelInterface* JackFactoryLinuxServer::MakeClientChannel()
  167. {
  168. return NULL;
  169. }
  170. // Not used
  171. JackNotifyChannelInterface* JackFactoryLinuxServer::MakeNotifyChannel()
  172. {
  173. return new JackSocketNotifyChannel();
  174. }
  175. JackServerChannelInterface* JackFactoryLinuxServer::MakeServerChannel()
  176. {
  177. return new JackSocketServerChannel();
  178. }
  179. JackSyncInterface* JackFactoryLinuxServer::MakeInterProcessSync()
  180. {
  181. return new JackProcessSync();
  182. }
  183. JackThread* JackFactoryLinuxServer::MakeThread(JackRunnableInterface* runnable)
  184. {
  185. return new JackPosixThread(runnable, PTHREAD_CANCEL_ASYNCHRONOUS);
  186. }
  187. #endif
  188. #endif
  189. #if defined(__APPLE__)
  190. #if defined(MACH_RPC_MACH_SEMA)
  191. // Mach RPC + Mach Semaphore
  192. JackSynchro* JackFactoryOSXServer::MakeSynchro()
  193. {
  194. return new JackMachSemaphore();
  195. }
  196. JackServerNotifyChannelInterface* JackFactoryOSXServer::MakeServerNotifyChannel()
  197. {
  198. return new JackMachServerNotifyChannel();
  199. }
  200. JackClientChannelInterface* JackFactoryOSXServer::MakeClientChannel()
  201. {
  202. return NULL;
  203. } // Not used
  204. JackNotifyChannelInterface* JackFactoryOSXServer::MakeNotifyChannel()
  205. {
  206. return new JackMachNotifyChannel();
  207. }
  208. JackServerChannelInterface* JackFactoryOSXServer::MakeServerChannel()
  209. {
  210. return new JackMachServerChannel();
  211. }
  212. JackSyncInterface* JackFactoryOSXServer::MakeInterProcessSync()
  213. {
  214. return new JackProcessSync();
  215. }
  216. JackThread* JackFactoryOSXServer::MakeThread(JackRunnableInterface* runnable)
  217. {
  218. return new JackMachThread(runnable, PTHREAD_CANCEL_ASYNCHRONOUS);
  219. }
  220. #endif
  221. #if defined(SOCKET_RPC_POSIX_SEMA)
  222. // Socket RPC + Posix Semaphore
  223. JackSynchro* JackFactoryOSXServer::MakeSynchro()
  224. {
  225. return new JackPosixSemaphore();
  226. }
  227. JackServerNotifyChannelInterface* JackFactoryOSXServer::MakeServerNotifyChannel()
  228. {
  229. return new JackSocketServerNotifyChannel();
  230. }
  231. JackClientChannelInterface* JackFactoryOSXServer::MakeClientChannel()
  232. {
  233. return NULL;
  234. }
  235. // Not used
  236. JackNotifyChannelInterface* JackFactoryOSXServer::MakeNotifyChannel()
  237. {
  238. return new JackSocketNotifyChannel();
  239. }
  240. JackServerChannelInterface* JackFactoryOSXServer::MakeServerChannel()
  241. {
  242. return new JackSocketServerChannel();
  243. }
  244. JackSyncInterface* JackFactoryOSXServer::MakeInterProcessSync()
  245. {
  246. return new JackProcessSync();
  247. }
  248. JackThread* JackFactoryOSXServer::MakeThread(JackRunnableInterface* runnable)
  249. {
  250. return new JackMachThread(runnable, PTHREAD_CANCEL_ASYNCHRONOUS);
  251. }
  252. #endif
  253. #if defined(SOCKET_RPC_FIFO_SEMA)
  254. // Socket RPC + Fifo Semaphore
  255. JackSynchro* JackFactoryOSXServer::MakeSynchro()
  256. {
  257. return new JackFifo();
  258. }
  259. JackServerNotifyChannelInterface* JackFactoryOSXServer::MakeServerNotifyChannel()
  260. {
  261. return new JackSocketServerNotifyChannel();
  262. }
  263. JackClientChannelInterface* JackFactoryOSXServer::MakeClientChannel()
  264. {
  265. return NULL;
  266. }
  267. // Not used
  268. JackNotifyChannelInterface* JackFactoryOSXServer::MakeNotifyChannel()
  269. {
  270. return new JackSocketNotifyChannel();
  271. }
  272. JackServerChannelInterface* JackFactoryOSXServer::MakeServerChannel()
  273. {
  274. return new JackSocketServerChannel();
  275. }
  276. JackSyncInterface* JackFactoryOSXServer::MakeInterProcessSync()
  277. {
  278. return new JackProcessSync();
  279. }
  280. JackThread* JackFactoryOSXServer::MakeThread(JackRunnableInterface* runnable)
  281. {
  282. return new JackMachThread(runnable, PTHREAD_CANCEL_ASYNCHRONOUS);
  283. }
  284. #endif
  285. #if defined(MACH_RPC_FIFO_SEMA)
  286. // Mach RPC + Fifo Semaphore
  287. JackSynchro* JackFactoryOSXServer::MakeSynchro()
  288. {
  289. return new JackFifo();
  290. }
  291. JackServerNotifyChannelInterface* JackFactoryOSXServer::MakeServerNotifyChannel()
  292. {
  293. return new JackMachServerNotifyChannel();
  294. }
  295. JackClientChannelInterface* JackFactoryOSXServer::MakeClientChannel()
  296. {
  297. return NULL;
  298. }
  299. // Not used
  300. JackNotifyChannelInterface* JackFactoryOSXServer::MakeNotifyChannel()
  301. {
  302. return new JackMachNotifyChannel();
  303. }
  304. JackServerChannelInterface* JackFactoryOSXServer::MakeServerChannel()
  305. {
  306. return new JackMachServerChannel();
  307. }
  308. JackSyncInterface* JackFactoryOSXServer::MakeInterProcessSync()
  309. {
  310. return new JackProcessSync();
  311. }
  312. JackThread* JackFactoryOSXServer::MakeThread(JackRunnableInterface* runnable)
  313. {
  314. return new JackMachThread(runnable, PTHREAD_CANCEL_ASYNCHRONOUS);
  315. }
  316. #endif
  317. #if defined(MACH_RPC_POSIX_SEMA)
  318. // Mach RPC + Posix Semaphore
  319. JackSynchro* JackFactoryOSXServer::MakeSynchro()
  320. {
  321. return new JackPosixSemaphore();
  322. }
  323. JackServerNotifyChannelInterface* JackFactoryOSXServer::MakeServerNotifyChannel()
  324. {
  325. return new JackMachServerNotifyChannel();
  326. }
  327. JackClientChannelInterface* JackFactoryOSXServer::MakeClientChannel()
  328. {
  329. return NULL;
  330. }
  331. // Not used
  332. JackNotifyChannelInterface* JackFactoryOSXServer::MakeNotifyChannel()
  333. {
  334. return new JackMachNotifyChannel();
  335. }
  336. JackServerChannelInterface* JackFactoryOSXServer::MakeServerChannel()
  337. {
  338. return new JackMachServerChannel();
  339. }
  340. JackSyncInterface* JackFactoryOSXServer::MakeInterProcessSync()
  341. {
  342. return new JackProcessSync();
  343. }
  344. JackThread* JackFactoryOSXServer::MakeThread(JackRunnableInterface* runnable)
  345. {
  346. return new JackMachThread(runnable, PTHREAD_CANCEL_ASYNCHRONOUS);
  347. }
  348. #endif
  349. #if defined(SOCKET_RPC_MACH_SEMA)
  350. // Socket RPC + Mac Semaphore
  351. JackSynchro* JackFactoryOSXServer::MakeSynchro()
  352. {
  353. return new JackMachSemaphore();
  354. }
  355. JackServerNotifyChannelInterface* JackFactoryOSXServer::MakeServerNotifyChannel()
  356. {
  357. return new JackSocketServerNotifyChannel();
  358. }
  359. JackClientChannelInterface* JackFactoryOSXServer::MakeClientChannel()
  360. {
  361. return NULL;
  362. }
  363. // Not used
  364. JackNotifyChannelInterface* JackFactoryOSXServer::MakeNotifyChannel()
  365. {
  366. return new JackSocketNotifyChannel();
  367. }
  368. JackServerChannelInterface* JackFactoryOSXServer::MakeServerChannel()
  369. {
  370. return new JackSocketServerChannel();
  371. }
  372. JackSyncInterface* JackFactoryOSXServer::MakeInterProcessSync()
  373. {
  374. return new JackProcessSync();
  375. }
  376. JackThread* JackFactoryOSXServer::MakeThread(JackRunnableInterface* runnable)
  377. {
  378. return new JackMachThread(runnable, PTHREAD_CANCEL_ASYNCHRONOUS);
  379. }
  380. #endif
  381. #endif
  382. } // end of namespace