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.

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