00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #include "JackClient.h"
00022 #include "JackError.h"
00023 #include "JackGraphManager.h"
00024 #include "JackEngineControl.h"
00025 #include "JackClientControl.h"
00026 #include "JackGlobals.h"
00027 #include "JackTime.h"
00028 #include "JackCompilerDeps.h"
00029 #include "JackPortType.h"
00030 #include "JackPlatformPlug.h"
00031 #include <math.h>
00032
00033 #ifdef __CLIENTDEBUG__
00034 #include "JackLibGlobals.h"
00035 #endif
00036
00037 using namespace Jack;
00038
00039 #ifdef __cplusplus
00040 extern "C"
00041 {
00042 #endif
00043
00044 typedef void (*print_function)(const char *);
00045 typedef void *(*thread_routine)(void*);
00046
00047 EXPORT
00048 void
00049 jack_get_version(
00050 int *major_ptr,
00051 int *minor_ptr,
00052 int *micro_ptr,
00053 int *proto_ptr);
00054
00055 EXPORT
00056 const char *
00057 jack_get_version_string();
00058
00059 EXPORT jack_client_t * jack_client_open_aux (const char *client_name,
00060 jack_options_t options,
00061 jack_status_t *status, va_list ap);
00062 EXPORT jack_client_t * jack_client_open (const char *client_name,
00063 jack_options_t options,
00064 jack_status_t *status, ...);
00065 EXPORT jack_client_t * jack_client_new (const char *client_name);
00066 EXPORT int jack_client_name_size (void);
00067 EXPORT char* jack_get_client_name (jack_client_t *client);
00068 EXPORT int jack_internal_client_new (const char *client_name,
00069 const char *load_name,
00070 const char *load_init);
00071 EXPORT void jack_internal_client_close (const char *client_name);
00072 EXPORT int jack_is_realtime (jack_client_t *client);
00073 EXPORT void jack_on_shutdown (jack_client_t *client,
00074 JackShutdownCallback shutdown_callback, void *arg);
00075 EXPORT int jack_set_process_callback (jack_client_t *client,
00076 JackProcessCallback process_callback,
00077 void *arg);
00078 EXPORT jack_nframes_t jack_thread_wait(jack_client_t *client, int status);
00079
00080
00081 EXPORT jack_nframes_t jack_cycle_wait (jack_client_t*);
00082 EXPORT void jack_cycle_signal (jack_client_t*, int status);
00083 EXPORT int jack_set_process_thread(jack_client_t* client, JackThreadCallback fun, void *arg);
00084
00085 EXPORT int jack_set_thread_init_callback (jack_client_t *client,
00086 JackThreadInitCallback thread_init_callback,
00087 void *arg);
00088 EXPORT int jack_set_freewheel_callback (jack_client_t *client,
00089 JackFreewheelCallback freewheel_callback,
00090 void *arg);
00091 EXPORT int jack_set_freewheel(jack_client_t* client, int onoff);
00092 EXPORT int jack_set_buffer_size (jack_client_t *client, jack_nframes_t nframes);
00093 EXPORT int jack_set_buffer_size_callback (jack_client_t *client,
00094 JackBufferSizeCallback bufsize_callback,
00095 void *arg);
00096 EXPORT int jack_set_sample_rate_callback (jack_client_t *client,
00097 JackSampleRateCallback srate_callback,
00098 void *arg);
00099 EXPORT int jack_set_client_registration_callback (jack_client_t *,
00100 JackClientRegistrationCallback
00101 registration_callback, void *arg);
00102 EXPORT int jack_set_port_registration_callback (jack_client_t *,
00103 JackPortRegistrationCallback
00104 registration_callback, void *arg);
00105 EXPORT int jack_set_port_connect_callback (jack_client_t *,
00106 JackPortConnectCallback
00107 connect_callback, void *arg);
00108 EXPORT int jack_set_port_rename_callback (jack_client_t *,
00109 JackPortRenameCallback
00110 rename_callback, void *arg);
00111 EXPORT int jack_set_graph_order_callback (jack_client_t *,
00112 JackGraphOrderCallback graph_callback,
00113 void *);
00114 EXPORT int jack_set_xrun_callback (jack_client_t *,
00115 JackXRunCallback xrun_callback, void *arg);
00116 EXPORT int jack_activate (jack_client_t *client);
00117 EXPORT int jack_deactivate (jack_client_t *client);
00118 EXPORT jack_port_t * jack_port_register (jack_client_t *client,
00119 const char *port_name,
00120 const char *port_type,
00121 unsigned long flags,
00122 unsigned long buffer_size);
00123 EXPORT int jack_port_unregister (jack_client_t *, jack_port_t *);
00124 EXPORT void * jack_port_get_buffer (jack_port_t *, jack_nframes_t);
00125 EXPORT const char * jack_port_name (const jack_port_t *port);
00126 EXPORT const char * jack_port_short_name (const jack_port_t *port);
00127 EXPORT int jack_port_flags (const jack_port_t *port);
00128 EXPORT const char * jack_port_type (const jack_port_t *port);
00129 EXPORT jack_port_type_id_t jack_port_type_id (const jack_port_t *port);
00130 EXPORT int jack_port_is_mine (const jack_client_t *, const jack_port_t *port);
00131 EXPORT int jack_port_connected (const jack_port_t *port);
00132 EXPORT int jack_port_connected_to (const jack_port_t *port,
00133 const char *port_name);
00134 EXPORT const char ** jack_port_get_connections (const jack_port_t *port);
00135 EXPORT const char ** jack_port_get_all_connections (const jack_client_t *client,
00136 const jack_port_t *port);
00137 EXPORT int jack_port_tie (jack_port_t *src, jack_port_t *dst);
00138 EXPORT int jack_port_untie (jack_port_t *port);
00139 EXPORT jack_nframes_t jack_port_get_latency (jack_port_t *port);
00140 EXPORT jack_nframes_t jack_port_get_total_latency (jack_client_t *,
00141 jack_port_t *port);
00142 EXPORT void jack_port_set_latency (jack_port_t *, jack_nframes_t);
00143 EXPORT int jack_recompute_total_latency (jack_client_t*, jack_port_t* port);
00144 EXPORT int jack_recompute_total_latencies (jack_client_t*);
00145 EXPORT int jack_port_set_name (jack_port_t *port, const char *port_name);
00146 EXPORT int jack_port_set_alias (jack_port_t *port, const char *alias);
00147 EXPORT int jack_port_unset_alias (jack_port_t *port, const char *alias);
00148 EXPORT int jack_port_get_aliases (const jack_port_t *port, char* const aliases[2]);
00149 EXPORT int jack_port_request_monitor (jack_port_t *port, int onoff);
00150 EXPORT int jack_port_request_monitor_by_name (jack_client_t *client,
00151 const char *port_name, int onoff);
00152 EXPORT int jack_port_ensure_monitor (jack_port_t *port, int onoff);
00153 EXPORT int jack_port_monitoring_input (jack_port_t *port);
00154 EXPORT int jack_connect (jack_client_t *,
00155 const char *source_port,
00156 const char *destination_port);
00157 EXPORT int jack_disconnect (jack_client_t *,
00158 const char *source_port,
00159 const char *destination_port);
00160 EXPORT int jack_port_disconnect (jack_client_t *, jack_port_t *);
00161 EXPORT int jack_port_name_size(void);
00162 EXPORT int jack_port_type_size(void);
00163 EXPORT jack_nframes_t jack_get_sample_rate (jack_client_t *);
00164 EXPORT jack_nframes_t jack_get_buffer_size (jack_client_t *);
00165 EXPORT const char ** jack_get_ports (jack_client_t *,
00166 const char *port_name_pattern,
00167 const char *type_name_pattern,
00168 unsigned long flags);
00169 EXPORT jack_port_t * jack_port_by_name (jack_client_t *, const char *port_name);
00170 EXPORT jack_port_t * jack_port_by_id (jack_client_t *client,
00171 jack_port_id_t port_id);
00172 EXPORT int jack_engine_takeover_timebase (jack_client_t *);
00173 EXPORT jack_nframes_t jack_frames_since_cycle_start (const jack_client_t *);
00174 EXPORT jack_time_t jack_get_time();
00175 EXPORT jack_nframes_t jack_time_to_frames(const jack_client_t *client, jack_time_t time);
00176 EXPORT jack_time_t jack_frames_to_time(const jack_client_t *client, jack_nframes_t frames);
00177 EXPORT jack_nframes_t jack_frame_time (const jack_client_t *);
00178 EXPORT jack_nframes_t jack_last_frame_time (const jack_client_t *client);
00179 EXPORT float jack_cpu_load (jack_client_t *client);
00180 EXPORT pthread_t jack_client_thread_id (jack_client_t *);
00181 EXPORT void jack_set_error_function (print_function);
00182 EXPORT void jack_set_info_function (print_function);
00183
00184 EXPORT float jack_get_max_delayed_usecs (jack_client_t *client);
00185 EXPORT float jack_get_xrun_delayed_usecs (jack_client_t *client);
00186 EXPORT void jack_reset_max_delayed_usecs (jack_client_t *client);
00187
00188 EXPORT int jack_release_timebase (jack_client_t *client);
00189 EXPORT int jack_set_sync_callback (jack_client_t *client,
00190 JackSyncCallback sync_callback,
00191 void *arg);
00192 EXPORT int jack_set_sync_timeout (jack_client_t *client,
00193 jack_time_t timeout);
00194 EXPORT int jack_set_timebase_callback (jack_client_t *client,
00195 int conditional,
00196 JackTimebaseCallback timebase_callback,
00197 void *arg);
00198 EXPORT int jack_transport_locate (jack_client_t *client,
00199 jack_nframes_t frame);
00200 EXPORT jack_transport_state_t jack_transport_query (const jack_client_t *client,
00201 jack_position_t *pos);
00202 EXPORT jack_nframes_t jack_get_current_transport_frame (const jack_client_t *client);
00203 EXPORT int jack_transport_reposition (jack_client_t *client,
00204 jack_position_t *pos);
00205 EXPORT void jack_transport_start (jack_client_t *client);
00206 EXPORT void jack_transport_stop (jack_client_t *client);
00207 EXPORT void jack_get_transport_info (jack_client_t *client,
00208 jack_transport_info_t *tinfo);
00209 EXPORT void jack_set_transport_info (jack_client_t *client,
00210 jack_transport_info_t *tinfo);
00211
00212 EXPORT int jack_client_real_time_priority (jack_client_t*);
00213 EXPORT int jack_client_max_real_time_priority (jack_client_t*);
00214 EXPORT int jack_acquire_real_time_scheduling (pthread_t thread, int priority);
00215 EXPORT int jack_client_create_thread (jack_client_t* client,
00216 pthread_t *thread,
00217 int priority,
00218 int realtime,
00219 thread_routine routine,
00220 void *arg);
00221 EXPORT int jack_drop_real_time_scheduling (pthread_t thread);
00222
00223 EXPORT int jack_client_stop_thread (jack_client_t* client, pthread_t thread);
00224 EXPORT int jack_client_kill_thread (jack_client_t* client, pthread_t thread);
00225 #ifndef WIN32
00226 EXPORT void jack_set_thread_creator (jack_thread_creator_t jtc);
00227 #endif
00228 EXPORT char * jack_get_internal_client_name (jack_client_t *client,
00229 jack_intclient_t intclient);
00230 EXPORT jack_intclient_t jack_internal_client_handle (jack_client_t *client,
00231 const char *client_name,
00232 jack_status_t *status);
00233 EXPORT jack_intclient_t jack_internal_client_load (jack_client_t *client,
00234 const char *client_name,
00235 jack_options_t options,
00236 jack_status_t *status, ...);
00237 EXPORT jack_intclient_t jack_internal_client_load_aux (jack_client_t *client,
00238 const char *client_name,
00239 jack_options_t options,
00240 jack_status_t *status, va_list ap);
00241
00242 EXPORT jack_status_t jack_internal_client_unload (jack_client_t *client,
00243 jack_intclient_t intclient);
00244 EXPORT void jack_free(void* ptr);
00245
00246 #ifdef __cplusplus
00247 }
00248 #endif
00249
00250 static inline bool CheckPort(jack_port_id_t port_index)
00251 {
00252 return (port_index > 0 && port_index < PORT_NUM);
00253 }
00254
00255 static inline bool CheckBufferSize(jack_nframes_t buffer_size)
00256 {
00257 return (buffer_size <= BUFFER_SIZE_MAX);
00258 }
00259
00260 static inline void WaitGraphChange()
00261 {
00262
00263
00264
00265
00266
00267 if (jack_tls_get(JackGlobals::fRealTime) == NULL) {
00268 JackGraphManager* manager = GetGraphManager();
00269 JackEngineControl* control = GetEngineControl();
00270 assert(manager);
00271 assert(control);
00272 if (manager->IsPendingChange()) {
00273 jack_log("WaitGraphChange...");
00274 JackSleep(int(control->fPeriodUsecs * 1.1f));
00275 }
00276 }
00277 }
00278
00279 EXPORT void jack_set_error_function (print_function func)
00280 {
00281 jack_error_callback = (func == NULL) ? &default_jack_error_callback : func;
00282 }
00283
00284 EXPORT void jack_set_info_function (print_function func)
00285 {
00286 jack_info_callback = (func == NULL) ? &default_jack_info_callback : func;
00287 }
00288
00289 EXPORT jack_client_t* jack_client_new(const char* client_name)
00290 {
00291 assert(JackGlobals::fOpenMutex);
00292 JackGlobals::fOpenMutex->Lock();
00293 jack_error("jack_client_new: deprecated");
00294 int options = JackUseExactName;
00295 if (getenv("JACK_START_SERVER") == NULL)
00296 options |= JackNoStartServer;
00297 jack_client_t* res = jack_client_open_aux(client_name, (jack_options_t)options, NULL, NULL);
00298 JackGlobals::fOpenMutex->Unlock();
00299 return res;
00300 }
00301
00302 EXPORT void* jack_port_get_buffer(jack_port_t* port, jack_nframes_t frames)
00303 {
00304 #ifdef __CLIENTDEBUG__
00305 JackLibGlobals::CheckContext();
00306 #endif
00307 #if defined(__x86_64__) || defined(__ppc64__)
00308 uint64_t port_aux = (uint64_t)port;
00309 #else
00310 uint32_t port_aux = (uint32_t)port;
00311 #endif
00312 jack_port_id_t myport = (jack_port_id_t)port_aux;
00313 if (!CheckPort(myport)) {
00314 jack_error("jack_port_get_buffer called with an incorrect port %ld", myport);
00315 return NULL;
00316 } else {
00317 JackGraphManager* manager = GetGraphManager();
00318 return (manager ? manager->GetBuffer(myport, frames) : NULL);
00319 }
00320 }
00321
00322 EXPORT const char* jack_port_name(const jack_port_t* port)
00323 {
00324 #ifdef __CLIENTDEBUG__
00325 JackLibGlobals::CheckContext();
00326 #endif
00327 #if defined(__x86_64__) || defined(__ppc64__)
00328 uint64_t port_aux = (uint64_t)port;
00329 #else
00330 uint32_t port_aux = (uint32_t)port;
00331 #endif
00332 jack_port_id_t myport = (jack_port_id_t)port_aux;
00333 if (!CheckPort(myport)) {
00334 jack_error("jack_port_name called with an incorrect port %ld", myport);
00335 return NULL;
00336 } else {
00337 JackGraphManager* manager = GetGraphManager();
00338 return (manager ? manager->GetPort(myport)->GetName() : NULL);
00339 }
00340 }
00341
00342 EXPORT const char* jack_port_short_name(const jack_port_t* port)
00343 {
00344 #ifdef __CLIENTDEBUG__
00345 JackLibGlobals::CheckContext();
00346 #endif
00347 #if defined(__x86_64__) || defined(__ppc64__)
00348 uint64_t port_aux = (uint64_t)port;
00349 #else
00350 uint32_t port_aux = (uint32_t)port;
00351 #endif
00352 jack_port_id_t myport = (jack_port_id_t)port_aux;
00353 if (!CheckPort(myport)) {
00354 jack_error("jack_port_short_name called with an incorrect port %ld", myport);
00355 return NULL;
00356 } else {
00357 JackGraphManager* manager = GetGraphManager();
00358 return (manager ? manager->GetPort(myport)->GetShortName() : NULL);
00359 }
00360 }
00361
00362 EXPORT int jack_port_flags(const jack_port_t* port)
00363 {
00364 #ifdef __CLIENTDEBUG__
00365 JackLibGlobals::CheckContext();
00366 #endif
00367 #if defined(__x86_64__) || defined(__ppc64__)
00368 uint64_t port_aux = (uint64_t)port;
00369 #else
00370 uint32_t port_aux = (uint32_t)port;
00371 #endif
00372 jack_port_id_t myport = (jack_port_id_t)port_aux;
00373 if (!CheckPort(myport)) {
00374 jack_error("jack_port_flags called with an incorrect port %ld", myport);
00375 return -1;
00376 } else {
00377 JackGraphManager* manager = GetGraphManager();
00378 return (manager ? manager->GetPort(myport)->GetFlags() : -1);
00379 }
00380 }
00381
00382 EXPORT const char* jack_port_type(const jack_port_t* port)
00383 {
00384 #ifdef __CLIENTDEBUG__
00385 JackLibGlobals::CheckContext();
00386 #endif
00387 #if defined(__x86_64__) || defined(__ppc64__)
00388 uint64_t port_aux = (uint64_t)port;
00389 #else
00390 uint32_t port_aux = (uint32_t)port;
00391 #endif
00392 jack_port_id_t myport = (jack_port_id_t)port_aux;
00393 if (!CheckPort(myport)) {
00394 jack_error("jack_port_flags called an incorrect port %ld", myport);
00395 return NULL;
00396 } else {
00397 JackGraphManager* manager = GetGraphManager();
00398 return (manager ? manager->GetPort(myport)->GetType() : NULL);
00399 }
00400 }
00401
00402 EXPORT jack_port_type_id_t jack_port_type_id(const jack_port_t *port)
00403 {
00404 #ifdef __CLIENTDEBUG__
00405 JackLibGlobals::CheckContext();
00406 #endif
00407 #if defined(__x86_64__) || defined(__ppc64__)
00408 uint64_t port_aux = (uint64_t)port;
00409 #else
00410 uint32_t port_aux = (uint32_t)port;
00411 #endif
00412 jack_port_id_t myport = (jack_port_id_t)port_aux;
00413 if (!CheckPort(myport)) {
00414 jack_error("jack_port_type_id called an incorrect port %ld", myport);
00415 return 0;
00416 } else {
00417 JackGraphManager* manager = GetGraphManager();
00418 return (manager ? GetPortTypeId(manager->GetPort(myport)->GetType()) : 0);
00419 }
00420 }
00421
00422 EXPORT int jack_port_connected(const jack_port_t* port)
00423 {
00424 #ifdef __CLIENTDEBUG__
00425 JackLibGlobals::CheckContext();
00426 #endif
00427 #if defined(__x86_64__) || defined(__ppc64__)
00428 uint64_t port_aux = (uint64_t)port;
00429 #else
00430 uint32_t port_aux = (uint32_t)port;
00431 #endif
00432 jack_port_id_t myport = (jack_port_id_t)port_aux;
00433 if (!CheckPort(myport)) {
00434 jack_error("jack_port_connected called with an incorrect port %ld", myport);
00435 return -1;
00436 } else {
00437 WaitGraphChange();
00438 JackGraphManager* manager = GetGraphManager();
00439 return (manager ? manager->GetConnectionsNum(myport) : -1);
00440 }
00441 }
00442
00443 EXPORT int jack_port_connected_to(const jack_port_t* port, const char* port_name)
00444 {
00445 #ifdef __CLIENTDEBUG__
00446 JackLibGlobals::CheckContext();
00447 #endif
00448 #if defined(__x86_64__) || defined(__ppc64__)
00449 uint64_t port_aux = (uint64_t)port;
00450 #else
00451 uint32_t port_aux = (uint32_t)port;
00452 #endif
00453 jack_port_id_t src = (jack_port_id_t)port_aux;
00454 if (!CheckPort(src)) {
00455 jack_error("jack_port_connected_to called with an incorrect port %ld", src);
00456 return -1;
00457 } else if (port_name == NULL) {
00458 jack_error("jack_port_connected_to called with a NULL port name");
00459 return -1;
00460 } else {
00461 WaitGraphChange();
00462 JackGraphManager* manager = GetGraphManager();
00463 jack_port_id_t dst = (manager ? manager->GetPort(port_name) : NO_PORT);
00464 if (dst == NO_PORT) {
00465 jack_error("Unknown destination port port_name = %s", port_name);
00466 return 0;
00467 } else {
00468 return manager->IsConnected(src, dst);
00469 }
00470 }
00471 }
00472
00473 EXPORT int jack_port_tie(jack_port_t* src, jack_port_t* dst)
00474 {
00475 #ifdef __CLIENTDEBUG__
00476 JackLibGlobals::CheckContext();
00477 #endif
00478 #if defined(__x86_64__) || defined(__ppc64__)
00479 uint64_t src_aux = (uint64_t)src;
00480 #else
00481 uint32_t src_aux = (uint32_t)src;
00482 #endif
00483 jack_port_id_t mysrc = (jack_port_id_t)src_aux;
00484 if (!CheckPort(mysrc)) {
00485 jack_error("jack_port_tie called with a NULL src port");
00486 return -1;
00487 }
00488 #if defined(__x86_64__) || defined(__ppc64__)
00489 uint64_t dst_aux = (uint64_t)dst;
00490 #else
00491 uint32_t dst_aux = (uint32_t)dst;
00492 #endif
00493 jack_port_id_t mydst = (jack_port_id_t)dst_aux;
00494 if (!CheckPort(mydst)) {
00495 jack_error("jack_port_tie called with a NULL dst port");
00496 return -1;
00497 }
00498 JackGraphManager* manager = GetGraphManager();
00499 if (manager && manager->GetPort(mysrc)->GetRefNum() != manager->GetPort(mydst)->GetRefNum()) {
00500 jack_error("jack_port_tie called with ports not belonging to the same client");
00501 return -1;
00502 } else {
00503 return manager->GetPort(mydst)->Tie(mysrc);
00504 }
00505 }
00506
00507 EXPORT int jack_port_untie(jack_port_t* port)
00508 {
00509 #ifdef __CLIENTDEBUG__
00510 JackLibGlobals::CheckContext();
00511 #endif
00512 #if defined(__x86_64__) || defined(__ppc64__)
00513 uint64_t port_aux = (uint64_t)port;
00514 #else
00515 uint32_t port_aux = (uint32_t)port;
00516 #endif
00517 jack_port_id_t myport = (jack_port_id_t)port_aux;
00518 if (!CheckPort(myport)) {
00519 jack_error("jack_port_untie called with an incorrect port %ld", myport);
00520 return -1;
00521 } else {
00522 JackGraphManager* manager = GetGraphManager();
00523 return (manager ? manager->GetPort(myport)->UnTie() : -1);
00524 }
00525 }
00526
00527 EXPORT jack_nframes_t jack_port_get_latency(jack_port_t* port)
00528 {
00529 #ifdef __CLIENTDEBUG__
00530 JackLibGlobals::CheckContext();
00531 #endif
00532 #if defined(__x86_64__) || defined(__ppc64__)
00533 uint64_t port_aux = (uint64_t)port;
00534 #else
00535 uint32_t port_aux = (uint32_t)port;
00536 #endif
00537 jack_port_id_t myport = (jack_port_id_t)port_aux;
00538 if (!CheckPort(myport)) {
00539 jack_error("jack_port_get_latency called with an incorrect port %ld", myport);
00540 return 0;
00541 } else {
00542 WaitGraphChange();
00543 JackGraphManager* manager = GetGraphManager();
00544 return (manager ? manager->GetPort(myport)->GetLatency() : 0);
00545 }
00546 }
00547
00548 EXPORT void jack_port_set_latency(jack_port_t* port, jack_nframes_t frames)
00549 {
00550 #ifdef __CLIENTDEBUG__
00551 JackLibGlobals::CheckContext();
00552 #endif
00553 #if defined(__x86_64__) || defined(__ppc64__)
00554 uint64_t port_aux = (uint64_t)port;
00555 #else
00556 uint32_t port_aux = (uint32_t)port;
00557 #endif
00558 jack_port_id_t myport = (jack_port_id_t)port_aux;
00559 if (!CheckPort(myport)) {
00560 jack_error("jack_port_set_latency called with an incorrect port %ld", myport);
00561 } else {
00562 JackGraphManager* manager = GetGraphManager();
00563 if (manager)
00564 manager->GetPort(myport)->SetLatency(frames);
00565 }
00566 }
00567
00568 EXPORT int jack_recompute_total_latency(jack_client_t* ext_client, jack_port_t* port)
00569 {
00570 #ifdef __CLIENTDEBUG__
00571 JackLibGlobals::CheckContext();
00572 #endif
00573
00574 JackClient* client = (JackClient*)ext_client;
00575 #if defined(__x86_64__) || defined(__ppc64__)
00576 uint64_t port_aux = (uint64_t)port;
00577 #else
00578 uint32_t port_aux = (uint32_t)port;
00579 #endif
00580 jack_port_id_t myport = (jack_port_id_t)port_aux;
00581 if (client == NULL) {
00582 jack_error("jack_recompute_total_latencies called with a NULL client");
00583 return -1;
00584 } else if (!CheckPort(myport)) {
00585 jack_error("jack_recompute_total_latencies called with a NULL port");
00586 return -1;
00587 } else {
00588 WaitGraphChange();
00589 JackGraphManager* manager = GetGraphManager();
00590 return (manager ? manager->ComputeTotalLatency(myport) : -1);
00591 }
00592 }
00593
00594 EXPORT int jack_recompute_total_latencies(jack_client_t* ext_client)
00595 {
00596 #ifdef __CLIENTDEBUG__
00597 JackLibGlobals::CheckContext();
00598 #endif
00599
00600 JackClient* client = (JackClient*)ext_client;
00601 if (client == NULL) {
00602 jack_error("jack_recompute_total_latencies called with a NULL client");
00603 return -1;
00604 } else {
00605 WaitGraphChange();
00606 JackGraphManager* manager = GetGraphManager();
00607 return (manager ? manager->ComputeTotalLatencies() : -1);
00608 }
00609 }
00610
00611
00612
00613
00614
00615 EXPORT int jack_port_set_name(jack_port_t* port, const char* name)
00616 {
00617 #ifdef __CLIENTDEBUG__
00618 JackLibGlobals::CheckContext();
00619 #endif
00620 #if defined(__x86_64__) || defined(__ppc64__)
00621 uint64_t port_aux = (uint64_t)port;
00622 #else
00623 uint32_t port_aux = (uint32_t)port;
00624 #endif
00625 jack_port_id_t myport = (jack_port_id_t)port_aux;
00626 if (!CheckPort(myport)) {
00627 jack_error("jack_port_set_name called with an incorrect port %ld", myport);
00628 return -1;
00629 } else if (name == NULL) {
00630 jack_error("jack_port_set_name called with a NULL port name");
00631 return -1;
00632 } else {
00633 JackGraphManager* manager = GetGraphManager();
00634 int refnum;
00635 if (manager && ((refnum = manager->GetPort(myport)->GetRefNum()) > 0)) {
00636 JackClient* client = JackGlobals::fClientTable[refnum];
00637 assert(client);
00638 return client->PortRename(myport, name);
00639 } else {
00640 return -1;
00641 }
00642 }
00643 }
00644
00645 EXPORT int jack_port_set_alias(jack_port_t* port, const char* name)
00646 {
00647 #ifdef __CLIENTDEBUG__
00648 JackLibGlobals::CheckContext();
00649 #endif
00650 #if defined(__x86_64__) || defined(__ppc64__)
00651 uint64_t port_aux = (uint64_t)port;
00652 #else
00653 uint32_t port_aux = (uint32_t)port;
00654 #endif
00655 jack_port_id_t myport = (jack_port_id_t)port_aux;
00656 if (!CheckPort(myport)) {
00657 jack_error("jack_port_set_alias called with an incorrect port %ld", myport);
00658 return -1;
00659 } else if (name == NULL) {
00660 jack_error("jack_port_set_alias called with a NULL port name");
00661 return -1;
00662 } else {
00663 JackGraphManager* manager = GetGraphManager();
00664 return (manager ? manager->GetPort(myport)->SetAlias(name) : -1);
00665 }
00666 }
00667
00668 EXPORT int jack_port_unset_alias(jack_port_t* port, const char* name)
00669 {
00670 #ifdef __CLIENTDEBUG__
00671 JackLibGlobals::CheckContext();
00672 #endif
00673 #if defined(__x86_64__) || defined(__ppc64__)
00674 uint64_t port_aux = (uint64_t)port;
00675 #else
00676 uint32_t port_aux = (uint32_t)port;
00677 #endif
00678 jack_port_id_t myport = (jack_port_id_t)port_aux;
00679 if (!CheckPort(myport)) {
00680 jack_error("jack_port_unset_alias called with an incorrect port %ld", myport);
00681 return -1;
00682 } else if (name == NULL) {
00683 jack_error("jack_port_unset_alias called with a NULL port name");
00684 return -1;
00685 } else {
00686 JackGraphManager* manager = GetGraphManager();
00687 return (manager ? manager->GetPort(myport)->UnsetAlias(name) : -1);
00688 }
00689 }
00690
00691 EXPORT int jack_port_get_aliases(const jack_port_t* port, char* const aliases[2])
00692 {
00693 #ifdef __CLIENTDEBUG__
00694 JackLibGlobals::CheckContext();
00695 #endif
00696 #if defined(__x86_64__) || defined(__ppc64__)
00697 uint64_t port_aux = (uint64_t)port;
00698 #else
00699 uint32_t port_aux = (uint32_t)port;
00700 #endif
00701 jack_port_id_t myport = (jack_port_id_t)port_aux;
00702 if (!CheckPort(myport)) {
00703 jack_error("jack_port_get_aliases called with an incorrect port %ld", myport);
00704 return -1;
00705 } else {
00706 JackGraphManager* manager = GetGraphManager();
00707 return (manager ? manager->GetPort(myport)->GetAliases(aliases) : -1);
00708 }
00709 }
00710
00711 EXPORT int jack_port_request_monitor(jack_port_t* port, int onoff)
00712 {
00713 #ifdef __CLIENTDEBUG__
00714 JackLibGlobals::CheckContext();
00715 #endif
00716 #if defined(__x86_64__) || defined(__ppc64__)
00717 uint64_t port_aux = (uint64_t)port;
00718 #else
00719 uint32_t port_aux = (uint32_t)port;
00720 #endif
00721 jack_port_id_t myport = (jack_port_id_t)port_aux;
00722 if (!CheckPort(myport)) {
00723 jack_error("jack_port_request_monitor called with an incorrect port %ld", myport);
00724 return -1;
00725 } else {
00726 JackGraphManager* manager = GetGraphManager();
00727 return (manager ? manager->RequestMonitor(myport, onoff) : -1);
00728 }
00729 }
00730
00731 EXPORT int jack_port_request_monitor_by_name(jack_client_t* ext_client, const char* port_name, int onoff)
00732 {
00733 #ifdef __CLIENTDEBUG__
00734 JackLibGlobals::CheckContext();
00735 #endif
00736 JackClient* client = (JackClient*)ext_client;
00737 if (client == NULL) {
00738 jack_error("jack_port_request_monitor_by_name called with a NULL client");
00739 return -1;
00740 } else {
00741 JackGraphManager* manager = GetGraphManager();
00742 if (!manager)
00743 return -1;
00744 jack_port_id_t myport = manager->GetPort(port_name);
00745 if (!CheckPort(myport)) {
00746 jack_error("jack_port_request_monitor_by_name called with an incorrect port %s", port_name);
00747 return -1;
00748 } else {
00749 return manager->RequestMonitor(myport, onoff);
00750 }
00751 }
00752 }
00753
00754 EXPORT int jack_port_ensure_monitor(jack_port_t* port, int onoff)
00755 {
00756 #ifdef __CLIENTDEBUG__
00757 JackLibGlobals::CheckContext();
00758 #endif
00759 #if defined(__x86_64__) || defined(__ppc64__)
00760 uint64_t port_aux = (uint64_t)port;
00761 #else
00762 uint32_t port_aux = (uint32_t)port;
00763 #endif
00764 jack_port_id_t myport = (jack_port_id_t)port_aux;
00765 if (!CheckPort(myport)) {
00766 jack_error("jack_port_ensure_monitor called with an incorrect port %ld", myport);
00767 return -1;
00768 } else {
00769 JackGraphManager* manager = GetGraphManager();
00770 return (manager ? manager->GetPort(myport)->EnsureMonitor(onoff) : -1);
00771 }
00772 }
00773
00774 EXPORT int jack_port_monitoring_input(jack_port_t* port)
00775 {
00776 #ifdef __CLIENTDEBUG__
00777 JackLibGlobals::CheckContext();
00778 #endif
00779 #if defined(__x86_64__) || defined(__ppc64__)
00780 uint64_t port_aux = (uint64_t)port;
00781 #else
00782 uint32_t port_aux = (uint32_t)port;
00783 #endif
00784 jack_port_id_t myport = (jack_port_id_t)port_aux;
00785 if (!CheckPort(myport)) {
00786 jack_error("jack_port_monitoring_input called with an incorrect port %ld", myport);
00787 return -1;
00788 } else {
00789 JackGraphManager* manager = GetGraphManager();
00790 return (manager ? manager->GetPort(myport)->MonitoringInput() : -1);
00791 }
00792 }
00793
00794 EXPORT int jack_is_realtime(jack_client_t* ext_client)
00795 {
00796 #ifdef __CLIENTDEBUG__
00797 JackLibGlobals::CheckContext();
00798 #endif
00799 JackClient* client = (JackClient*)ext_client;
00800 if (client == NULL) {
00801 jack_error("jack_is_realtime called with a NULL client");
00802 return -1;
00803 } else {
00804 JackEngineControl* control = GetEngineControl();
00805 return (control ? control->fRealTime : -1);
00806 }
00807 }
00808
00809 EXPORT void jack_on_shutdown(jack_client_t* ext_client, JackShutdownCallback callback, void* arg)
00810 {
00811 #ifdef __CLIENTDEBUG__
00812 JackLibGlobals::CheckContext();
00813 #endif
00814 JackClient* client = (JackClient*)ext_client;
00815 if (client == NULL) {
00816 jack_error("jack_on_shutdown called with a NULL client");
00817 } else {
00818 client->OnShutdown(callback, arg);
00819 }
00820 }
00821
00822 EXPORT int jack_set_process_callback(jack_client_t* ext_client, JackProcessCallback callback, void* arg)
00823 {
00824 #ifdef __CLIENTDEBUG__
00825 JackLibGlobals::CheckContext();
00826 #endif
00827 JackClient* client = (JackClient*)ext_client;
00828 if (client == NULL) {
00829 jack_error("jack_set_process_callback called with a NULL client");
00830 return -1;
00831 } else {
00832 return client->SetProcessCallback(callback, arg);
00833 }
00834 }
00835
00836 EXPORT jack_nframes_t jack_thread_wait(jack_client_t* ext_client, int status)
00837 {
00838 #ifdef __CLIENTDEBUG__
00839 JackLibGlobals::CheckContext();
00840 #endif
00841 JackClient* client = (JackClient*)ext_client;
00842 if (client == NULL) {
00843 jack_error("jack_thread_wait called with a NULL client");
00844 return 0;
00845 } else {
00846 jack_error("jack_thread_wait: deprecated, use jack_cycle_wait/jack_cycle_signal");
00847 return 0;
00848 }
00849 }
00850
00851 EXPORT jack_nframes_t jack_cycle_wait(jack_client_t* ext_client)
00852 {
00853 #ifdef __CLIENTDEBUG__
00854 JackLibGlobals::CheckContext();
00855 #endif
00856 JackClient* client = (JackClient*)ext_client;
00857 if (client == NULL) {
00858 jack_error("jack_cycle_wait called with a NULL client");
00859 return 0;
00860 } else {
00861 return client->CycleWait();
00862 }
00863 }
00864
00865 EXPORT void jack_cycle_signal(jack_client_t* ext_client, int status)
00866 {
00867 #ifdef __CLIENTDEBUG__
00868 JackLibGlobals::CheckContext();
00869 #endif
00870 JackClient* client = (JackClient*)ext_client;
00871 if (client == NULL) {
00872 jack_error("jack_cycle_signal called with a NULL client");
00873 } else {
00874 client->CycleSignal(status);
00875 }
00876 }
00877
00878 EXPORT int jack_set_process_thread(jack_client_t* ext_client, JackThreadCallback fun, void *arg)
00879 {
00880 #ifdef __CLIENTDEBUG__
00881 JackLibGlobals::CheckContext();
00882 #endif
00883 JackClient* client = (JackClient*)ext_client;
00884 if (client == NULL) {
00885 jack_error("jack_set_process_thread called with a NULL client");
00886 return -1;
00887 } else {
00888 return client->SetProcessThread(fun, arg);
00889 }
00890 }
00891
00892 EXPORT int jack_set_freewheel_callback(jack_client_t* ext_client, JackFreewheelCallback freewheel_callback, void* arg)
00893 {
00894 #ifdef __CLIENTDEBUG__
00895 JackLibGlobals::CheckContext();
00896 #endif
00897 JackClient* client = (JackClient*)ext_client;
00898 if (client == NULL) {
00899 jack_error("jack_set_freewheel_callback called with a NULL client");
00900 return -1;
00901 } else {
00902 return client->SetFreewheelCallback(freewheel_callback, arg);
00903 }
00904 }
00905
00906 EXPORT int jack_set_freewheel(jack_client_t* ext_client, int onoff)
00907 {
00908 #ifdef __CLIENTDEBUG__
00909 JackLibGlobals::CheckContext();
00910 #endif
00911 JackClient* client = (JackClient*)ext_client;
00912 if (client == NULL) {
00913 jack_error("jack_set_freewheel called with a NULL client");
00914 return -1;
00915 } else {
00916 return client->SetFreeWheel(onoff);
00917 }
00918 }
00919
00920 EXPORT int jack_set_buffer_size(jack_client_t* ext_client, jack_nframes_t buffer_size)
00921 {
00922 #ifdef __CLIENTDEBUG__
00923 JackLibGlobals::CheckContext();
00924 #endif
00925 JackClient* client = (JackClient*)ext_client;
00926 if (client == NULL) {
00927 jack_error("jack_set_buffer_size called with a NULL client");
00928 return -1;
00929 } else if (!CheckBufferSize(buffer_size)) {
00930 return -1;
00931 } else {
00932 return client->SetBufferSize(buffer_size);
00933 }
00934 }
00935
00936 EXPORT int jack_set_buffer_size_callback(jack_client_t* ext_client, JackBufferSizeCallback bufsize_callback, void* arg)
00937 {
00938 #ifdef __CLIENTDEBUG__
00939 JackLibGlobals::CheckContext();
00940 #endif
00941 JackClient* client = (JackClient*)ext_client;
00942 if (client == NULL) {
00943 jack_error("jack_set_buffer_size_callback called with a NULL client");
00944 return -1;
00945 } else {
00946 return client->SetBufferSizeCallback(bufsize_callback, arg);
00947 }
00948 }
00949
00950 EXPORT int jack_set_sample_rate_callback(jack_client_t* ext_client, JackSampleRateCallback srate_callback, void* arg)
00951 {
00952 #ifdef __CLIENTDEBUG__
00953 JackLibGlobals::CheckContext();
00954 #endif
00955 JackClient* client = (JackClient*)ext_client;
00956 if (client == NULL) {
00957 jack_error("jack_set_sample_rate_callback called with a NULL client");
00958 return -1;
00959 } else {
00960 return client->SetSampleRateCallback(srate_callback, arg);
00961 }
00962 }
00963
00964 EXPORT int jack_set_client_registration_callback(jack_client_t* ext_client, JackClientRegistrationCallback registration_callback, void* arg)
00965 {
00966 #ifdef __CLIENTDEBUG__
00967 JackLibGlobals::CheckContext();
00968 #endif
00969 JackClient* client = (JackClient*)ext_client;
00970 if (client == NULL) {
00971 jack_error("jack_set_client_registration_callback called with a NULL client");
00972 return -1;
00973 } else {
00974 return client->SetClientRegistrationCallback(registration_callback, arg);
00975 }
00976 }
00977
00978 EXPORT int jack_set_port_registration_callback(jack_client_t* ext_client, JackPortRegistrationCallback registration_callback, void* arg)
00979 {
00980 #ifdef __CLIENTDEBUG__
00981 JackLibGlobals::CheckContext();
00982 #endif
00983 JackClient* client = (JackClient*)ext_client;
00984 if (client == NULL) {
00985 jack_error("jack_set_port_registration_callback called with a NULL client");
00986 return -1;
00987 } else {
00988 return client->SetPortRegistrationCallback(registration_callback, arg);
00989 }
00990 }
00991
00992 EXPORT int jack_set_port_connect_callback(jack_client_t* ext_client, JackPortConnectCallback portconnect_callback, void* arg)
00993 {
00994 #ifdef __CLIENTDEBUG__
00995 JackLibGlobals::CheckContext();
00996 #endif
00997 JackClient* client = (JackClient*)ext_client;
00998 if (client == NULL) {
00999 jack_error("jack_set_port_connect_callback called with a NULL client");
01000 return -1;
01001 } else {
01002 return client->SetPortConnectCallback(portconnect_callback, arg);
01003 }
01004 }
01005
01006 EXPORT int jack_set_port_rename_callback(jack_client_t* ext_client, JackPortRenameCallback rename_callback, void* arg)
01007 {
01008 #ifdef __CLIENTDEBUG__
01009 JackLibGlobals::CheckContext();
01010 #endif
01011 JackClient* client = (JackClient*)ext_client;
01012 if (client == NULL) {
01013 jack_error("jack_set_port_rename_callback called with a NULL client");
01014 return -1;
01015 } else {
01016 return client->SetPortRenameCallback(rename_callback, arg);
01017 }
01018 }
01019
01020 EXPORT int jack_set_graph_order_callback(jack_client_t* ext_client, JackGraphOrderCallback graph_callback, void* arg)
01021 {
01022 #ifdef __CLIENTDEBUG__
01023 JackLibGlobals::CheckContext();
01024 #endif
01025 JackClient* client = (JackClient*)ext_client;
01026 jack_log("jack_set_graph_order_callback ext_client %x client %x ", ext_client, client);
01027 if (client == NULL) {
01028 jack_error("jack_set_graph_order_callback called with a NULL client");
01029 return -1;
01030 } else {
01031 return client->SetGraphOrderCallback(graph_callback, arg);
01032 }
01033 }
01034
01035 EXPORT int jack_set_xrun_callback(jack_client_t* ext_client, JackXRunCallback xrun_callback, void* arg)
01036 {
01037 #ifdef __CLIENTDEBUG__
01038 JackLibGlobals::CheckContext();
01039 #endif
01040 JackClient* client = (JackClient*)ext_client;
01041 if (client == NULL) {
01042 jack_error("jack_set_xrun_callback called with a NULL client");
01043 return -1;
01044 } else {
01045 return client->SetXRunCallback(xrun_callback, arg);
01046 }
01047 }
01048
01049 EXPORT int jack_set_thread_init_callback(jack_client_t* ext_client, JackThreadInitCallback init_callback, void *arg)
01050 {
01051 #ifdef __CLIENTDEBUG__
01052 JackLibGlobals::CheckContext();
01053 #endif
01054 JackClient* client = (JackClient*)ext_client;
01055 jack_log("jack_set_thread_init_callback ext_client %x client %x ", ext_client, client);
01056 if (client == NULL) {
01057 jack_error("jack_set_thread_init_callback called with a NULL client");
01058 return -1;
01059 } else {
01060 return client->SetInitCallback(init_callback, arg);
01061 }
01062 }
01063
01064 EXPORT int jack_activate(jack_client_t* ext_client)
01065 {
01066 #ifdef __CLIENTDEBUG__
01067 JackLibGlobals::CheckContext();
01068 #endif
01069 JackClient* client = (JackClient*)ext_client;
01070 if (client == NULL) {
01071 jack_error("jack_activate called with a NULL client");
01072 return -1;
01073 } else {
01074 return client->Activate();
01075 }
01076 }
01077
01078 EXPORT int jack_deactivate(jack_client_t* ext_client)
01079 {
01080 #ifdef __CLIENTDEBUG__
01081 JackLibGlobals::CheckContext();
01082 #endif
01083 JackClient* client = (JackClient*)ext_client;
01084 if (client == NULL) {
01085 jack_error("jack_deactivate called with a NULL client");
01086 return -1;
01087 } else {
01088 return client->Deactivate();
01089 }
01090 }
01091
01092 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)
01093 {
01094 #ifdef __CLIENTDEBUG__
01095 JackLibGlobals::CheckContext();
01096 #endif
01097 JackClient* client = (JackClient*)ext_client;
01098 if (client == NULL) {
01099 jack_error("jack_port_register called with a NULL client");
01100 return NULL;
01101 } else if ((port_name == NULL) || (port_type == NULL)) {
01102 jack_error("jack_port_register called with a NULL port name or a NULL port_type");
01103 return NULL;
01104 } else {
01105 #if defined(__x86_64__) || defined(__ppc64__)
01106 return (jack_port_t *)((uint64_t)client->PortRegister(port_name, port_type, flags, buffer_size));
01107 #else
01108 return (jack_port_t *)client->PortRegister(port_name, port_type, flags, buffer_size);
01109 #endif
01110 }
01111 }
01112
01113 EXPORT int jack_port_unregister(jack_client_t* ext_client, jack_port_t* port)
01114 {
01115 #ifdef __CLIENTDEBUG__
01116 JackLibGlobals::CheckContext();
01117 #endif
01118 JackClient* client = (JackClient*)ext_client;
01119 if (client == NULL) {
01120 jack_error("jack_port_unregister called with a NULL client");
01121 return -1;
01122 }
01123 #if defined(__x86_64__) || defined(__ppc64__)
01124 uint64_t port_aux = (uint64_t)port;
01125 #else
01126 uint32_t port_aux = (uint32_t)port;
01127 #endif
01128 jack_port_id_t myport = (jack_port_id_t)port_aux;
01129 if (!CheckPort(myport)) {
01130 jack_error("jack_port_unregister called with an incorrect port %ld", myport);
01131 return -1;
01132 }
01133 return client->PortUnRegister(myport);
01134 }
01135
01136 EXPORT int jack_port_is_mine(const jack_client_t* ext_client, const jack_port_t* port)
01137 {
01138 #ifdef __CLIENTDEBUG__
01139 JackLibGlobals::CheckContext();
01140 #endif
01141 JackClient* client = (JackClient*)ext_client;
01142 if (client == NULL) {
01143 jack_error("jack_port_is_mine called with a NULL client");
01144 return -1;
01145 }
01146 #if defined(__x86_64__) || defined(__ppc64__)
01147 uint64_t port_aux = (uint64_t)port;
01148 #else
01149 uint32_t port_aux = (uint32_t)port;
01150 #endif
01151 jack_port_id_t myport = (jack_port_id_t)port_aux;
01152 if (!CheckPort(myport)) {
01153 jack_error("jack_port_is_mine called with an incorrect port %ld", myport);
01154 return -1;
01155 }
01156 return client->PortIsMine(myport);
01157 }
01158
01159 EXPORT const char** jack_port_get_connections(const jack_port_t* port)
01160 {
01161 #ifdef __CLIENTDEBUG__
01162 JackLibGlobals::CheckContext();
01163 #endif
01164 #if defined(__x86_64__) || defined(__ppc64__)
01165 uint64_t port_aux = (uint64_t)port;
01166 #else
01167 uint32_t port_aux = (uint32_t)port;
01168 #endif
01169 jack_port_id_t myport = (jack_port_id_t)port_aux;
01170 if (!CheckPort(myport)) {
01171 jack_error("jack_port_get_connections called with an incorrect port %ld", myport);
01172 return NULL;
01173 } else {
01174 WaitGraphChange();
01175 JackGraphManager* manager = GetGraphManager();
01176 return (manager ? manager->GetConnections(myport) : NULL);
01177 }
01178 }
01179
01180
01181 EXPORT const char** jack_port_get_all_connections(const jack_client_t* ext_client, const jack_port_t* port)
01182 {
01183 #ifdef __CLIENTDEBUG__
01184 JackLibGlobals::CheckContext();
01185 #endif
01186 JackClient* client = (JackClient*)ext_client;
01187 if (client == NULL) {
01188 jack_error("jack_port_get_all_connections called with a NULL client");
01189 return NULL;
01190 }
01191
01192 #if defined(__x86_64__) || defined(__ppc64__)
01193 uint64_t port_aux = (uint64_t)port;
01194 #else
01195 uint32_t port_aux = (uint32_t)port;
01196 #endif
01197 jack_port_id_t myport = (jack_port_id_t)port_aux;
01198 if (!CheckPort(myport)) {
01199 jack_error("jack_port_get_all_connections called with an incorrect port %ld", myport);
01200 return NULL;
01201 } else {
01202 WaitGraphChange();
01203 JackGraphManager* manager = GetGraphManager();
01204 return (manager ? manager->GetConnections(myport) : NULL);
01205 }
01206 }
01207
01208 EXPORT jack_nframes_t jack_port_get_total_latency(jack_client_t* ext_client, jack_port_t* port)
01209 {
01210 #ifdef __CLIENTDEBUG__
01211 JackLibGlobals::CheckContext();
01212 #endif
01213 JackClient* client = (JackClient*)ext_client;
01214 if (client == NULL) {
01215 jack_error("jack_port_get_total_latency called with a NULL client");
01216 return 0;
01217 }
01218
01219 #if defined(__x86_64__) || defined(__ppc64__)
01220 uint64_t port_aux = (uint64_t)port;
01221 #else
01222 uint32_t port_aux = (uint32_t)port;
01223 #endif
01224 jack_port_id_t myport = (jack_port_id_t)port_aux;
01225 if (!CheckPort(myport)) {
01226 jack_error("jack_port_get_total_latency called with an incorrect port %ld", myport);
01227 return 0;
01228 } else {
01229 WaitGraphChange();
01230 JackGraphManager* manager = GetGraphManager();
01231 if (manager) {
01232 manager->ComputeTotalLatency(myport);
01233 return manager->GetPort(myport)->GetTotalLatency();
01234 } else {
01235 return 0;
01236 }
01237 }
01238 }
01239
01240 EXPORT int jack_connect(jack_client_t* ext_client, const char* src, const char* dst)
01241 {
01242 #ifdef __CLIENTDEBUG__
01243 JackLibGlobals::CheckContext();
01244 #endif
01245 JackClient* client = (JackClient*)ext_client;
01246 if (client == NULL) {
01247 jack_error("jack_connect called with a NULL client");
01248 return -1;
01249 } else if ((src == NULL) || (dst == NULL)) {
01250 jack_error("jack_connect called with a NULL port name");
01251 return -1;
01252 } else {
01253 return client->PortConnect(src, dst);
01254 }
01255 }
01256
01257 EXPORT int jack_disconnect(jack_client_t* ext_client, const char* src, const char* dst)
01258 {
01259 #ifdef __CLIENTDEBUG__
01260 JackLibGlobals::CheckContext();
01261 #endif
01262 JackClient* client = (JackClient*)ext_client;
01263 if (client == NULL) {
01264 jack_error("jack_disconnect called with a NULL client");
01265 return -1;
01266 } else if ((src == NULL) || (dst == NULL)) {
01267 jack_error("jack_connect called with a NULL port name");
01268 return -1;
01269 } else {
01270 return client->PortDisconnect(src, dst);
01271 }
01272 }
01273
01274 EXPORT int jack_port_disconnect(jack_client_t* ext_client, jack_port_t* src)
01275 {
01276 #ifdef __CLIENTDEBUG__
01277 JackLibGlobals::CheckContext();
01278 #endif
01279 JackClient* client = (JackClient*)ext_client;
01280 if (client == NULL) {
01281 jack_error("jack_port_disconnect called with a NULL client");
01282 return -1;
01283 }
01284 #if defined(__x86_64__) || defined(__ppc64__)
01285 uint64_t port_aux = (uint64_t)src;
01286 #else
01287 uint32_t port_aux = (uint32_t)src;
01288 #endif
01289 jack_port_id_t myport = (jack_port_id_t)port_aux;
01290 if (!CheckPort(myport)) {
01291 jack_error("jack_port_disconnect called with an incorrect port %ld", myport);
01292 return -1;
01293 }
01294 return client->PortDisconnect(myport);
01295 }
01296
01297 EXPORT jack_nframes_t jack_get_sample_rate(jack_client_t* ext_client)
01298 {
01299 #ifdef __CLIENTDEBUG__
01300 JackLibGlobals::CheckContext();
01301 #endif
01302 JackClient* client = (JackClient*)ext_client;
01303 if (client == NULL) {
01304 jack_error("jack_get_sample_rate called with a NULL client");
01305 return 0;
01306 } else {
01307 JackEngineControl* control = GetEngineControl();
01308 return (control ? control->fSampleRate : 0);
01309 }
01310 }
01311
01312 EXPORT jack_nframes_t jack_get_buffer_size(jack_client_t* ext_client)
01313 {
01314 #ifdef __CLIENTDEBUG__
01315 JackLibGlobals::CheckContext();
01316 #endif
01317 JackClient* client = (JackClient*)ext_client;
01318 if (client == NULL) {
01319 jack_error("jack_get_buffer_size called with a NULL client");
01320 return 0;
01321 } else {
01322 JackEngineControl* control = GetEngineControl();
01323 return (control ? control->fBufferSize : 0);
01324 }
01325 }
01326
01327 EXPORT const char** jack_get_ports(jack_client_t* ext_client, const char* port_name_pattern, const char* type_name_pattern, unsigned long flags)
01328 {
01329 #ifdef __CLIENTDEBUG__
01330 JackLibGlobals::CheckContext();
01331 #endif
01332 JackClient* client = (JackClient*)ext_client;
01333 if (client == NULL) {
01334 jack_error("jack_get_ports called with a NULL client");
01335 return NULL;
01336 }
01337 JackGraphManager* manager = GetGraphManager();
01338 return (manager ? manager->GetPorts(port_name_pattern, type_name_pattern, flags) : NULL);
01339 }
01340
01341 EXPORT jack_port_t* jack_port_by_name(jack_client_t* ext_client, const char* portname)
01342 {
01343 #ifdef __CLIENTDEBUG__
01344 JackLibGlobals::CheckContext();
01345 #endif
01346 JackClient* client = (JackClient*)ext_client;
01347 if (client == NULL) {
01348 jack_error("jack_get_ports called with a NULL client");
01349 return 0;
01350 }
01351
01352 if (portname == NULL) {
01353 jack_error("jack_port_by_name called with a NULL port name");
01354 return NULL;
01355 } else {
01356 JackGraphManager* manager = GetGraphManager();
01357 if (!manager)
01358 return NULL;
01359 int res = manager->GetPort(portname);
01360 #if defined(__x86_64__) || defined(__ppc64__)
01361 return (res == NO_PORT) ? NULL : (jack_port_t*)((uint64_t)res);
01362 #else
01363 return (res == NO_PORT) ? NULL : (jack_port_t*)res;
01364 #endif
01365 }
01366 }
01367
01368 EXPORT jack_port_t* jack_port_by_id(jack_client_t* ext_client, jack_port_id_t id)
01369 {
01370 #ifdef __CLIENTDEBUG__
01371 JackLibGlobals::CheckContext();
01372 #endif
01373
01374 #if defined(__x86_64__) || defined(__ppc64__)
01375 return (jack_port_t*)((uint64_t)id);
01376 #else
01377 return (jack_port_t*)id;
01378 #endif
01379 }
01380
01381 EXPORT int jack_engine_takeover_timebase(jack_client_t* ext_client)
01382 {
01383 #ifdef __CLIENTDEBUG__
01384 JackLibGlobals::CheckContext();
01385 #endif
01386 JackClient* client = (JackClient*)ext_client;
01387 if (client == NULL) {
01388 jack_error("jack_engine_takeover_timebase called with a NULL client");
01389 return -1;
01390 } else {
01391 jack_error("jack_engine_takeover_timebase: deprecated\n");
01392 return 0;
01393 }
01394 }
01395
01396 EXPORT jack_nframes_t jack_frames_since_cycle_start(const jack_client_t* ext_client)
01397 {
01398 #ifdef __CLIENTDEBUG__
01399 JackLibGlobals::CheckContext();
01400 #endif
01401 JackTimer timer;
01402 JackEngineControl* control = GetEngineControl();
01403 if (control) {
01404 control->ReadFrameTime(&timer);
01405 return timer.FramesSinceCycleStart(GetMicroSeconds(), control->fSampleRate);
01406 } else {
01407 return 0;
01408 }
01409 }
01410
01411 EXPORT jack_time_t jack_get_time()
01412 {
01413 return GetMicroSeconds();
01414 }
01415
01416 EXPORT jack_time_t jack_frames_to_time(const jack_client_t* ext_client, jack_nframes_t frames)
01417 {
01418 #ifdef __CLIENTDEBUG__
01419 JackLibGlobals::CheckContext();
01420 #endif
01421 JackClient* client = (JackClient*)ext_client;
01422 if (client == NULL) {
01423 jack_error("jack_frames_to_time called with a NULL client");
01424 return 0;
01425 } else {
01426 JackTimer timer;
01427 JackEngineControl* control = GetEngineControl();
01428 if (control) {
01429 control->ReadFrameTime(&timer);
01430 return timer.Frames2Time(frames, control->fBufferSize);
01431 } else {
01432 return 0;
01433 }
01434 }
01435 }
01436
01437 EXPORT jack_nframes_t jack_time_to_frames(const jack_client_t* ext_client, jack_time_t time)
01438 {
01439 #ifdef __CLIENTDEBUG__
01440 JackLibGlobals::CheckContext();
01441 #endif
01442 JackClient* client = (JackClient*)ext_client;
01443 if (client == NULL) {
01444 jack_error("jack_time_to_frames called with a NULL client");
01445 return 0;
01446 } else {
01447 JackTimer timer;
01448 JackEngineControl* control = GetEngineControl();
01449 if (control) {
01450 control->ReadFrameTime(&timer);
01451 return timer.Time2Frames(time, control->fBufferSize);
01452 } else {
01453 return 0;
01454 }
01455 }
01456 }
01457
01458 EXPORT jack_nframes_t jack_frame_time(const jack_client_t* ext_client)
01459 {
01460 return jack_time_to_frames(ext_client, GetMicroSeconds());
01461 }
01462
01463 EXPORT jack_nframes_t jack_last_frame_time(const jack_client_t* ext_client)
01464 {
01465 #ifdef __CLIENTDEBUG__
01466 JackLibGlobals::CheckContext();
01467 #endif
01468 JackEngineControl* control = GetEngineControl();
01469 return (control) ? control->fFrameTimer.ReadCurrentState()->CurFrame() : 0;
01470 }
01471
01472 EXPORT float jack_cpu_load(jack_client_t* ext_client)
01473 {
01474 #ifdef __CLIENTDEBUG__
01475 JackLibGlobals::CheckContext();
01476 #endif
01477 JackClient* client = (JackClient*)ext_client;
01478 if (client == NULL) {
01479 jack_error("jack_cpu_load called with a NULL client");
01480 return 0.0f;
01481 } else {
01482 JackEngineControl* control = GetEngineControl();
01483 return (control ? control->fCPULoad : 0.0f);
01484 }
01485 }
01486
01487 EXPORT pthread_t jack_client_thread_id(jack_client_t* ext_client)
01488 {
01489 #ifdef __CLIENTDEBUG__
01490 JackLibGlobals::CheckContext();
01491 #endif
01492 JackClient* client = (JackClient*)ext_client;
01493 if (client == NULL) {
01494 jack_error("jack_client_thread_id called with a NULL client");
01495 return (pthread_t)NULL;
01496 } else {
01497 return client->GetThreadID();
01498 }
01499 }
01500
01501 EXPORT char* jack_get_client_name(jack_client_t* ext_client)
01502 {
01503 #ifdef __CLIENTDEBUG__
01504 JackLibGlobals::CheckContext();
01505 #endif
01506 JackClient* client = (JackClient*)ext_client;
01507 if (client == NULL) {
01508 jack_error("jack_get_client_name called with a NULL client");
01509 return NULL;
01510 } else {
01511 return client->GetClientControl()->fName;
01512 }
01513 }
01514
01515 EXPORT int jack_client_name_size(void)
01516 {
01517 return JACK_CLIENT_NAME_SIZE;
01518 }
01519
01520 EXPORT int jack_port_name_size(void)
01521 {
01522 return JACK_PORT_NAME_SIZE;
01523 }
01524
01525 EXPORT int jack_port_type_size(void)
01526 {
01527 return JACK_PORT_TYPE_SIZE;
01528 }
01529
01530
01531 EXPORT int jack_release_timebase(jack_client_t* ext_client)
01532 {
01533 #ifdef __CLIENTDEBUG__
01534 JackLibGlobals::CheckContext();
01535 #endif
01536 JackClient* client = (JackClient*)ext_client;
01537 if (client == NULL) {
01538 jack_error("jack_release_timebase called with a NULL client");
01539 return -1;
01540 } else {
01541 return client->ReleaseTimebase();
01542 }
01543 }
01544
01545 EXPORT int jack_set_sync_callback(jack_client_t* ext_client, JackSyncCallback sync_callback, void *arg)
01546 {
01547 #ifdef __CLIENTDEBUG__
01548 JackLibGlobals::CheckContext();
01549 #endif
01550 JackClient* client = (JackClient*)ext_client;
01551 if (client == NULL) {
01552 jack_error("jack_set_sync_callback called with a NULL client");
01553 return -1;
01554 } else {
01555 return client->SetSyncCallback(sync_callback, arg);
01556 }
01557 }
01558
01559 EXPORT int jack_set_sync_timeout(jack_client_t* ext_client, jack_time_t timeout)
01560 {
01561 #ifdef __CLIENTDEBUG__
01562 JackLibGlobals::CheckContext();
01563 #endif
01564 JackClient* client = (JackClient*)ext_client;
01565 if (client == NULL) {
01566 jack_error("jack_set_sync_timeout called with a NULL client");
01567 return -1;
01568 } else {
01569 return client->SetSyncTimeout(timeout);
01570 }
01571 }
01572
01573 EXPORT int jack_set_timebase_callback(jack_client_t* ext_client, int conditional, JackTimebaseCallback timebase_callback, void* arg)
01574 {
01575 #ifdef __CLIENTDEBUG__
01576 JackLibGlobals::CheckContext();
01577 #endif
01578 JackClient* client = (JackClient*)ext_client;
01579 if (client == NULL) {
01580 jack_error("jack_set_timebase_callback called with a NULL client");
01581 return -1;
01582 } else {
01583 return client->SetTimebaseCallback(conditional, timebase_callback, arg);
01584 }
01585 }
01586
01587 EXPORT int jack_transport_locate(jack_client_t* ext_client, jack_nframes_t frame)
01588 {
01589 #ifdef __CLIENTDEBUG__
01590 JackLibGlobals::CheckContext();
01591 #endif
01592 JackClient* client = (JackClient*)ext_client;
01593 if (client == NULL) {
01594 jack_error("jack_transport_locate called with a NULL client");
01595 return -1;
01596 } else {
01597 client->TransportLocate(frame);
01598 return 0;
01599 }
01600 }
01601
01602 EXPORT jack_transport_state_t jack_transport_query(const jack_client_t* ext_client, jack_position_t* pos)
01603 {
01604 #ifdef __CLIENTDEBUG__
01605 JackLibGlobals::CheckContext();
01606 #endif
01607 JackClient* client = (JackClient*)ext_client;
01608 if (client == NULL) {
01609 jack_error("jack_transport_query called with a NULL client");
01610 return JackTransportStopped;
01611 } else {
01612 return client->TransportQuery(pos);
01613 }
01614 }
01615
01616 EXPORT jack_nframes_t jack_get_current_transport_frame(const jack_client_t* ext_client)
01617 {
01618 #ifdef __CLIENTDEBUG__
01619 JackLibGlobals::CheckContext();
01620 #endif
01621 JackClient* client = (JackClient*)ext_client;
01622 if (client == NULL) {
01623 jack_error("jack_get_current_transport_frame called with a NULL client");
01624 return 0;
01625 } else {
01626 return client->GetCurrentTransportFrame();
01627 }
01628 }
01629
01630 EXPORT int jack_transport_reposition(jack_client_t* ext_client, jack_position_t* pos)
01631 {
01632 #ifdef __CLIENTDEBUG__
01633 JackLibGlobals::CheckContext();
01634 #endif
01635 JackClient* client = (JackClient*)ext_client;
01636 if (client == NULL) {
01637 jack_error("jack_transport_reposition called with a NULL client");
01638 return -1;
01639 } else {
01640 client->TransportReposition(pos);
01641 return 0;
01642 }
01643 }
01644
01645 EXPORT void jack_transport_start(jack_client_t* ext_client)
01646 {
01647 #ifdef __CLIENTDEBUG__
01648 JackLibGlobals::CheckContext();
01649 #endif
01650 JackClient* client = (JackClient*)ext_client;
01651 if (client == NULL) {
01652 jack_error("jack_transport_start called with a NULL client");
01653 } else {
01654 client->TransportStart();
01655 }
01656 }
01657
01658 EXPORT void jack_transport_stop(jack_client_t* ext_client)
01659 {
01660 #ifdef __CLIENTDEBUG__
01661 JackLibGlobals::CheckContext();
01662 #endif
01663 JackClient* client = (JackClient*)ext_client;
01664 if (client == NULL) {
01665 jack_error("jack_transport_stop called with a NULL client");
01666 } else {
01667 client->TransportStop();
01668 }
01669 }
01670
01671
01672 EXPORT void jack_get_transport_info(jack_client_t* ext_client, jack_transport_info_t* tinfo)
01673 {
01674 jack_error("jack_get_transport_info: deprecated");
01675 if (tinfo)
01676 memset(tinfo, 0, sizeof(jack_transport_info_t));
01677 }
01678
01679 EXPORT void jack_set_transport_info(jack_client_t* ext_client, jack_transport_info_t* tinfo)
01680 {
01681 jack_error("jack_set_transport_info: deprecated");
01682 if (tinfo)
01683 memset(tinfo, 0, sizeof(jack_transport_info_t));
01684 }
01685
01686
01687 EXPORT float jack_get_max_delayed_usecs(jack_client_t* ext_client)
01688 {
01689 #ifdef __CLIENTDEBUG__
01690 JackLibGlobals::CheckContext();
01691 #endif
01692 JackClient* client = (JackClient*)ext_client;
01693 if (client == NULL) {
01694 jack_error("jack_get_max_delayed_usecs called with a NULL client");
01695 return 0.f;
01696 } else {
01697 JackEngineControl* control = GetEngineControl();
01698 return (control ? control->fMaxDelayedUsecs : 0.f);
01699 }
01700 }
01701
01702 EXPORT float jack_get_xrun_delayed_usecs(jack_client_t* ext_client)
01703 {
01704 #ifdef __CLIENTDEBUG__
01705 JackLibGlobals::CheckContext();
01706 #endif
01707 JackClient* client = (JackClient*)ext_client;
01708 if (client == NULL) {
01709 jack_error("jack_get_xrun_delayed_usecs called with a NULL client");
01710 return 0.f;
01711 } else {
01712 JackEngineControl* control = GetEngineControl();
01713 return (control ? control->fXrunDelayedUsecs : 0.f);
01714 }
01715 }
01716
01717 EXPORT void jack_reset_max_delayed_usecs(jack_client_t* ext_client)
01718 {
01719 #ifdef __CLIENTDEBUG__
01720 JackLibGlobals::CheckContext();
01721 #endif
01722 JackClient* client = (JackClient*)ext_client;
01723 if (client == NULL) {
01724 jack_error("jack_reset_max_delayed_usecs called with a NULL client");
01725 } else {
01726 JackEngineControl* control = GetEngineControl();
01727 control->ResetXRun();
01728 }
01729 }
01730
01731
01732 EXPORT int jack_client_real_time_priority(jack_client_t* ext_client)
01733 {
01734 #ifdef __CLIENTDEBUG__
01735 JackLibGlobals::CheckContext();
01736 #endif
01737 JackClient* client = (JackClient*)ext_client;
01738 if (client == NULL) {
01739 jack_error("jack_client_real_time_priority called with a NULL client");
01740 return -1;
01741 } else {
01742 JackEngineControl* control = GetEngineControl();
01743 return (control->fRealTime) ? control->fClientPriority : -1;
01744 }
01745 }
01746
01747 EXPORT int jack_client_max_real_time_priority(jack_client_t* ext_client)
01748 {
01749 #ifdef __CLIENTDEBUG__
01750 JackLibGlobals::CheckContext();
01751 #endif
01752 JackClient* client = (JackClient*)ext_client;
01753 if (client == NULL) {
01754 jack_error("jack_client_max_real_time_priority called with a NULL client");
01755 return -1;
01756 } else {
01757 JackEngineControl* control = GetEngineControl();
01758 return (control->fRealTime) ? control->fMaxClientPriority : -1;
01759 }
01760 }
01761
01762 EXPORT int jack_acquire_real_time_scheduling(pthread_t thread, int priority)
01763 {
01764 JackEngineControl* control = GetEngineControl();
01765 return (control ? JackThread::AcquireRealTimeImp(thread, priority, GetEngineControl()->fPeriod, GetEngineControl()->fComputation, GetEngineControl()->fConstraint) : -1);
01766 }
01767
01768 EXPORT int jack_client_create_thread(jack_client_t* client,
01769 pthread_t *thread,
01770 int priority,
01771 int realtime,
01772 thread_routine routine,
01773 void *arg)
01774 {
01775 return JackThread::StartImp(thread, priority, realtime, routine, arg);
01776 }
01777
01778 EXPORT int jack_drop_real_time_scheduling(pthread_t thread)
01779 {
01780 return JackThread::DropRealTimeImp(thread);
01781 }
01782
01783 EXPORT int jack_client_stop_thread(jack_client_t* client, pthread_t thread)
01784 {
01785 return JackThread::StopImp(thread);
01786 }
01787
01788 EXPORT int jack_client_kill_thread(jack_client_t* client, pthread_t thread)
01789 {
01790 return JackThread::KillImp(thread);
01791 }
01792
01793 #ifndef WIN32
01794 EXPORT void jack_set_thread_creator (jack_thread_creator_t jtc)
01795 {
01796 JackGlobals::fJackThreadCreator = (jtc == NULL) ? pthread_create : jtc;
01797 }
01798 #endif
01799
01800
01801 EXPORT int jack_internal_client_new (const char *client_name,
01802 const char *load_name,
01803 const char *load_init)
01804 {
01805 jack_error("jack_internal_client_new: deprecated");
01806 return -1;
01807 }
01808
01809 EXPORT void jack_internal_client_close (const char *client_name)
01810 {
01811 jack_error("jack_internal_client_close: deprecated");
01812 }
01813
01814 EXPORT char* jack_get_internal_client_name(jack_client_t* ext_client, jack_intclient_t intclient)
01815 {
01816 #ifdef __CLIENTDEBUG__
01817 JackLibGlobals::CheckContext();
01818 #endif
01819 JackClient* client = (JackClient*)ext_client;
01820 if (client == NULL) {
01821 jack_error("jack_get_internal_client_name called with a NULL client");
01822 return NULL;
01823 } else if (intclient >= CLIENT_NUM) {
01824 jack_error("jack_get_internal_client_name: incorrect client");
01825 return NULL;
01826 } else {
01827 return client->GetInternalClientName(intclient);
01828 }
01829 }
01830
01831 EXPORT jack_intclient_t jack_internal_client_handle(jack_client_t* ext_client, const char* client_name, jack_status_t* status)
01832 {
01833 #ifdef __CLIENTDEBUG__
01834 JackLibGlobals::CheckContext();
01835 #endif
01836 JackClient* client = (JackClient*)ext_client;
01837 if (client == NULL) {
01838 jack_error("jack_internal_client_handle called with a NULL client");
01839 return 0;
01840 } else {
01841 jack_status_t my_status;
01842 if (status == NULL)
01843 status = &my_status;
01844 *status = (jack_status_t)0;
01845 return client->InternalClientHandle(client_name, status);
01846 }
01847 }
01848
01849 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)
01850 {
01851 #ifdef __CLIENTDEBUG__
01852 JackLibGlobals::CheckContext();
01853 #endif
01854 JackClient* client = (JackClient*)ext_client;
01855 if (client == NULL) {
01856 jack_error("jack_internal_client_load called with a NULL client");
01857 return 0;
01858 } else {
01859 jack_varargs_t va;
01860 jack_status_t my_status;
01861
01862 if (status == NULL)
01863 status = &my_status;
01864 *status = (jack_status_t)0;
01865
01866
01867 if ((options & ~JackLoadOptions)) {
01868 int my_status1 = *status | (JackFailure | JackInvalidOption);
01869 *status = (jack_status_t)my_status1;
01870 return 0;
01871 }
01872
01873
01874 jack_varargs_parse(options, ap, &va);
01875 return client->InternalClientLoad(client_name, options, status, &va);
01876 }
01877 }
01878
01879 EXPORT jack_intclient_t jack_internal_client_load(jack_client_t *client, const char *client_name, jack_options_t options, jack_status_t *status, ...)
01880 {
01881 va_list ap;
01882 va_start(ap, status);
01883 jack_intclient_t res = jack_internal_client_load_aux(client, client_name, options, status, ap);
01884 va_end(ap);
01885 return res;
01886 }
01887
01888 EXPORT jack_status_t jack_internal_client_unload(jack_client_t* ext_client, jack_intclient_t intclient)
01889 {
01890 #ifdef __CLIENTDEBUG__
01891 JackLibGlobals::CheckContext();
01892 #endif
01893 JackClient* client = (JackClient*)ext_client;
01894 if (client == NULL) {
01895 jack_error("jack_internal_client_unload called with a NULL client");
01896 return (jack_status_t)(JackNoSuchClient | JackFailure);
01897 } else if (intclient >= CLIENT_NUM) {
01898 jack_error("jack_internal_client_unload: incorrect client");
01899 return (jack_status_t)(JackNoSuchClient | JackFailure);
01900 } else {
01901 jack_status_t my_status;
01902 client->InternalClientUnload(intclient, &my_status);
01903 return my_status;
01904 }
01905 }
01906
01907 EXPORT
01908 void
01909 jack_get_version(
01910 int *major_ptr,
01911 int *minor_ptr,
01912 int *micro_ptr,
01913 int *proto_ptr)
01914 {
01915
01916 *major_ptr = 0;
01917 *minor_ptr = 0;
01918 *micro_ptr = 0;
01919 *proto_ptr = 0;
01920 }
01921
01922 EXPORT
01923 const char *
01924 jack_get_version_string()
01925 {
01926 return VERSION;
01927 }
01928
01929 EXPORT void jack_free(void* ptr)
01930 {
01931 free(ptr);
01932 }