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.

1875 lines
60KB

  1. /*
  2. Copyright (C) 2001-2003 Paul Davis
  3. Copyright (C) 2004-2008 Grame
  4. This program is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU Lesser General Public License as published by
  6. the Free Software Foundation; either version 2.1 of the License, or
  7. (at your option) any later version.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU Lesser General Public License for more details.
  12. You should have received a copy of the GNU Lesser General Public License
  13. along with this program; if not, write to the Free Software
  14. Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  15. */
  16. #include "JackClient.h"
  17. #include "JackError.h"
  18. #include "JackGraphManager.h"
  19. #include "JackEngineControl.h"
  20. #include "JackClientControl.h"
  21. #include "JackGlobals.h"
  22. #include "JackTime.h"
  23. #include "JackCompilerDeps.h"
  24. #include "JackPortType.h"
  25. #include "JackPlatformPlug.h"
  26. #include <math.h>
  27. #ifdef __CLIENTDEBUG__
  28. #include "JackLibGlobals.h"
  29. #endif
  30. using namespace Jack;
  31. #ifdef __cplusplus
  32. extern "C"
  33. {
  34. #endif
  35. typedef void (*print_function)(const char *);
  36. typedef void *(*thread_routine)(void*);
  37. EXPORT
  38. void
  39. jack_get_version(
  40. int *major_ptr,
  41. int *minor_ptr,
  42. int *micro_ptr,
  43. int *proto_ptr);
  44. EXPORT
  45. const char *
  46. jack_get_version_string();
  47. EXPORT jack_client_t * jack_client_open_aux (const char *client_name,
  48. jack_options_t options,
  49. jack_status_t *status, va_list ap);
  50. EXPORT jack_client_t * jack_client_open (const char *client_name,
  51. jack_options_t options,
  52. jack_status_t *status, ...);
  53. EXPORT jack_client_t * jack_client_new (const char *client_name);
  54. EXPORT int jack_client_name_size (void);
  55. EXPORT char* jack_get_client_name (jack_client_t *client);
  56. EXPORT int jack_internal_client_new (const char *client_name,
  57. const char *load_name,
  58. const char *load_init);
  59. EXPORT void jack_internal_client_close (const char *client_name);
  60. EXPORT int jack_is_realtime (jack_client_t *client);
  61. EXPORT void jack_on_shutdown (jack_client_t *client,
  62. JackShutdownCallback shutdown_callback, void *arg);
  63. EXPORT int jack_set_process_callback (jack_client_t *client,
  64. JackProcessCallback process_callback,
  65. void *arg);
  66. EXPORT jack_nframes_t jack_thread_wait(jack_client_t *client, int status);
  67. // new
  68. EXPORT jack_nframes_t jack_cycle_wait (jack_client_t*);
  69. EXPORT void jack_cycle_signal (jack_client_t*, int status);
  70. EXPORT int jack_set_process_thread(jack_client_t* client, JackThreadCallback fun, void *arg);
  71. EXPORT int jack_set_thread_init_callback (jack_client_t *client,
  72. JackThreadInitCallback thread_init_callback,
  73. void *arg);
  74. EXPORT int jack_set_freewheel_callback (jack_client_t *client,
  75. JackFreewheelCallback freewheel_callback,
  76. void *arg);
  77. EXPORT int jack_set_freewheel(jack_client_t* client, int onoff);
  78. EXPORT int jack_set_buffer_size (jack_client_t *client, jack_nframes_t nframes);
  79. EXPORT int jack_set_buffer_size_callback (jack_client_t *client,
  80. JackBufferSizeCallback bufsize_callback,
  81. void *arg);
  82. EXPORT int jack_set_sample_rate_callback (jack_client_t *client,
  83. JackSampleRateCallback srate_callback,
  84. void *arg);
  85. EXPORT int jack_set_client_registration_callback (jack_client_t *,
  86. JackClientRegistrationCallback
  87. registration_callback, void *arg);
  88. EXPORT int jack_set_port_registration_callback (jack_client_t *,
  89. JackPortRegistrationCallback
  90. registration_callback, void *arg);
  91. EXPORT int jack_set_port_connect_callback (jack_client_t *,
  92. JackPortConnectCallback
  93. connect_callback, void *arg);
  94. EXPORT int jack_set_port_rename_callback (jack_client_t *,
  95. JackPortRenameCallback
  96. rename_callback, void *arg);
  97. EXPORT int jack_set_graph_order_callback (jack_client_t *,
  98. JackGraphOrderCallback graph_callback,
  99. void *);
  100. EXPORT int jack_set_xrun_callback (jack_client_t *,
  101. JackXRunCallback xrun_callback, void *arg);
  102. EXPORT int jack_activate (jack_client_t *client);
  103. EXPORT int jack_deactivate (jack_client_t *client);
  104. EXPORT jack_port_t * jack_port_register (jack_client_t *client,
  105. const char *port_name,
  106. const char *port_type,
  107. unsigned long flags,
  108. unsigned long buffer_size);
  109. EXPORT int jack_port_unregister (jack_client_t *, jack_port_t *);
  110. EXPORT void * jack_port_get_buffer (jack_port_t *, jack_nframes_t);
  111. EXPORT const char * jack_port_name (const jack_port_t *port);
  112. EXPORT const char * jack_port_short_name (const jack_port_t *port);
  113. EXPORT int jack_port_flags (const jack_port_t *port);
  114. EXPORT const char * jack_port_type (const jack_port_t *port);
  115. EXPORT jack_port_type_id_t jack_port_type_id (const jack_port_t *port);
  116. EXPORT int jack_port_is_mine (const jack_client_t *, const jack_port_t *port);
  117. EXPORT int jack_port_connected (const jack_port_t *port);
  118. EXPORT int jack_port_connected_to (const jack_port_t *port,
  119. const char *port_name);
  120. EXPORT const char ** jack_port_get_connections (const jack_port_t *port);
  121. EXPORT const char ** jack_port_get_all_connections (const jack_client_t *client,
  122. const jack_port_t *port);
  123. EXPORT int jack_port_tie (jack_port_t *src, jack_port_t *dst);
  124. EXPORT int jack_port_untie (jack_port_t *port);
  125. EXPORT jack_nframes_t jack_port_get_latency (jack_port_t *port);
  126. EXPORT jack_nframes_t jack_port_get_total_latency (jack_client_t *,
  127. jack_port_t *port);
  128. EXPORT void jack_port_set_latency (jack_port_t *, jack_nframes_t);
  129. EXPORT int jack_recompute_total_latency (jack_client_t*, jack_port_t* port);
  130. EXPORT int jack_recompute_total_latencies (jack_client_t*);
  131. EXPORT int jack_port_set_name (jack_port_t *port, const char *port_name);
  132. EXPORT int jack_port_set_alias (jack_port_t *port, const char *alias);
  133. EXPORT int jack_port_unset_alias (jack_port_t *port, const char *alias);
  134. EXPORT int jack_port_get_aliases (const jack_port_t *port, char* const aliases[2]);
  135. EXPORT int jack_port_request_monitor (jack_port_t *port, int onoff);
  136. EXPORT int jack_port_request_monitor_by_name (jack_client_t *client,
  137. const char *port_name, int onoff);
  138. EXPORT int jack_port_ensure_monitor (jack_port_t *port, int onoff);
  139. EXPORT int jack_port_monitoring_input (jack_port_t *port);
  140. EXPORT int jack_connect (jack_client_t *,
  141. const char *source_port,
  142. const char *destination_port);
  143. EXPORT int jack_disconnect (jack_client_t *,
  144. const char *source_port,
  145. const char *destination_port);
  146. EXPORT int jack_port_disconnect (jack_client_t *, jack_port_t *);
  147. EXPORT int jack_port_name_size(void);
  148. EXPORT int jack_port_type_size(void);
  149. EXPORT jack_nframes_t jack_get_sample_rate (jack_client_t *);
  150. EXPORT jack_nframes_t jack_get_buffer_size (jack_client_t *);
  151. EXPORT const char ** jack_get_ports (jack_client_t *,
  152. const char *port_name_pattern,
  153. const char *type_name_pattern,
  154. unsigned long flags);
  155. EXPORT jack_port_t * jack_port_by_name (jack_client_t *, const char *port_name);
  156. EXPORT jack_port_t * jack_port_by_id (jack_client_t *client,
  157. jack_port_id_t port_id);
  158. EXPORT int jack_engine_takeover_timebase (jack_client_t *);
  159. EXPORT jack_nframes_t jack_frames_since_cycle_start (const jack_client_t *);
  160. EXPORT jack_time_t jack_get_time();
  161. EXPORT jack_nframes_t jack_time_to_frames(const jack_client_t *client, jack_time_t time);
  162. EXPORT jack_time_t jack_frames_to_time(const jack_client_t *client, jack_nframes_t frames);
  163. EXPORT jack_nframes_t jack_frame_time (const jack_client_t *);
  164. EXPORT jack_nframes_t jack_last_frame_time (const jack_client_t *client);
  165. EXPORT float jack_cpu_load (jack_client_t *client);
  166. EXPORT pthread_t jack_client_thread_id (jack_client_t *);
  167. EXPORT void jack_set_error_function (print_function);
  168. EXPORT void jack_set_info_function (print_function);
  169. EXPORT float jack_get_max_delayed_usecs (jack_client_t *client);
  170. EXPORT float jack_get_xrun_delayed_usecs (jack_client_t *client);
  171. EXPORT void jack_reset_max_delayed_usecs (jack_client_t *client);
  172. EXPORT int jack_release_timebase (jack_client_t *client);
  173. EXPORT int jack_set_sync_callback (jack_client_t *client,
  174. JackSyncCallback sync_callback,
  175. void *arg);
  176. EXPORT int jack_set_sync_timeout (jack_client_t *client,
  177. jack_time_t timeout);
  178. EXPORT int jack_set_timebase_callback (jack_client_t *client,
  179. int conditional,
  180. JackTimebaseCallback timebase_callback,
  181. void *arg);
  182. EXPORT int jack_transport_locate (jack_client_t *client,
  183. jack_nframes_t frame);
  184. EXPORT jack_transport_state_t jack_transport_query (const jack_client_t *client,
  185. jack_position_t *pos);
  186. EXPORT jack_nframes_t jack_get_current_transport_frame (const jack_client_t *client);
  187. EXPORT int jack_transport_reposition (jack_client_t *client,
  188. jack_position_t *pos);
  189. EXPORT void jack_transport_start (jack_client_t *client);
  190. EXPORT void jack_transport_stop (jack_client_t *client);
  191. EXPORT void jack_get_transport_info (jack_client_t *client,
  192. jack_transport_info_t *tinfo);
  193. EXPORT void jack_set_transport_info (jack_client_t *client,
  194. jack_transport_info_t *tinfo);
  195. EXPORT int jack_acquire_real_time_scheduling (pthread_t thread, int priority);
  196. EXPORT int jack_client_create_thread (jack_client_t* client,
  197. pthread_t *thread,
  198. int priority,
  199. int realtime, // boolean
  200. thread_routine routine,
  201. void *arg);
  202. EXPORT int jack_drop_real_time_scheduling (pthread_t thread);
  203. EXPORT int jack_client_stop_thread(jack_client_t* client, pthread_t thread);
  204. EXPORT int jack_client_kill_thread(jack_client_t* client, pthread_t thread);
  205. EXPORT char * jack_get_internal_client_name (jack_client_t *client,
  206. jack_intclient_t intclient);
  207. EXPORT jack_intclient_t jack_internal_client_handle (jack_client_t *client,
  208. const char *client_name,
  209. jack_status_t *status);
  210. EXPORT jack_intclient_t jack_internal_client_load (jack_client_t *client,
  211. const char *client_name,
  212. jack_options_t options,
  213. jack_status_t *status, ...);
  214. EXPORT jack_intclient_t jack_internal_client_load_aux (jack_client_t *client,
  215. const char *client_name,
  216. jack_options_t options,
  217. jack_status_t *status, va_list ap);
  218. EXPORT jack_status_t jack_internal_client_unload (jack_client_t *client,
  219. jack_intclient_t intclient);
  220. #ifdef __cplusplus
  221. }
  222. #endif
  223. static inline bool CheckPort(jack_port_id_t port_index)
  224. {
  225. return (port_index > 0 && port_index < PORT_NUM);
  226. }
  227. static inline bool CheckBufferSize(jack_nframes_t buffer_size)
  228. {
  229. return (buffer_size <= BUFFER_SIZE_MAX);
  230. }
  231. static inline void WaitGraphChange()
  232. {
  233. /*
  234. TLS key that is set only in RT thread, so never waits for pending
  235. graph change in RT context (just read the current graph state).
  236. */
  237. if (jack_tls_get(gRealTime) == NULL) {
  238. JackGraphManager* manager = GetGraphManager();
  239. JackEngineControl* control = GetEngineControl();
  240. assert(manager);
  241. assert(control);
  242. if (manager->IsPendingChange()) {
  243. jack_log("WaitGraphChange...");
  244. JackSleep(int(control->fPeriodUsecs * 1.1f));
  245. }
  246. }
  247. }
  248. EXPORT void jack_set_error_function (print_function func)
  249. {
  250. jack_error_callback = func;
  251. }
  252. EXPORT void jack_set_info_function (print_function func)
  253. {
  254. jack_info_callback = func;
  255. }
  256. EXPORT jack_client_t* jack_client_new(const char* client_name)
  257. {
  258. jack_error("jack_client_new: deprecated");
  259. int options = JackUseExactName;
  260. if (getenv("JACK_START_SERVER") == NULL)
  261. options |= JackNoStartServer;
  262. return jack_client_open_aux(client_name, (jack_options_t)options, NULL, NULL);
  263. }
  264. EXPORT void* jack_port_get_buffer(jack_port_t* port, jack_nframes_t frames)
  265. {
  266. #ifdef __CLIENTDEBUG__
  267. JackLibGlobals::CheckContext();
  268. #endif
  269. #if defined(__x86_64__) || defined(__ppc64__)
  270. uint64_t port_aux = (uint64_t)port;
  271. #else
  272. uint32_t port_aux = (uint32_t)port;
  273. #endif
  274. jack_port_id_t myport = (jack_port_id_t)port_aux;
  275. if (!CheckPort(myport)) {
  276. jack_error("jack_port_get_buffer called with an incorrect port %ld", myport);
  277. return NULL;
  278. } else {
  279. JackGraphManager* manager = GetGraphManager();
  280. return (manager ? manager->GetBuffer(myport, frames) : NULL);
  281. }
  282. }
  283. EXPORT const char* jack_port_name(const jack_port_t* port)
  284. {
  285. #ifdef __CLIENTDEBUG__
  286. JackLibGlobals::CheckContext();
  287. #endif
  288. #if defined(__x86_64__) || defined(__ppc64__)
  289. uint64_t port_aux = (uint64_t)port;
  290. #else
  291. uint32_t port_aux = (uint32_t)port;
  292. #endif
  293. jack_port_id_t myport = (jack_port_id_t)port_aux;
  294. if (!CheckPort(myport)) {
  295. jack_error("jack_port_name called with an incorrect port %ld", myport);
  296. return NULL;
  297. } else {
  298. JackGraphManager* manager = GetGraphManager();
  299. return (manager ? manager->GetPort(myport)->GetName() : NULL);
  300. }
  301. }
  302. EXPORT const char* jack_port_short_name(const jack_port_t* port)
  303. {
  304. #ifdef __CLIENTDEBUG__
  305. JackLibGlobals::CheckContext();
  306. #endif
  307. #if defined(__x86_64__) || defined(__ppc64__)
  308. uint64_t port_aux = (uint64_t)port;
  309. #else
  310. uint32_t port_aux = (uint32_t)port;
  311. #endif
  312. jack_port_id_t myport = (jack_port_id_t)port_aux;
  313. if (!CheckPort(myport)) {
  314. jack_error("jack_port_short_name called with an incorrect port %ld", myport);
  315. return NULL;
  316. } else {
  317. JackGraphManager* manager = GetGraphManager();
  318. return (manager ? manager->GetPort(myport)->GetShortName() : NULL);
  319. }
  320. }
  321. EXPORT int jack_port_flags(const jack_port_t* port)
  322. {
  323. #ifdef __CLIENTDEBUG__
  324. JackLibGlobals::CheckContext();
  325. #endif
  326. #if defined(__x86_64__) || defined(__ppc64__)
  327. uint64_t port_aux = (uint64_t)port;
  328. #else
  329. uint32_t port_aux = (uint32_t)port;
  330. #endif
  331. jack_port_id_t myport = (jack_port_id_t)port_aux;
  332. if (!CheckPort(myport)) {
  333. jack_error("jack_port_flags called with an incorrect port %ld", myport);
  334. return -1;
  335. } else {
  336. JackGraphManager* manager = GetGraphManager();
  337. return (manager ? manager->GetPort(myport)->GetFlags() : -1);
  338. }
  339. }
  340. EXPORT const char* jack_port_type(const jack_port_t* port)
  341. {
  342. #ifdef __CLIENTDEBUG__
  343. JackLibGlobals::CheckContext();
  344. #endif
  345. #if defined(__x86_64__) || defined(__ppc64__)
  346. uint64_t port_aux = (uint64_t)port;
  347. #else
  348. uint32_t port_aux = (uint32_t)port;
  349. #endif
  350. jack_port_id_t myport = (jack_port_id_t)port_aux;
  351. if (!CheckPort(myport)) {
  352. jack_error("jack_port_flags called an incorrect port %ld", myport);
  353. return NULL;
  354. } else {
  355. JackGraphManager* manager = GetGraphManager();
  356. return (manager ? manager->GetPort(myport)->GetType() : NULL);
  357. }
  358. }
  359. EXPORT jack_port_type_id_t jack_port_type_id(const jack_port_t *port)
  360. {
  361. #ifdef __CLIENTDEBUG__
  362. JackLibGlobals::CheckContext();
  363. #endif
  364. #if defined(__x86_64__) || defined(__ppc64__)
  365. uint64_t port_aux = (uint64_t)port;
  366. #else
  367. uint32_t port_aux = (uint32_t)port;
  368. #endif
  369. jack_port_id_t myport = (jack_port_id_t)port_aux;
  370. if (!CheckPort(myport)) {
  371. jack_error("jack_port_type_id called an incorrect port %ld", myport);
  372. return 0;
  373. } else {
  374. JackGraphManager* manager = GetGraphManager();
  375. return (manager ? GetPortTypeId(manager->GetPort(myport)->GetType()) : 0);
  376. }
  377. }
  378. EXPORT int jack_port_connected(const jack_port_t* port)
  379. {
  380. #ifdef __CLIENTDEBUG__
  381. JackLibGlobals::CheckContext();
  382. #endif
  383. #if defined(__x86_64__) || defined(__ppc64__)
  384. uint64_t port_aux = (uint64_t)port;
  385. #else
  386. uint32_t port_aux = (uint32_t)port;
  387. #endif
  388. jack_port_id_t myport = (jack_port_id_t)port_aux;
  389. if (!CheckPort(myport)) {
  390. jack_error("jack_port_connected called with an incorrect port %ld", myport);
  391. return -1;
  392. } else {
  393. WaitGraphChange();
  394. JackGraphManager* manager = GetGraphManager();
  395. return (manager ? manager->GetConnectionsNum(myport) : -1);
  396. }
  397. }
  398. EXPORT int jack_port_connected_to(const jack_port_t* port, const char* port_name)
  399. {
  400. #ifdef __CLIENTDEBUG__
  401. JackLibGlobals::CheckContext();
  402. #endif
  403. #if defined(__x86_64__) || defined(__ppc64__)
  404. uint64_t port_aux = (uint64_t)port;
  405. #else
  406. uint32_t port_aux = (uint32_t)port;
  407. #endif
  408. jack_port_id_t src = (jack_port_id_t)port_aux;
  409. if (!CheckPort(src)) {
  410. jack_error("jack_port_connected_to called with an incorrect port %ld", src);
  411. return -1;
  412. } else if (port_name == NULL) {
  413. jack_error("jack_port_connected_to called with a NULL port name");
  414. return -1;
  415. } else {
  416. WaitGraphChange();
  417. JackGraphManager* manager = GetGraphManager();
  418. jack_port_id_t dst = (manager ? manager->GetPort(port_name) : NO_PORT);
  419. if (dst == NO_PORT) {
  420. jack_error("Unknown destination port port_name = %s", port_name);
  421. return 0;
  422. } else {
  423. return manager->IsConnected(src, dst);
  424. }
  425. }
  426. }
  427. EXPORT int jack_port_tie(jack_port_t* src, jack_port_t* dst)
  428. {
  429. #ifdef __CLIENTDEBUG__
  430. JackLibGlobals::CheckContext();
  431. #endif
  432. #if defined(__x86_64__) || defined(__ppc64__)
  433. uint64_t src_aux = (uint64_t)src;
  434. #else
  435. uint32_t src_aux = (uint32_t)src;
  436. #endif
  437. jack_port_id_t mysrc = (jack_port_id_t)src_aux;
  438. if (!CheckPort(mysrc)) {
  439. jack_error("jack_port_tie called with a NULL src port");
  440. return -1;
  441. }
  442. #if defined(__x86_64__) || defined(__ppc64__)
  443. uint64_t dst_aux = (uint64_t)dst;
  444. #else
  445. uint32_t dst_aux = (uint32_t)dst;
  446. #endif
  447. jack_port_id_t mydst = (jack_port_id_t)dst_aux;
  448. if (!CheckPort(mydst)) {
  449. jack_error("jack_port_tie called with a NULL dst port");
  450. return -1;
  451. }
  452. JackGraphManager* manager = GetGraphManager();
  453. if (manager && manager->GetPort(mysrc)->GetRefNum() != manager->GetPort(mydst)->GetRefNum()) {
  454. jack_error("jack_port_tie called with ports not belonging to the same client");
  455. return -1;
  456. } else {
  457. return manager->GetPort(mydst)->Tie(mysrc);
  458. }
  459. }
  460. EXPORT int jack_port_untie(jack_port_t* port)
  461. {
  462. #ifdef __CLIENTDEBUG__
  463. JackLibGlobals::CheckContext();
  464. #endif
  465. #if defined(__x86_64__) || defined(__ppc64__)
  466. uint64_t port_aux = (uint64_t)port;
  467. #else
  468. uint32_t port_aux = (uint32_t)port;
  469. #endif
  470. jack_port_id_t myport = (jack_port_id_t)port_aux;
  471. if (!CheckPort(myport)) {
  472. jack_error("jack_port_untie called with an incorrect port %ld", myport);
  473. return -1;
  474. } else {
  475. JackGraphManager* manager = GetGraphManager();
  476. return (manager ? manager->GetPort(myport)->UnTie() : -1);
  477. }
  478. }
  479. EXPORT jack_nframes_t jack_port_get_latency(jack_port_t* port)
  480. {
  481. #ifdef __CLIENTDEBUG__
  482. JackLibGlobals::CheckContext();
  483. #endif
  484. #if defined(__x86_64__) || defined(__ppc64__)
  485. uint64_t port_aux = (uint64_t)port;
  486. #else
  487. uint32_t port_aux = (uint32_t)port;
  488. #endif
  489. jack_port_id_t myport = (jack_port_id_t)port_aux;
  490. if (!CheckPort(myport)) {
  491. jack_error("jack_port_get_latency called with an incorrect port %ld", myport);
  492. return 0;
  493. } else {
  494. WaitGraphChange();
  495. JackGraphManager* manager = GetGraphManager();
  496. return (manager ? manager->GetPort(myport)->GetLatency() : 0);
  497. }
  498. }
  499. EXPORT void jack_port_set_latency(jack_port_t* port, jack_nframes_t frames)
  500. {
  501. #ifdef __CLIENTDEBUG__
  502. JackLibGlobals::CheckContext();
  503. #endif
  504. #if defined(__x86_64__) || defined(__ppc64__)
  505. uint64_t port_aux = (uint64_t)port;
  506. #else
  507. uint32_t port_aux = (uint32_t)port;
  508. #endif
  509. jack_port_id_t myport = (jack_port_id_t)port_aux;
  510. if (!CheckPort(myport)) {
  511. jack_error("jack_port_set_latency called with an incorrect port %ld", myport);
  512. } else {
  513. JackGraphManager* manager = GetGraphManager();
  514. if (manager)
  515. manager->GetPort(myport)->SetLatency(frames);
  516. }
  517. }
  518. EXPORT int jack_recompute_total_latency(jack_client_t* ext_client, jack_port_t* port)
  519. {
  520. #ifdef __CLIENTDEBUG__
  521. JackLibGlobals::CheckContext();
  522. #endif
  523. JackClient* client = (JackClient*)ext_client;
  524. #if defined(__x86_64__) || defined(__ppc64__)
  525. uint64_t port_aux = (uint64_t)port;
  526. #else
  527. uint32_t port_aux = (uint32_t)port;
  528. #endif
  529. jack_port_id_t myport = (jack_port_id_t)port_aux;
  530. if (client == NULL) {
  531. jack_error("jack_recompute_total_latencies called with a NULL client");
  532. return -1;
  533. } else if (!CheckPort(myport)) {
  534. jack_error("jack_recompute_total_latencies called with a NULL port");
  535. return -1;
  536. } else {
  537. WaitGraphChange();
  538. JackGraphManager* manager = GetGraphManager();
  539. return (manager ? manager->ComputeTotalLatency(myport) : -1);
  540. }
  541. }
  542. EXPORT int jack_recompute_total_latencies(jack_client_t* ext_client)
  543. {
  544. #ifdef __CLIENTDEBUG__
  545. JackLibGlobals::CheckContext();
  546. #endif
  547. JackClient* client = (JackClient*)ext_client;
  548. if (client == NULL) {
  549. jack_error("jack_recompute_total_latencies called with a NULL client");
  550. return -1;
  551. } else {
  552. WaitGraphChange();
  553. JackGraphManager* manager = GetGraphManager();
  554. return (manager ? manager->ComputeTotalLatencies() : -1);
  555. }
  556. }
  557. /*
  558. This is unsafe if case of concurrent access, and should be "serialized" doing a server call.
  559. */
  560. EXPORT int jack_port_set_name(jack_port_t* port, const char* name)
  561. {
  562. #ifdef __CLIENTDEBUG__
  563. JackLibGlobals::CheckContext();
  564. #endif
  565. #if defined(__x86_64__) || defined(__ppc64__)
  566. uint64_t port_aux = (uint64_t)port;
  567. #else
  568. uint32_t port_aux = (uint32_t)port;
  569. #endif
  570. jack_port_id_t myport = (jack_port_id_t)port_aux;
  571. if (!CheckPort(myport)) {
  572. jack_error("jack_port_set_name called with an incorrect port %ld", myport);
  573. return -1;
  574. } else if (name == NULL) {
  575. jack_error("jack_port_set_name called with a NULL port name");
  576. return -1;
  577. } else {
  578. JackGraphManager* manager = GetGraphManager();
  579. int refnum;
  580. if (manager && ((refnum = manager->GetPort(myport)->GetRefNum()) > 0)) {
  581. JackClient* client = JackClient::fClientTable[refnum];
  582. assert(client);
  583. return client->PortRename(myport, name);
  584. } else {
  585. return -1;
  586. }
  587. }
  588. }
  589. EXPORT int jack_port_set_alias(jack_port_t* port, const char* name)
  590. {
  591. #ifdef __CLIENTDEBUG__
  592. JackLibGlobals::CheckContext();
  593. #endif
  594. #if defined(__x86_64__) || defined(__ppc64__)
  595. uint64_t port_aux = (uint64_t)port;
  596. #else
  597. uint32_t port_aux = (uint32_t)port;
  598. #endif
  599. jack_port_id_t myport = (jack_port_id_t)port_aux;
  600. if (!CheckPort(myport)) {
  601. jack_error("jack_port_set_alias called with an incorrect port %ld", myport);
  602. return -1;
  603. } else if (name == NULL) {
  604. jack_error("jack_port_set_alias called with a NULL port name");
  605. return -1;
  606. } else {
  607. JackGraphManager* manager = GetGraphManager();
  608. return (manager ? manager->GetPort(myport)->SetAlias(name) : -1);
  609. }
  610. }
  611. EXPORT int jack_port_unset_alias(jack_port_t* port, const char* name)
  612. {
  613. #ifdef __CLIENTDEBUG__
  614. JackLibGlobals::CheckContext();
  615. #endif
  616. #if defined(__x86_64__) || defined(__ppc64__)
  617. uint64_t port_aux = (uint64_t)port;
  618. #else
  619. uint32_t port_aux = (uint32_t)port;
  620. #endif
  621. jack_port_id_t myport = (jack_port_id_t)port_aux;
  622. if (!CheckPort(myport)) {
  623. jack_error("jack_port_unset_alias called with an incorrect port %ld", myport);
  624. return -1;
  625. } else if (name == NULL) {
  626. jack_error("jack_port_unset_alias called with a NULL port name");
  627. return -1;
  628. } else {
  629. JackGraphManager* manager = GetGraphManager();
  630. return (manager ? manager->GetPort(myport)->UnsetAlias(name) : -1);
  631. }
  632. }
  633. EXPORT int jack_port_get_aliases(const jack_port_t* port, char* const aliases[2])
  634. {
  635. #ifdef __CLIENTDEBUG__
  636. JackLibGlobals::CheckContext();
  637. #endif
  638. #if defined(__x86_64__) || defined(__ppc64__)
  639. uint64_t port_aux = (uint64_t)port;
  640. #else
  641. uint32_t port_aux = (uint32_t)port;
  642. #endif
  643. jack_port_id_t myport = (jack_port_id_t)port_aux;
  644. if (!CheckPort(myport)) {
  645. jack_error("jack_port_get_aliases called with an incorrect port %ld", myport);
  646. return -1;
  647. } else {
  648. JackGraphManager* manager = GetGraphManager();
  649. return (manager ? manager->GetPort(myport)->GetAliases(aliases) : -1);
  650. }
  651. }
  652. EXPORT int jack_port_request_monitor(jack_port_t* port, int onoff)
  653. {
  654. #ifdef __CLIENTDEBUG__
  655. JackLibGlobals::CheckContext();
  656. #endif
  657. #if defined(__x86_64__) || defined(__ppc64__)
  658. uint64_t port_aux = (uint64_t)port;
  659. #else
  660. uint32_t port_aux = (uint32_t)port;
  661. #endif
  662. jack_port_id_t myport = (jack_port_id_t)port_aux;
  663. if (!CheckPort(myport)) {
  664. jack_error("jack_port_request_monitor called with an incorrect port %ld", myport);
  665. return -1;
  666. } else {
  667. JackGraphManager* manager = GetGraphManager();
  668. return (manager ? manager->RequestMonitor(myport, onoff) : -1);
  669. }
  670. }
  671. EXPORT int jack_port_request_monitor_by_name(jack_client_t* ext_client, const char* port_name, int onoff)
  672. {
  673. #ifdef __CLIENTDEBUG__
  674. JackLibGlobals::CheckContext();
  675. #endif
  676. JackClient* client = (JackClient*)ext_client;
  677. if (client == NULL) {
  678. jack_error("jack_port_request_monitor_by_name called with a NULL client");
  679. return -1;
  680. } else {
  681. JackGraphManager* manager = GetGraphManager();
  682. if (!manager)
  683. return -1;
  684. jack_port_id_t myport = manager->GetPort(port_name);
  685. if (!CheckPort(myport)) {
  686. jack_error("jack_port_request_monitor_by_name called with an incorrect port %s", port_name);
  687. return -1;
  688. } else {
  689. return manager->RequestMonitor(myport, onoff);
  690. }
  691. }
  692. }
  693. EXPORT int jack_port_ensure_monitor(jack_port_t* port, int onoff)
  694. {
  695. #ifdef __CLIENTDEBUG__
  696. JackLibGlobals::CheckContext();
  697. #endif
  698. #if defined(__x86_64__) || defined(__ppc64__)
  699. uint64_t port_aux = (uint64_t)port;
  700. #else
  701. uint32_t port_aux = (uint32_t)port;
  702. #endif
  703. jack_port_id_t myport = (jack_port_id_t)port_aux;
  704. if (!CheckPort(myport)) {
  705. jack_error("jack_port_ensure_monitor called with an incorrect port %ld", myport);
  706. return -1;
  707. } else {
  708. JackGraphManager* manager = GetGraphManager();
  709. return (manager ? manager->GetPort(myport)->EnsureMonitor(onoff) : -1);
  710. }
  711. }
  712. EXPORT int jack_port_monitoring_input(jack_port_t* port)
  713. {
  714. #ifdef __CLIENTDEBUG__
  715. JackLibGlobals::CheckContext();
  716. #endif
  717. #if defined(__x86_64__) || defined(__ppc64__)
  718. uint64_t port_aux = (uint64_t)port;
  719. #else
  720. uint32_t port_aux = (uint32_t)port;
  721. #endif
  722. jack_port_id_t myport = (jack_port_id_t)port_aux;
  723. if (!CheckPort(myport)) {
  724. jack_error("jack_port_monitoring_input called with an incorrect port %ld", myport);
  725. return -1;
  726. } else {
  727. JackGraphManager* manager = GetGraphManager();
  728. return (manager ? manager->GetPort(myport)->MonitoringInput() : -1);
  729. }
  730. }
  731. EXPORT int jack_is_realtime(jack_client_t* ext_client)
  732. {
  733. #ifdef __CLIENTDEBUG__
  734. JackLibGlobals::CheckContext();
  735. #endif
  736. JackClient* client = (JackClient*)ext_client;
  737. if (client == NULL) {
  738. jack_error("jack_is_realtime called with a NULL client");
  739. return -1;
  740. } else {
  741. JackEngineControl* control = GetEngineControl();
  742. return (control ? control->fRealTime : -1);
  743. }
  744. }
  745. EXPORT void jack_on_shutdown(jack_client_t* ext_client, JackShutdownCallback callback, void* arg)
  746. {
  747. #ifdef __CLIENTDEBUG__
  748. JackLibGlobals::CheckContext();
  749. #endif
  750. JackClient* client = (JackClient*)ext_client;
  751. if (client == NULL) {
  752. jack_error("jack_on_shutdown called with a NULL client");
  753. } else {
  754. client->OnShutdown(callback, arg);
  755. }
  756. }
  757. EXPORT int jack_set_process_callback(jack_client_t* ext_client, JackProcessCallback callback, void* arg)
  758. {
  759. #ifdef __CLIENTDEBUG__
  760. JackLibGlobals::CheckContext();
  761. #endif
  762. JackClient* client = (JackClient*)ext_client;
  763. if (client == NULL) {
  764. jack_error("jack_set_process_callback called with a NULL client");
  765. return -1;
  766. } else {
  767. return client->SetProcessCallback(callback, arg);
  768. }
  769. }
  770. EXPORT jack_nframes_t jack_thread_wait(jack_client_t* ext_client, int status)
  771. {
  772. #ifdef __CLIENTDEBUG__
  773. JackLibGlobals::CheckContext();
  774. #endif
  775. JackClient* client = (JackClient*)ext_client;
  776. if (client == NULL) {
  777. jack_error("jack_thread_wait called with a NULL client");
  778. return 0;
  779. } else {
  780. return client->Wait(status);
  781. }
  782. }
  783. EXPORT jack_nframes_t jack_cycle_wait(jack_client_t* ext_client)
  784. {
  785. #ifdef __CLIENTDEBUG__
  786. JackLibGlobals::CheckContext();
  787. #endif
  788. JackClient* client = (JackClient*)ext_client;
  789. if (client == NULL) {
  790. jack_error("jack_cycle_wait called with a NULL client");
  791. return 0;
  792. } else {
  793. return client->CycleWait();
  794. }
  795. }
  796. EXPORT void jack_cycle_signal(jack_client_t* ext_client, int status)
  797. {
  798. #ifdef __CLIENTDEBUG__
  799. JackLibGlobals::CheckContext();
  800. #endif
  801. JackClient* client = (JackClient*)ext_client;
  802. if (client == NULL) {
  803. jack_error("jack_cycle_signal called with a NULL client");
  804. } else {
  805. client->CycleSignal(status);
  806. }
  807. }
  808. EXPORT int jack_set_process_thread(jack_client_t* ext_client, JackThreadCallback fun, void *arg)
  809. {
  810. #ifdef __CLIENTDEBUG__
  811. JackLibGlobals::CheckContext();
  812. #endif
  813. JackClient* client = (JackClient*)ext_client;
  814. if (client == NULL) {
  815. jack_error("jack_set_process_thread called with a NULL client");
  816. return -1;
  817. } else {
  818. return client->SetProcessThread(fun, arg);
  819. }
  820. }
  821. EXPORT int jack_set_freewheel_callback(jack_client_t* ext_client, JackFreewheelCallback freewheel_callback, void* arg)
  822. {
  823. #ifdef __CLIENTDEBUG__
  824. JackLibGlobals::CheckContext();
  825. #endif
  826. JackClient* client = (JackClient*)ext_client;
  827. if (client == NULL) {
  828. jack_error("jack_set_freewheel_callback called with a NULL client");
  829. return -1;
  830. } else {
  831. return client->SetFreewheelCallback(freewheel_callback, arg);
  832. }
  833. }
  834. EXPORT int jack_set_freewheel(jack_client_t* ext_client, int onoff)
  835. {
  836. #ifdef __CLIENTDEBUG__
  837. JackLibGlobals::CheckContext();
  838. #endif
  839. JackClient* client = (JackClient*)ext_client;
  840. if (client == NULL) {
  841. jack_error("jack_set_freewheel called with a NULL client");
  842. return -1;
  843. } else {
  844. return client->SetFreeWheel(onoff);
  845. }
  846. }
  847. EXPORT int jack_set_buffer_size(jack_client_t* ext_client, jack_nframes_t buffer_size)
  848. {
  849. #ifdef __CLIENTDEBUG__
  850. JackLibGlobals::CheckContext();
  851. #endif
  852. JackClient* client = (JackClient*)ext_client;
  853. if (client == NULL) {
  854. jack_error("jack_set_buffer_size called with a NULL client");
  855. return -1;
  856. } else if (!CheckBufferSize(buffer_size)) {
  857. return -1;
  858. } else {
  859. return client->SetBufferSize(buffer_size);
  860. }
  861. }
  862. EXPORT int jack_set_buffer_size_callback(jack_client_t* ext_client, JackBufferSizeCallback bufsize_callback, void* arg)
  863. {
  864. #ifdef __CLIENTDEBUG__
  865. JackLibGlobals::CheckContext();
  866. #endif
  867. JackClient* client = (JackClient*)ext_client;
  868. if (client == NULL) {
  869. jack_error("jack_set_buffer_size_callback called with a NULL client");
  870. return -1;
  871. } else {
  872. return client->SetBufferSizeCallback(bufsize_callback, arg);
  873. }
  874. }
  875. EXPORT int jack_set_sample_rate_callback(jack_client_t* ext_client, JackSampleRateCallback srate_callback, void* arg)
  876. {
  877. #ifdef __CLIENTDEBUG__
  878. JackLibGlobals::CheckContext();
  879. #endif
  880. JackClient* client = (JackClient*)ext_client;
  881. if (client == NULL) {
  882. jack_error("jack_set_sample_rate_callback called with a NULL client");
  883. return -1;
  884. } else {
  885. return client->SetSampleRateCallback(srate_callback, arg);
  886. }
  887. }
  888. EXPORT int jack_set_client_registration_callback(jack_client_t* ext_client, JackClientRegistrationCallback registration_callback, void* arg)
  889. {
  890. #ifdef __CLIENTDEBUG__
  891. JackLibGlobals::CheckContext();
  892. #endif
  893. JackClient* client = (JackClient*)ext_client;
  894. if (client == NULL) {
  895. jack_error("jack_set_client_registration_callback called with a NULL client");
  896. return -1;
  897. } else {
  898. return client->SetClientRegistrationCallback(registration_callback, arg);
  899. }
  900. }
  901. EXPORT int jack_set_port_registration_callback(jack_client_t* ext_client, JackPortRegistrationCallback registration_callback, void* arg)
  902. {
  903. #ifdef __CLIENTDEBUG__
  904. JackLibGlobals::CheckContext();
  905. #endif
  906. JackClient* client = (JackClient*)ext_client;
  907. if (client == NULL) {
  908. jack_error("jack_set_port_registration_callback called with a NULL client");
  909. return -1;
  910. } else {
  911. return client->SetPortRegistrationCallback(registration_callback, arg);
  912. }
  913. }
  914. EXPORT int jack_set_port_connect_callback(jack_client_t* ext_client, JackPortConnectCallback portconnect_callback, void* arg)
  915. {
  916. #ifdef __CLIENTDEBUG__
  917. JackLibGlobals::CheckContext();
  918. #endif
  919. JackClient* client = (JackClient*)ext_client;
  920. if (client == NULL) {
  921. jack_error("jack_set_port_connect_callback called with a NULL client");
  922. return -1;
  923. } else {
  924. return client->SetPortConnectCallback(portconnect_callback, arg);
  925. }
  926. }
  927. EXPORT int jack_set_port_rename_callback(jack_client_t* ext_client, JackPortRenameCallback rename_callback, void* arg)
  928. {
  929. #ifdef __CLIENTDEBUG__
  930. JackLibGlobals::CheckContext();
  931. #endif
  932. JackClient* client = (JackClient*)ext_client;
  933. if (client == NULL) {
  934. jack_error("jack_set_port_rename_callback called with a NULL client");
  935. return -1;
  936. } else {
  937. return client->SetPortRenameCallback(rename_callback, arg);
  938. }
  939. }
  940. EXPORT int jack_set_graph_order_callback(jack_client_t* ext_client, JackGraphOrderCallback graph_callback, void* arg)
  941. {
  942. #ifdef __CLIENTDEBUG__
  943. JackLibGlobals::CheckContext();
  944. #endif
  945. JackClient* client = (JackClient*)ext_client;
  946. jack_log("jack_set_graph_order_callback ext_client %x client %x ", ext_client, client);
  947. if (client == NULL) {
  948. jack_error("jack_set_graph_order_callback called with a NULL client");
  949. return -1;
  950. } else {
  951. return client->SetGraphOrderCallback(graph_callback, arg);
  952. }
  953. }
  954. EXPORT int jack_set_xrun_callback(jack_client_t* ext_client, JackXRunCallback xrun_callback, void* arg)
  955. {
  956. #ifdef __CLIENTDEBUG__
  957. JackLibGlobals::CheckContext();
  958. #endif
  959. JackClient* client = (JackClient*)ext_client;
  960. if (client == NULL) {
  961. jack_error("jack_set_xrun_callback called with a NULL client");
  962. return -1;
  963. } else {
  964. return client->SetXRunCallback(xrun_callback, arg);
  965. }
  966. }
  967. EXPORT int jack_set_thread_init_callback(jack_client_t* ext_client, JackThreadInitCallback init_callback, void *arg)
  968. {
  969. #ifdef __CLIENTDEBUG__
  970. JackLibGlobals::CheckContext();
  971. #endif
  972. JackClient* client = (JackClient*)ext_client;
  973. jack_log("jack_set_thread_init_callback ext_client %x client %x ", ext_client, client);
  974. if (client == NULL) {
  975. jack_error("jack_set_thread_init_callback called with a NULL client");
  976. return -1;
  977. } else {
  978. return client->SetInitCallback(init_callback, arg);
  979. }
  980. }
  981. EXPORT int jack_activate(jack_client_t* ext_client)
  982. {
  983. #ifdef __CLIENTDEBUG__
  984. JackLibGlobals::CheckContext();
  985. #endif
  986. JackClient* client = (JackClient*)ext_client;
  987. if (client == NULL) {
  988. jack_error("jack_activate called with a NULL client");
  989. return -1;
  990. } else {
  991. return client->Activate();
  992. }
  993. }
  994. EXPORT int jack_deactivate(jack_client_t* ext_client)
  995. {
  996. #ifdef __CLIENTDEBUG__
  997. JackLibGlobals::CheckContext();
  998. #endif
  999. JackClient* client = (JackClient*)ext_client;
  1000. if (client == NULL) {
  1001. jack_error("jack_deactivate called with a NULL client");
  1002. return -1;
  1003. } else {
  1004. return client->Deactivate();
  1005. }
  1006. }
  1007. EXPORT jack_port_t* jack_port_register(jack_client_t* ext_client, const char* port_name, const char* port_type, unsigned long flags, unsigned long buffer_size)
  1008. {
  1009. #ifdef __CLIENTDEBUG__
  1010. JackLibGlobals::CheckContext();
  1011. #endif
  1012. JackClient* client = (JackClient*)ext_client;
  1013. if (client == NULL) {
  1014. jack_error("jack_port_register called with a NULL client");
  1015. return NULL;
  1016. } else if ((port_name == NULL) || (port_type == NULL)) {
  1017. jack_error("jack_port_register called with a NULL port name or a NULL port_type");
  1018. return NULL;
  1019. } else {
  1020. return (jack_port_t *)client->PortRegister(port_name, port_type, flags, buffer_size);
  1021. }
  1022. }
  1023. EXPORT int jack_port_unregister(jack_client_t* ext_client, jack_port_t* port)
  1024. {
  1025. #ifdef __CLIENTDEBUG__
  1026. JackLibGlobals::CheckContext();
  1027. #endif
  1028. JackClient* client = (JackClient*)ext_client;
  1029. if (client == NULL) {
  1030. jack_error("jack_port_unregister called with a NULL client");
  1031. return -1;
  1032. }
  1033. #if defined(__x86_64__) || defined(__ppc64__)
  1034. uint64_t port_aux = (uint64_t)port;
  1035. #else
  1036. uint32_t port_aux = (uint32_t)port;
  1037. #endif
  1038. jack_port_id_t myport = (jack_port_id_t)port_aux;
  1039. if (!CheckPort(myport)) {
  1040. jack_error("jack_port_unregister called with an incorrect port %ld", myport);
  1041. return -1;
  1042. }
  1043. return client->PortUnRegister(myport);
  1044. }
  1045. EXPORT int jack_port_is_mine(const jack_client_t* ext_client, const jack_port_t* port)
  1046. {
  1047. #ifdef __CLIENTDEBUG__
  1048. JackLibGlobals::CheckContext();
  1049. #endif
  1050. JackClient* client = (JackClient*)ext_client;
  1051. if (client == NULL) {
  1052. jack_error("jack_port_is_mine called with a NULL client");
  1053. return -1;
  1054. }
  1055. #if defined(__x86_64__) || defined(__ppc64__)
  1056. uint64_t port_aux = (uint64_t)port;
  1057. #else
  1058. uint32_t port_aux = (uint32_t)port;
  1059. #endif
  1060. jack_port_id_t myport = (jack_port_id_t)port_aux;
  1061. if (!CheckPort(myport)) {
  1062. jack_error("jack_port_is_mine called with an incorrect port %ld", myport);
  1063. return -1;
  1064. }
  1065. return client->PortIsMine(myport);
  1066. }
  1067. EXPORT const char** jack_port_get_connections(const jack_port_t* port)
  1068. {
  1069. #ifdef __CLIENTDEBUG__
  1070. JackLibGlobals::CheckContext();
  1071. #endif
  1072. #if defined(__x86_64__) || defined(__ppc64__)
  1073. uint64_t port_aux = (uint64_t)port;
  1074. #else
  1075. uint32_t port_aux = (uint32_t)port;
  1076. #endif
  1077. jack_port_id_t myport = (jack_port_id_t)port_aux;
  1078. if (!CheckPort(myport)) {
  1079. jack_error("jack_port_get_connections called with an incorrect port %ld", myport);
  1080. return NULL;
  1081. } else {
  1082. WaitGraphChange();
  1083. JackGraphManager* manager = GetGraphManager();
  1084. return (manager ? manager->GetConnections(myport) : NULL);
  1085. }
  1086. }
  1087. // Calling client does not need to "own" the port
  1088. EXPORT const char** jack_port_get_all_connections(const jack_client_t* ext_client, const jack_port_t* port)
  1089. {
  1090. #ifdef __CLIENTDEBUG__
  1091. JackLibGlobals::CheckContext();
  1092. #endif
  1093. JackClient* client = (JackClient*)ext_client;
  1094. if (client == NULL) {
  1095. jack_error("jack_port_get_all_connections called with a NULL client");
  1096. return NULL;
  1097. }
  1098. #if defined(__x86_64__) || defined(__ppc64__)
  1099. uint64_t port_aux = (uint64_t)port;
  1100. #else
  1101. uint32_t port_aux = (uint32_t)port;
  1102. #endif
  1103. jack_port_id_t myport = (jack_port_id_t)port_aux;
  1104. if (!CheckPort(myport)) {
  1105. jack_error("jack_port_get_all_connections called with an incorrect port %ld", myport);
  1106. return NULL;
  1107. } else {
  1108. WaitGraphChange();
  1109. JackGraphManager* manager = GetGraphManager();
  1110. return (manager ? manager->GetConnections(myport) : NULL);
  1111. }
  1112. }
  1113. EXPORT jack_nframes_t jack_port_get_total_latency(jack_client_t* ext_client, jack_port_t* port)
  1114. {
  1115. #ifdef __CLIENTDEBUG__
  1116. JackLibGlobals::CheckContext();
  1117. #endif
  1118. JackClient* client = (JackClient*)ext_client;
  1119. if (client == NULL) {
  1120. jack_error("jack_port_get_total_latency called with a NULL client");
  1121. return 0;
  1122. }
  1123. #if defined(__x86_64__) || defined(__ppc64__)
  1124. uint64_t port_aux = (uint64_t)port;
  1125. #else
  1126. uint32_t port_aux = (uint32_t)port;
  1127. #endif
  1128. jack_port_id_t myport = (jack_port_id_t)port_aux;
  1129. if (!CheckPort(myport)) {
  1130. jack_error("jack_port_get_total_latency called with an incorrect port %ld", myport);
  1131. return 0;
  1132. } else {
  1133. WaitGraphChange();
  1134. JackGraphManager* manager = GetGraphManager();
  1135. if (manager) {
  1136. manager->ComputeTotalLatency(myport);
  1137. return manager->GetPort(myport)->GetTotalLatency();
  1138. } else {
  1139. return 0;
  1140. }
  1141. }
  1142. }
  1143. EXPORT int jack_connect(jack_client_t* ext_client, const char* src, const char* dst)
  1144. {
  1145. #ifdef __CLIENTDEBUG__
  1146. JackLibGlobals::CheckContext();
  1147. #endif
  1148. JackClient* client = (JackClient*)ext_client;
  1149. if (client == NULL) {
  1150. jack_error("jack_connect called with a NULL client");
  1151. return -1;
  1152. } else if ((src == NULL) || (dst == NULL)) {
  1153. jack_error("jack_connect called with a NULL port name");
  1154. return -1;
  1155. } else {
  1156. return client->PortConnect(src, dst);
  1157. }
  1158. }
  1159. EXPORT int jack_disconnect(jack_client_t* ext_client, const char* src, const char* dst)
  1160. {
  1161. #ifdef __CLIENTDEBUG__
  1162. JackLibGlobals::CheckContext();
  1163. #endif
  1164. JackClient* client = (JackClient*)ext_client;
  1165. if (client == NULL) {
  1166. jack_error("jack_disconnect called with a NULL client");
  1167. return -1;
  1168. } else if ((src == NULL) || (dst == NULL)) {
  1169. jack_error("jack_connect called with a NULL port name");
  1170. return -1;
  1171. } else {
  1172. return client->PortDisconnect(src, dst);
  1173. }
  1174. }
  1175. EXPORT int jack_port_disconnect(jack_client_t* ext_client, jack_port_t* src)
  1176. {
  1177. #ifdef __CLIENTDEBUG__
  1178. JackLibGlobals::CheckContext();
  1179. #endif
  1180. JackClient* client = (JackClient*)ext_client;
  1181. if (client == NULL) {
  1182. jack_error("jack_port_disconnect called with a NULL client");
  1183. return -1;
  1184. }
  1185. #if defined(__x86_64__) || defined(__ppc64__)
  1186. uint64_t port_aux = (uint64_t)src;
  1187. #else
  1188. uint32_t port_aux = (uint32_t)src;
  1189. #endif
  1190. jack_port_id_t myport = (jack_port_id_t)port_aux;
  1191. if (!CheckPort(myport)) {
  1192. jack_error("jack_port_disconnect called with an incorrect port %ld", myport);
  1193. return -1;
  1194. }
  1195. return client->PortDisconnect(myport);
  1196. }
  1197. EXPORT jack_nframes_t jack_get_sample_rate(jack_client_t* ext_client)
  1198. {
  1199. #ifdef __CLIENTDEBUG__
  1200. JackLibGlobals::CheckContext();
  1201. #endif
  1202. JackClient* client = (JackClient*)ext_client;
  1203. if (client == NULL) {
  1204. jack_error("jack_get_sample_rate called with a NULL client");
  1205. return 0;
  1206. } else {
  1207. JackEngineControl* control = GetEngineControl();
  1208. return (control ? control->fSampleRate : 0);
  1209. }
  1210. }
  1211. EXPORT jack_nframes_t jack_get_buffer_size(jack_client_t* ext_client)
  1212. {
  1213. #ifdef __CLIENTDEBUG__
  1214. JackLibGlobals::CheckContext();
  1215. #endif
  1216. JackClient* client = (JackClient*)ext_client;
  1217. if (client == NULL) {
  1218. jack_error("jack_get_buffer_size called with a NULL client");
  1219. return 0;
  1220. } else {
  1221. JackEngineControl* control = GetEngineControl();
  1222. return (control ? control->fBufferSize : 0);
  1223. }
  1224. }
  1225. EXPORT const char** jack_get_ports(jack_client_t* ext_client, const char* port_name_pattern, const char* type_name_pattern, unsigned long flags)
  1226. {
  1227. #ifdef __CLIENTDEBUG__
  1228. JackLibGlobals::CheckContext();
  1229. #endif
  1230. JackClient* client = (JackClient*)ext_client;
  1231. if (client == NULL) {
  1232. jack_error("jack_get_ports called with a NULL client");
  1233. return NULL;
  1234. }
  1235. JackGraphManager* manager = GetGraphManager();
  1236. return (manager ? manager->GetPorts(port_name_pattern, type_name_pattern, flags) : NULL);
  1237. }
  1238. EXPORT jack_port_t* jack_port_by_name(jack_client_t* ext_client, const char* portname)
  1239. {
  1240. #ifdef __CLIENTDEBUG__
  1241. JackLibGlobals::CheckContext();
  1242. #endif
  1243. JackClient* client = (JackClient*)ext_client;
  1244. if (client == NULL) {
  1245. jack_error("jack_get_ports called with a NULL client");
  1246. return 0;
  1247. }
  1248. if (portname == NULL) {
  1249. jack_error("jack_port_by_name called with a NULL port name");
  1250. return NULL;
  1251. } else {
  1252. JackGraphManager* manager = GetGraphManager();
  1253. if (!manager)
  1254. return NULL;
  1255. int res = manager->GetPort(portname); // returns a port index at least > 1
  1256. return (res == NO_PORT) ? NULL : (jack_port_t*)res;
  1257. }
  1258. }
  1259. EXPORT jack_port_t* jack_port_by_id(jack_client_t* ext_client, jack_port_id_t id)
  1260. {
  1261. #ifdef __CLIENTDEBUG__
  1262. JackLibGlobals::CheckContext();
  1263. #endif
  1264. /* jack_port_t* type is actually the port index */
  1265. return (jack_port_t*)id;
  1266. }
  1267. EXPORT int jack_engine_takeover_timebase(jack_client_t* ext_client)
  1268. {
  1269. #ifdef __CLIENTDEBUG__
  1270. JackLibGlobals::CheckContext();
  1271. #endif
  1272. JackClient* client = (JackClient*)ext_client;
  1273. if (client == NULL) {
  1274. jack_error("jack_engine_takeover_timebase called with a NULL client");
  1275. return -1;
  1276. } else {
  1277. jack_error("jack_engine_takeover_timebase: deprecated\n");
  1278. return 0;
  1279. }
  1280. }
  1281. EXPORT jack_nframes_t jack_frames_since_cycle_start(const jack_client_t* ext_client)
  1282. {
  1283. #ifdef __CLIENTDEBUG__
  1284. JackLibGlobals::CheckContext();
  1285. #endif
  1286. JackTimer timer;
  1287. JackEngineControl* control = GetEngineControl();
  1288. if (control) {
  1289. control->ReadFrameTime(&timer);
  1290. return timer.FramesSinceCycleStart(GetMicroSeconds(), control->fSampleRate);
  1291. } else {
  1292. return 0;
  1293. }
  1294. }
  1295. EXPORT jack_time_t jack_get_time()
  1296. {
  1297. return GetMicroSeconds();
  1298. }
  1299. EXPORT jack_time_t jack_frames_to_time(const jack_client_t* ext_client, jack_nframes_t frames)
  1300. {
  1301. #ifdef __CLIENTDEBUG__
  1302. JackLibGlobals::CheckContext();
  1303. #endif
  1304. JackClient* client = (JackClient*)ext_client;
  1305. if (client == NULL) {
  1306. jack_error("jack_frames_to_time called with a NULL client");
  1307. return 0;
  1308. } else {
  1309. JackTimer timer;
  1310. JackEngineControl* control = GetEngineControl();
  1311. if (control) {
  1312. control->ReadFrameTime(&timer);
  1313. return timer.Frames2Time(frames, control->fBufferSize);
  1314. } else {
  1315. return 0;
  1316. }
  1317. }
  1318. }
  1319. EXPORT jack_nframes_t jack_time_to_frames(const jack_client_t* ext_client, jack_time_t time)
  1320. {
  1321. #ifdef __CLIENTDEBUG__
  1322. JackLibGlobals::CheckContext();
  1323. #endif
  1324. JackClient* client = (JackClient*)ext_client;
  1325. if (client == NULL) {
  1326. jack_error("jack_time_to_frames called with a NULL client");
  1327. return 0;
  1328. } else {
  1329. JackTimer timer;
  1330. JackEngineControl* control = GetEngineControl();
  1331. if (control) {
  1332. control->ReadFrameTime(&timer);
  1333. return timer.Time2Frames(time, control->fBufferSize);
  1334. } else {
  1335. return 0;
  1336. }
  1337. }
  1338. }
  1339. EXPORT jack_nframes_t jack_frame_time(const jack_client_t* ext_client)
  1340. {
  1341. return jack_time_to_frames(ext_client, GetMicroSeconds());
  1342. }
  1343. EXPORT jack_nframes_t jack_last_frame_time(const jack_client_t* ext_client)
  1344. {
  1345. #ifdef __CLIENTDEBUG__
  1346. JackLibGlobals::CheckContext();
  1347. #endif
  1348. JackTimer timer;
  1349. JackEngineControl* control = GetEngineControl();
  1350. if (control) {
  1351. control->ReadFrameTime(&timer);
  1352. return timer.CurFrame();
  1353. } else {
  1354. return 0;
  1355. }
  1356. }
  1357. EXPORT float jack_cpu_load(jack_client_t* ext_client)
  1358. {
  1359. #ifdef __CLIENTDEBUG__
  1360. JackLibGlobals::CheckContext();
  1361. #endif
  1362. JackClient* client = (JackClient*)ext_client;
  1363. if (client == NULL) {
  1364. jack_error("jack_cpu_load called with a NULL client");
  1365. return 0.0f;
  1366. } else {
  1367. JackEngineControl* control = GetEngineControl();
  1368. return (control ? control->fCPULoad : 0.0f);
  1369. }
  1370. }
  1371. EXPORT pthread_t jack_client_thread_id(jack_client_t* ext_client)
  1372. {
  1373. #ifdef __CLIENTDEBUG__
  1374. JackLibGlobals::CheckContext();
  1375. #endif
  1376. JackClient* client = (JackClient*)ext_client;
  1377. if (client == NULL) {
  1378. jack_error("jack_client_thread_id called with a NULL client");
  1379. return (pthread_t)NULL;
  1380. } else {
  1381. return client->GetThreadID();
  1382. }
  1383. }
  1384. EXPORT char* jack_get_client_name(jack_client_t* ext_client)
  1385. {
  1386. #ifdef __CLIENTDEBUG__
  1387. JackLibGlobals::CheckContext();
  1388. #endif
  1389. JackClient* client = (JackClient*)ext_client;
  1390. if (client == NULL) {
  1391. jack_error("jack_get_client_name called with a NULL client");
  1392. return NULL;
  1393. } else {
  1394. return client->GetClientControl()->fName;
  1395. }
  1396. }
  1397. EXPORT int jack_client_name_size(void)
  1398. {
  1399. return JACK_CLIENT_NAME_SIZE;
  1400. }
  1401. EXPORT int jack_port_name_size(void)
  1402. {
  1403. return JACK_PORT_NAME_SIZE;
  1404. }
  1405. EXPORT int jack_port_type_size(void)
  1406. {
  1407. return JACK_PORT_TYPE_SIZE;
  1408. }
  1409. // transport.h
  1410. EXPORT int jack_release_timebase(jack_client_t* ext_client)
  1411. {
  1412. #ifdef __CLIENTDEBUG__
  1413. JackLibGlobals::CheckContext();
  1414. #endif
  1415. JackClient* client = (JackClient*)ext_client;
  1416. if (client == NULL) {
  1417. jack_error("jack_release_timebase called with a NULL client");
  1418. return -1;
  1419. } else {
  1420. return client->ReleaseTimebase();
  1421. }
  1422. }
  1423. EXPORT int jack_set_sync_callback(jack_client_t* ext_client, JackSyncCallback sync_callback, void *arg)
  1424. {
  1425. #ifdef __CLIENTDEBUG__
  1426. JackLibGlobals::CheckContext();
  1427. #endif
  1428. JackClient* client = (JackClient*)ext_client;
  1429. if (client == NULL) {
  1430. jack_error("jack_set_sync_callback called with a NULL client");
  1431. return -1;
  1432. } else {
  1433. return client->SetSyncCallback(sync_callback, arg);
  1434. }
  1435. }
  1436. EXPORT int jack_set_sync_timeout(jack_client_t* ext_client, jack_time_t timeout)
  1437. {
  1438. #ifdef __CLIENTDEBUG__
  1439. JackLibGlobals::CheckContext();
  1440. #endif
  1441. JackClient* client = (JackClient*)ext_client;
  1442. if (client == NULL) {
  1443. jack_error("jack_set_sync_timeout called with a NULL client");
  1444. return -1;
  1445. } else {
  1446. return client->SetSyncTimeout(timeout);
  1447. }
  1448. }
  1449. EXPORT int jack_set_timebase_callback(jack_client_t* ext_client, int conditional, JackTimebaseCallback timebase_callback, void* arg)
  1450. {
  1451. #ifdef __CLIENTDEBUG__
  1452. JackLibGlobals::CheckContext();
  1453. #endif
  1454. JackClient* client = (JackClient*)ext_client;
  1455. if (client == NULL) {
  1456. jack_error("jack_set_timebase_callback called with a NULL client");
  1457. return -1;
  1458. } else {
  1459. return client->SetTimebaseCallback(conditional, timebase_callback, arg);
  1460. }
  1461. }
  1462. EXPORT int jack_transport_locate(jack_client_t* ext_client, jack_nframes_t frame)
  1463. {
  1464. #ifdef __CLIENTDEBUG__
  1465. JackLibGlobals::CheckContext();
  1466. #endif
  1467. JackClient* client = (JackClient*)ext_client;
  1468. if (client == NULL) {
  1469. jack_error("jack_transport_locate called with a NULL client");
  1470. return -1;
  1471. } else {
  1472. client->TransportLocate(frame);
  1473. return 0;
  1474. }
  1475. }
  1476. EXPORT jack_transport_state_t jack_transport_query(const jack_client_t* ext_client, jack_position_t* pos)
  1477. {
  1478. #ifdef __CLIENTDEBUG__
  1479. JackLibGlobals::CheckContext();
  1480. #endif
  1481. JackClient* client = (JackClient*)ext_client;
  1482. if (client == NULL) {
  1483. jack_error("jack_transport_query called with a NULL client");
  1484. return JackTransportStopped;
  1485. } else {
  1486. return client->TransportQuery(pos);
  1487. }
  1488. }
  1489. EXPORT jack_nframes_t jack_get_current_transport_frame(const jack_client_t* ext_client)
  1490. {
  1491. #ifdef __CLIENTDEBUG__
  1492. JackLibGlobals::CheckContext();
  1493. #endif
  1494. JackClient* client = (JackClient*)ext_client;
  1495. if (client == NULL) {
  1496. jack_error("jack_get_current_transport_frame called with a NULL client");
  1497. return 0;
  1498. } else {
  1499. return client->GetCurrentTransportFrame();
  1500. }
  1501. }
  1502. EXPORT int jack_transport_reposition(jack_client_t* ext_client, jack_position_t* pos)
  1503. {
  1504. #ifdef __CLIENTDEBUG__
  1505. JackLibGlobals::CheckContext();
  1506. #endif
  1507. JackClient* client = (JackClient*)ext_client;
  1508. if (client == NULL) {
  1509. jack_error("jack_transport_reposition called with a NULL client");
  1510. return -1;
  1511. } else {
  1512. client->TransportReposition(pos);
  1513. return 0;
  1514. }
  1515. }
  1516. EXPORT void jack_transport_start(jack_client_t* ext_client)
  1517. {
  1518. #ifdef __CLIENTDEBUG__
  1519. JackLibGlobals::CheckContext();
  1520. #endif
  1521. JackClient* client = (JackClient*)ext_client;
  1522. if (client == NULL) {
  1523. jack_error("jack_transport_start called with a NULL client");
  1524. } else {
  1525. client->TransportStart();
  1526. }
  1527. }
  1528. EXPORT void jack_transport_stop(jack_client_t* ext_client)
  1529. {
  1530. #ifdef __CLIENTDEBUG__
  1531. JackLibGlobals::CheckContext();
  1532. #endif
  1533. JackClient* client = (JackClient*)ext_client;
  1534. if (client == NULL) {
  1535. jack_error("jack_transport_stop called with a NULL client");
  1536. } else {
  1537. client->TransportStop();
  1538. }
  1539. }
  1540. // deprecated
  1541. EXPORT void jack_get_transport_info(jack_client_t* ext_client, jack_transport_info_t* tinfo)
  1542. {
  1543. jack_error("jack_get_transport_info: deprecated");
  1544. if (tinfo)
  1545. memset(tinfo, 0, sizeof(jack_transport_info_t));
  1546. }
  1547. EXPORT void jack_set_transport_info(jack_client_t* ext_client, jack_transport_info_t* tinfo)
  1548. {
  1549. jack_error("jack_set_transport_info: deprecated");
  1550. if (tinfo)
  1551. memset(tinfo, 0, sizeof(jack_transport_info_t));
  1552. }
  1553. // statistics.h
  1554. EXPORT float jack_get_max_delayed_usecs(jack_client_t* ext_client)
  1555. {
  1556. #ifdef __CLIENTDEBUG__
  1557. JackLibGlobals::CheckContext();
  1558. #endif
  1559. JackClient* client = (JackClient*)ext_client;
  1560. if (client == NULL) {
  1561. jack_error("jack_get_max_delayed_usecs called with a NULL client");
  1562. return 0.f;
  1563. } else {
  1564. JackEngineControl* control = GetEngineControl();
  1565. return (control ? control->fMaxDelayedUsecs : 0.f);
  1566. }
  1567. }
  1568. EXPORT float jack_get_xrun_delayed_usecs(jack_client_t* ext_client)
  1569. {
  1570. #ifdef __CLIENTDEBUG__
  1571. JackLibGlobals::CheckContext();
  1572. #endif
  1573. JackClient* client = (JackClient*)ext_client;
  1574. if (client == NULL) {
  1575. jack_error("jack_get_xrun_delayed_usecs called with a NULL client");
  1576. return 0.f;
  1577. } else {
  1578. JackEngineControl* control = GetEngineControl();
  1579. return (control ? control->fXrunDelayedUsecs : 0.f);
  1580. }
  1581. }
  1582. EXPORT void jack_reset_max_delayed_usecs(jack_client_t* ext_client)
  1583. {
  1584. #ifdef __CLIENTDEBUG__
  1585. JackLibGlobals::CheckContext();
  1586. #endif
  1587. JackClient* client = (JackClient*)ext_client;
  1588. if (client == NULL) {
  1589. jack_error("jack_reset_max_delayed_usecs called with a NULL client");
  1590. } else {
  1591. JackEngineControl* control = GetEngineControl();
  1592. control->ResetXRun();
  1593. }
  1594. }
  1595. // thread.h
  1596. EXPORT int jack_acquire_real_time_scheduling(pthread_t thread, int priority)
  1597. {
  1598. JackEngineControl* control = GetEngineControl();
  1599. return (control ? JackThread::AcquireRealTimeImp(thread, priority, GetEngineControl()->fPeriod, GetEngineControl()->fComputation, GetEngineControl()->fConstraint) : -1);
  1600. }
  1601. EXPORT int jack_client_create_thread(jack_client_t* client,
  1602. pthread_t *thread,
  1603. int priority,
  1604. int realtime, /* boolean */
  1605. thread_routine routine,
  1606. void *arg)
  1607. {
  1608. return JackThread::StartImp(thread, priority, realtime, routine, arg);
  1609. }
  1610. EXPORT int jack_drop_real_time_scheduling(pthread_t thread)
  1611. {
  1612. return JackThread::DropRealTimeImp(thread);
  1613. }
  1614. EXPORT int jack_client_stop_thread(jack_client_t* client, pthread_t thread)
  1615. {
  1616. return JackThread::StopImp(thread);
  1617. }
  1618. EXPORT int jack_client_kill_thread(jack_client_t* client, pthread_t thread)
  1619. {
  1620. return JackThread::KillImp(thread);
  1621. }
  1622. // intclient.h
  1623. EXPORT int jack_internal_client_new (const char *client_name,
  1624. const char *load_name,
  1625. const char *load_init)
  1626. {
  1627. jack_error("jack_internal_client_new: deprecated");
  1628. return -1;
  1629. }
  1630. EXPORT void jack_internal_client_close (const char *client_name)
  1631. {
  1632. jack_error("jack_internal_client_close: deprecated");
  1633. }
  1634. EXPORT char* jack_get_internal_client_name(jack_client_t* ext_client, jack_intclient_t intclient)
  1635. {
  1636. #ifdef __CLIENTDEBUG__
  1637. JackLibGlobals::CheckContext();
  1638. #endif
  1639. JackClient* client = (JackClient*)ext_client;
  1640. if (client == NULL) {
  1641. jack_error("jack_get_internal_client_name called with a NULL client");
  1642. return NULL;
  1643. } else if (intclient >= CLIENT_NUM) {
  1644. jack_error("jack_get_internal_client_name: incorrect client");
  1645. return NULL;
  1646. } else {
  1647. return client->GetInternalClientName(intclient);
  1648. }
  1649. }
  1650. EXPORT jack_intclient_t jack_internal_client_handle(jack_client_t* ext_client, const char* client_name, jack_status_t* status)
  1651. {
  1652. #ifdef __CLIENTDEBUG__
  1653. JackLibGlobals::CheckContext();
  1654. #endif
  1655. JackClient* client = (JackClient*)ext_client;
  1656. if (client == NULL) {
  1657. jack_error("jack_internal_client_handle called with a NULL client");
  1658. return 0;
  1659. } else {
  1660. jack_status_t my_status;
  1661. if (status == NULL) /* no status from caller? */
  1662. status = &my_status; /* use local status word */
  1663. *status = (jack_status_t)0;
  1664. return client->InternalClientHandle(client_name, status);
  1665. }
  1666. }
  1667. EXPORT jack_intclient_t jack_internal_client_load_aux(jack_client_t* ext_client, const char* client_name, jack_options_t options, jack_status_t* status, va_list ap)
  1668. {
  1669. #ifdef __CLIENTDEBUG__
  1670. JackLibGlobals::CheckContext();
  1671. #endif
  1672. JackClient* client = (JackClient*)ext_client;
  1673. if (client == NULL) {
  1674. jack_error("jack_internal_client_load called with a NULL client");
  1675. return 0;
  1676. } else {
  1677. jack_varargs_t va;
  1678. jack_status_t my_status;
  1679. if (status == NULL) /* no status from caller? */
  1680. status = &my_status; /* use local status word */
  1681. *status = (jack_status_t)0;
  1682. /* validate parameters */
  1683. if ((options & ~JackLoadOptions)) {
  1684. int my_status1 = *status | (JackFailure | JackInvalidOption);
  1685. *status = (jack_status_t)my_status1;
  1686. return 0;
  1687. }
  1688. /* parse variable arguments */
  1689. jack_varargs_parse(options, ap, &va);
  1690. return client->InternalClientLoad(client_name, options, status, &va);
  1691. }
  1692. }
  1693. EXPORT jack_intclient_t jack_internal_client_load(jack_client_t *client, const char *client_name, jack_options_t options, jack_status_t *status, ...)
  1694. {
  1695. va_list ap;
  1696. va_start(ap, status);
  1697. jack_intclient_t res = jack_internal_client_load_aux(client, client_name, options, status, ap);
  1698. va_end(ap);
  1699. return res;
  1700. }
  1701. EXPORT jack_status_t jack_internal_client_unload(jack_client_t* ext_client, jack_intclient_t intclient)
  1702. {
  1703. #ifdef __CLIENTDEBUG__
  1704. JackLibGlobals::CheckContext();
  1705. #endif
  1706. JackClient* client = (JackClient*)ext_client;
  1707. if (client == NULL) {
  1708. jack_error("jack_internal_client_unload called with a NULL client");
  1709. return (jack_status_t)(JackNoSuchClient | JackFailure);
  1710. } else if (intclient >= CLIENT_NUM) {
  1711. jack_error("jack_internal_client_unload: incorrect client");
  1712. return (jack_status_t)(JackNoSuchClient | JackFailure);
  1713. } else {
  1714. jack_status_t my_status;
  1715. client->InternalClientUnload(intclient, &my_status);
  1716. return my_status;
  1717. }
  1718. }
  1719. EXPORT
  1720. void
  1721. jack_get_version(
  1722. int *major_ptr,
  1723. int *minor_ptr,
  1724. int *micro_ptr,
  1725. int *proto_ptr)
  1726. {
  1727. // FIXME: We need these comming from build system
  1728. *major_ptr = 0;
  1729. *minor_ptr = 0;
  1730. *micro_ptr = 0;
  1731. *proto_ptr = 0;
  1732. }
  1733. EXPORT
  1734. const char *
  1735. jack_get_version_string()
  1736. {
  1737. return VERSION;
  1738. }