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