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