diff options
author | sletz <sletz@0c269be4-1314-0410-8aa9-9f06e86f4224> | 2008-03-13 13:50:18 +0000 |
---|---|---|
committer | sletz <sletz@0c269be4-1314-0410-8aa9-9f06e86f4224> | 2008-03-13 13:50:18 +0000 |
commit | 2f7db97fb6eded493d3948604e14b2a63f69bd85 (patch) | |
tree | 27d463b61d93d4595531db30879545347f0e5576 | |
parent | 9940c6221d8e5a41cd6261932bcea6c644f6fcf8 (diff) | |
download | jack2-2f7db97fb6eded493d3948604e14b2a63f69bd85.tar.gz |
Correct all backend playback port latency in case of asynchronous mode (1 buffer more).
git-svn-id: http://subversion.jackaudio.org/jack/jack2/trunk/jackmp@1972 0c269be4-1314-0410-8aa9-9f06e86f4224
-rw-r--r-- | ChangeLog | 1 | ||||
-rw-r--r-- | common/JackAPI.cpp | 14 | ||||
-rw-r--r-- | common/JackAPIWrapper.cpp | 506 | ||||
-rw-r--r-- | common/JackAudioDriver.cpp | 3 | ||||
-rw-r--r-- | common/JackClient.cpp | 34 | ||||
-rw-r--r-- | common/JackDebugClient.h | 2 | ||||
-rw-r--r-- | common/JackEngine.cpp | 4 | ||||
-rw-r--r-- | common/JackGraphManager.cpp | 14 | ||||
-rw-r--r-- | common/JackInternalClient.cpp | 10 | ||||
-rw-r--r-- | common/JackLibAPI.cpp | 14 | ||||
-rw-r--r-- | common/JackProcessSync.h | 4 | ||||
-rw-r--r-- | common/JackServer.h | 2 | ||||
-rw-r--r-- | common/JackServerAPI.cpp | 20 | ||||
-rw-r--r-- | common/JackServerGlobals.cpp | 2 | ||||
-rw-r--r-- | common/JackTools.cpp | 3 | ||||
-rw-r--r-- | common/transport_types.h | 2 | ||||
-rw-r--r-- | linux/alsa/JackAlsaDriver.cpp | 4 | ||||
-rw-r--r-- | linux/alsa/memops.h | 6 | ||||
-rw-r--r-- | linux/firewire/JackFFADODriver.cpp | 3 | ||||
-rw-r--r-- | linux/freebob/JackFreebobDriver.cpp | 3 | ||||
-rw-r--r-- | macosx/JackCoreAudioDriver.cpp | 12 | ||||
-rw-r--r-- | macosx/JackCoreAudioDriver.h | 1 | ||||
-rw-r--r-- | macosx/JackMachThread.cpp | 2 |
23 files changed, 333 insertions, 333 deletions
@@ -23,6 +23,7 @@ Nedko Arnaudov * Add test for jack_cycle_wait, jack_cycle_wait and jack_set_process_thread API. * Add jack_set_process_thread in wrapper library. + * Correct all backend playback port latency in case of "asynchronous" mode (1 buffer more). 2008-03-12 Stephane Letz <letz@grame.fr> diff --git a/common/JackAPI.cpp b/common/JackAPI.cpp index 3079a0d9..b2584449 100644 --- a/common/JackAPI.cpp +++ b/common/JackAPI.cpp @@ -48,10 +48,10 @@ extern "C" { #endif - EXPORT jack_client_t * jack_client_open_aux (const char *client_name, + EXPORT jack_client_t * jack_client_open_aux (const char *client_name, jack_options_t options, jack_status_t *status, va_list ap); - EXPORT jack_client_t * jack_client_open (const char *client_name, + EXPORT jack_client_t * jack_client_open (const char *client_name, jack_options_t options, jack_status_t *status, ...); EXPORT jack_client_t * jack_client_new (const char *client_name); @@ -167,7 +167,7 @@ extern "C" EXPORT float jack_cpu_load (jack_client_t *client); EXPORT pthread_t jack_client_thread_id (jack_client_t *); EXPORT void jack_set_error_function (void (*func)(const char *)); - EXPORT void jack_set_info_function (void (*func)(const char *)); + EXPORT void jack_set_info_function (void (*func)(const char *)); EXPORT float jack_get_max_delayed_usecs (jack_client_t *client); EXPORT float jack_get_xrun_delayed_usecs (jack_client_t *client); @@ -215,7 +215,7 @@ extern "C" const char *client_name, jack_options_t options, jack_status_t *status, ...); - EXPORT jack_intclient_t jack_internal_client_load_aux (jack_client_t *client, + EXPORT jack_intclient_t jack_internal_client_load_aux (jack_client_t *client, const char *client_name, jack_options_t options, jack_status_t *status, va_list ap); @@ -274,7 +274,7 @@ EXPORT jack_client_t* jack_client_new(const char* client_name) int options = JackUseExactName; if (getenv("JACK_START_SERVER") == NULL) options |= JackNoStartServer; - va_list ap; + va_list ap; return jack_client_open_aux(client_name, (jack_options_t)options, NULL, ap); } @@ -1628,9 +1628,9 @@ EXPORT jack_intclient_t jack_internal_client_load_aux(jack_client_t* ext_client, EXPORT jack_intclient_t jack_internal_client_load(jack_client_t *client, const char *client_name, jack_options_t options, jack_status_t *status, ...) { - va_list ap; + va_list ap; va_start(ap, status); - jack_intclient_t res = jack_internal_client_load_aux(client, client_name, options, status, ap); + jack_intclient_t res = jack_internal_client_load_aux(client, client_name, options, status, ap); va_end(ap); return res; } diff --git a/common/JackAPIWrapper.cpp b/common/JackAPIWrapper.cpp index 07aee210..c3b09997 100644 --- a/common/JackAPIWrapper.cpp +++ b/common/JackAPIWrapper.cpp @@ -50,7 +50,7 @@ extern "C" EXPORT int jack_set_process_callback (jack_client_t *client, JackProcessCallback process_callback, void *arg); - EXPORT jack_nframes_t jack_thread_wait(jack_client_t *client, int status); + EXPORT jack_nframes_t jack_thread_wait(jack_client_t *client, int status); EXPORT jack_nframes_t jack_cycle_wait (jack_client_t*); EXPORT void jack_cycle_signal (jack_client_t*, int status); EXPORT int jack_set_process_thread(jack_client_t* client, JackThreadCallback fun, void *arg); @@ -75,7 +75,7 @@ extern "C" EXPORT int jack_set_port_registration_callback (jack_client_t *, JackPortRegistrationCallback registration_callback, void *arg); - EXPORT int jack_set_port_connect_callback (jack_client_t *, + EXPORT int jack_set_port_connect_callback (jack_client_t *, JackPortConnectCallback connect_callback, void *arg); @@ -150,8 +150,8 @@ extern "C" EXPORT float jack_cpu_load (jack_client_t *client); EXPORT pthread_t jack_client_thread_id (jack_client_t *); EXPORT void jack_set_error_function (void (*func)(const char *)); - EXPORT void jack_set_info_function (void (*func)(const char *)); - + EXPORT void jack_set_info_function (void (*func)(const char *)); + EXPORT float jack_get_max_delayed_usecs (jack_client_t *client); EXPORT float jack_get_xrun_delayed_usecs (jack_client_t *client); EXPORT void jack_reset_max_delayed_usecs (jack_client_t *client); @@ -234,16 +234,16 @@ static void RewriteName(const char* name, char* new_name) new_name[i] = '\0'; } -static void jack_log(const char *fmt,...) +static void jack_log(const char *fmt, ...) { - /* - va_list ap; - va_start(ap, fmt); - f//printf(stderr,"Jack: "); - vfprintf(stderr, fmt, ap); - fprintf(stderr,"\n"); - va_end(ap); - */ + /* + va_list ap; + va_start(ap, fmt); + f//printf(stderr,"Jack: "); + vfprintf(stderr, fmt, ap); + fprintf(stderr,"\n"); + va_end(ap); + */ } /* Exec the JACK server in this process. Does not return. */ @@ -260,8 +260,8 @@ static void start_server_aux(const char* server_name) int i = 0; int good = 0; int ret; - - jack_log("start_server_aux"); + + jack_log("start_server_aux"); snprintf(filename, 255, "%s/.jackdrc", getenv("HOME")); fp = fopen(filename, "r"); @@ -334,13 +334,13 @@ static void start_server_aux(const char* server_name) int start_server(const char* server_name, jack_options_t options) { - jack_log("start_server 0"); - + jack_log("start_server 0"); + if ((options & JackNoStartServer) || getenv("JACK_NO_START_SERVER")) { return 1; } - - jack_log("start_server 1"); + + jack_log("start_server 1"); /* The double fork() forces the server to become a child of * init, which will always clean up zombie process state on @@ -367,7 +367,7 @@ int start_server(const char* server_name, jack_options_t options) } /* only the original parent process goes here */ - sleep(1); + sleep(1); return 0; /* (probably) successful */ } @@ -377,7 +377,7 @@ typedef void* (*jack_port_get_buffer_fun_def)(jack_port_t* port, jack_nframes_t static jack_port_get_buffer_fun_def jack_port_get_buffer_fun = 0; EXPORT void* jack_port_get_buffer(jack_port_t* port, jack_nframes_t frames) { - jack_log("jack_port_get_buffer"); + jack_log("jack_port_get_buffer"); return (*jack_port_get_buffer_fun)(port, frames); } @@ -385,7 +385,7 @@ typedef const char* (*jack_port_name_fun_def)(const jack_port_t* port); static jack_port_name_fun_def jack_port_name_fun = 0; EXPORT const char* jack_port_name(const jack_port_t* port) { - jack_log("jack_port_name"); + jack_log("jack_port_name"); return (*jack_port_name_fun)(port); } @@ -393,7 +393,7 @@ typedef const char* (*jack_port_short_name_fun_def) (const jack_port_t* port); static jack_port_short_name_fun_def jack_port_short_name_fun = 0; EXPORT const char* jack_port_short_name(const jack_port_t* port) { - jack_log("jack_port_short_name"); + jack_log("jack_port_short_name"); return (*jack_port_short_name_fun)(port); } @@ -401,7 +401,7 @@ typedef int (*jack_port_flags_fun_def)(const jack_port_t* port); static jack_port_flags_fun_def jack_port_flags_fun = 0; EXPORT int jack_port_flags(const jack_port_t* port) { - jack_log("jack_port_flags"); + jack_log("jack_port_flags"); return (*jack_port_flags_fun)(port); } @@ -409,7 +409,7 @@ typedef const char* (*jack_port_type_fun_def)(const jack_port_t* port); static jack_port_type_fun_def jack_port_type_fun = 0; EXPORT const char* jack_port_type(const jack_port_t* port) { - jack_log("jack_port_type"); + jack_log("jack_port_type"); return (*jack_port_type_fun)(port); } @@ -417,7 +417,7 @@ typedef int (*jack_port_connected_fun_def)(const jack_port_t* port); static jack_port_connected_fun_def jack_port_connected_fun = 0; EXPORT int jack_port_connected(const jack_port_t* port) { - jack_log("jack_port_connected"); + jack_log("jack_port_connected"); return (*jack_port_connected_fun)(port); } @@ -425,7 +425,7 @@ typedef int (*jack_port_connected_to_fun_def)(const jack_port_t* port, const cha static jack_port_connected_to_fun_def jack_port_connected_to_fun = 0; EXPORT int jack_port_connected_to(const jack_port_t* port, const char* portname) { - jack_log("jack_port_connected_to"); + jack_log("jack_port_connected_to"); return (*jack_port_connected_to_fun)(port, portname); } @@ -433,7 +433,7 @@ typedef int (*jack_port_tie_fun_def)(jack_port_t* src, jack_port_t* dst); static jack_port_tie_fun_def jack_port_tie_fun = 0; EXPORT int jack_port_tie(jack_port_t* src, jack_port_t* dst) { - jack_log("jack_port_tie"); + jack_log("jack_port_tie"); return (*jack_port_tie_fun)(src, dst); } @@ -441,7 +441,7 @@ typedef int (*jack_port_untie_fun_def)(jack_port_t* port); static jack_port_untie_fun_def jack_port_untie_fun = 0; EXPORT int jack_port_untie(jack_port_t* port) { - jack_log("jack_port_untie"); + jack_log("jack_port_untie"); return (*jack_port_untie_fun)(port); } @@ -449,7 +449,7 @@ typedef jack_nframes_t (*jack_port_get_latency_fun_def)(jack_port_t* port); static jack_port_get_latency_fun_def jack_port_get_latency_fun = 0; EXPORT jack_nframes_t jack_port_get_latency(jack_port_t* port) { - jack_log("jack_port_get_latency"); + jack_log("jack_port_get_latency"); return (*jack_port_get_latency_fun)(port); } @@ -457,7 +457,7 @@ typedef void (*jack_port_set_latency_fun_def)(jack_port_t* port, jack_nframes_t static jack_port_set_latency_fun_def jack_port_set_latency_fun = 0; EXPORT void jack_port_set_latency(jack_port_t* port, jack_nframes_t frames) { - jack_log("jack_port_set_latency"); + jack_log("jack_port_set_latency"); (*jack_port_set_latency_fun)(port, frames); } @@ -465,7 +465,7 @@ typedef int (*jack_recompute_total_latency_fun_def)(jack_client_t* ext_client, j static jack_recompute_total_latency_fun_def jack_recompute_total_latency_fun = 0; EXPORT int jack_recompute_total_latency(jack_client_t* ext_client, jack_port_t* port) { - jack_log("jack_recompute_total_latency"); + jack_log("jack_recompute_total_latency"); return (*jack_recompute_total_latency_fun)(ext_client, port); } @@ -473,7 +473,7 @@ typedef int (*jack_recompute_total_latencies_fun_def)(jack_client_t* ext_client) static jack_recompute_total_latencies_fun_def jack_recompute_total_latencies_fun = 0; EXPORT int jack_recompute_total_latencies(jack_client_t* ext_client) { - jack_log("jack_recompute_total_latencies"); + jack_log("jack_recompute_total_latencies"); return (*jack_recompute_total_latencies_fun)(ext_client); } @@ -481,7 +481,7 @@ typedef int (*jack_port_set_name_fun_def)(jack_port_t* port, const char* name); static jack_port_set_name_fun_def jack_port_set_name_fun = 0; EXPORT int jack_port_set_name(jack_port_t* port, const char* name) { - jack_log("jack_port_set_name"); + jack_log("jack_port_set_name"); return (*jack_port_set_name_fun)(port, name); } @@ -489,7 +489,7 @@ typedef int (*jack_port_set_alias_fun_def)(jack_port_t* port, const char* alias) static jack_port_set_alias_fun_def jack_port_set_alias_fun = 0; EXPORT int jack_port_set_alias(jack_port_t* port, const char* alias) { - jack_log("jack_port_set_alias"); + jack_log("jack_port_set_alias"); return (*jack_port_set_alias_fun)(port, alias); } @@ -497,7 +497,7 @@ typedef int (*jack_port_unset_alias_fun_def)(jack_port_t* port, const char* alia static jack_port_unset_alias_fun_def jack_port_unset_alias_fun = 0; EXPORT int jack_port_unset_alias(jack_port_t* port, const char* alias) { - jack_log("jack_port_unset_alias"); + jack_log("jack_port_unset_alias"); return (*jack_port_unset_alias_fun)(port, alias); } @@ -505,7 +505,7 @@ typedef int (*jack_port_get_aliases_fun_def)(jack_port_t* port, char* const alia static jack_port_get_aliases_fun_def jack_port_get_aliases_fun = 0; EXPORT int jack_port_get_aliases(jack_port_t* port, char* const aliases[2]) { - jack_log("jack_port_get_aliases"); + jack_log("jack_port_get_aliases"); return (*jack_port_get_aliases_fun)(port, aliases); } @@ -513,7 +513,7 @@ typedef int (*jack_port_request_monitor_fun_def)(jack_port_t* port, int onoff); static jack_port_request_monitor_fun_def jack_port_request_monitor_fun = 0; EXPORT int jack_port_request_monitor(jack_port_t* port, int onoff) { - jack_log("jack_port_request_monitor"); + jack_log("jack_port_request_monitor"); return (*jack_port_request_monitor_fun)(port, onoff); } @@ -521,7 +521,7 @@ typedef int (*jack_port_request_monitor_by_name_fun_def)(jack_client_t* ext_clie static jack_port_request_monitor_by_name_fun_def jack_port_request_monitor_by_name_fun = 0; EXPORT int jack_port_request_monitor_by_name(jack_client_t* ext_client, const char* port_name, int onoff) { - jack_log("jack_port_request_monitor_by_name"); + jack_log("jack_port_request_monitor_by_name"); return (*jack_port_request_monitor_by_name_fun)(ext_client, port_name, onoff); } @@ -529,7 +529,7 @@ typedef int (*jack_port_ensure_monitor_fun_def)(jack_port_t* port, int onoff); static jack_port_ensure_monitor_fun_def jack_port_ensure_monitor_fun = 0; EXPORT int jack_port_ensure_monitor(jack_port_t* port, int onoff) { - jack_log("jack_port_ensure_monitor"); + jack_log("jack_port_ensure_monitor"); return (*jack_port_ensure_monitor_fun)(port, onoff); } @@ -537,7 +537,7 @@ typedef int (*jack_port_monitoring_input_fun_def)(jack_port_t* port); static jack_port_monitoring_input_fun_def jack_port_monitoring_input_fun = 0; EXPORT int jack_port_monitoring_input(jack_port_t* port) { - jack_log("jack_port_monitoring_input"); + jack_log("jack_port_monitoring_input"); return (*jack_port_monitoring_input_fun)(port); } @@ -545,7 +545,7 @@ typedef int (*jack_is_realtime_fun_def)(jack_client_t* ext_client); static jack_is_realtime_fun_def jack_is_realtime_fun = 0; EXPORT int jack_is_realtime(jack_client_t* ext_client) { - jack_log("jack_is_realtime"); + jack_log("jack_is_realtime"); return (*jack_is_realtime_fun)(ext_client); } @@ -554,15 +554,15 @@ typedef void (*jack_on_shutdown_fun_def)(jack_client_t* ext_client, shutdown_fun static jack_on_shutdown_fun_def jack_on_shutdown_fun = 0; EXPORT void jack_on_shutdown(jack_client_t* ext_client, shutdown_fun callback, void* arg) { - jack_log("jack_on_shutdown"); - (*jack_on_shutdown_fun)(ext_client, callback, arg); + jack_log("jack_on_shutdown"); + (*jack_on_shutdown_fun)(ext_client, callback, arg); } typedef int (*jack_set_process_callback_fun_def)(jack_client_t* ext_client, JackProcessCallback callback, void* arg); static jack_set_process_callback_fun_def jack_set_process_callback_fun = 0; EXPORT int jack_set_process_callback(jack_client_t* ext_client, JackProcessCallback callback, void* arg) { - jack_log("jack_set_process_callback"); + jack_log("jack_set_process_callback"); return (*jack_set_process_callback_fun)(ext_client, callback, arg); } @@ -570,7 +570,7 @@ typedef jack_nframes_t (*jack_cycle_wait_fun_def)(jack_client_t* ext_client); static jack_cycle_wait_fun_def jack_cycle_wait_fun = 0; EXPORT jack_nframes_t jack_cycle_wait(jack_client_t* ext_client) { - jack_log("jack_cycle_wait"); + jack_log("jack_cycle_wait"); return (*jack_cycle_wait_fun)(ext_client); } @@ -578,15 +578,15 @@ typedef void (*jack_cycle_signal_fun_def)(jack_client_t* ext_client, int status) static jack_cycle_signal_fun_def jack_cycle_signal_fun = 0; EXPORT void jack_cycle_signal(jack_client_t* ext_client, int status) { - jack_log("jack_cycle_signal"); - (*jack_cycle_signal_fun)(ext_client, status); + jack_log("jack_cycle_signal"); + (*jack_cycle_signal_fun)(ext_client, status); } typedef int (*jack_set_process_thread_fun_def)(jack_client_t* ext_client, JackThreadCallback callback, void *arg); static jack_set_process_thread_fun_def jack_set_process_thread_fun = 0; EXPORT int jack_set_process_thread(jack_client_t* ext_client, JackThreadCallback callback, void *arg) { - jack_log("jack_set_process_thread"); + jack_log("jack_set_process_thread"); return (*jack_set_process_thread_fun)(ext_client, callback, arg); } @@ -594,7 +594,7 @@ typedef jack_nframes_t (*jack_thread_wait_fun_def)(jack_client_t* ext_client, in static jack_thread_wait_fun_def jack_thread_wait_fun = 0; EXPORT jack_nframes_t jack_thread_wait(jack_client_t* ext_client, int status) { - jack_log("jack_thread_wait"); + jack_log("jack_thread_wait"); return (*jack_thread_wait_fun)(ext_client, status); } @@ -602,7 +602,7 @@ typedef int (*jack_set_freewheel_callback_fun_def)(jack_client_t* ext_client, Ja static jack_set_freewheel_callback_fun_def jack_set_freewheel_callback_fun = 0; EXPORT int jack_set_freewheel_callback(jack_client_t* ext_client, JackFreewheelCallback freewheel_callback, void* arg) { - jack_log("jack_set_freewheel_callback"); + jack_log("jack_set_freewheel_callback"); return (*jack_set_freewheel_callback_fun)(ext_client, freewheel_callback, arg); } @@ -610,7 +610,7 @@ typedef int (*jack_set_freewheel_fun_def)(jack_client_t* ext_client, int onoff); static jack_set_freewheel_fun_def jack_set_freewheel_fun = 0; EXPORT int jack_set_freewheel(jack_client_t* ext_client, int onoff) { - jack_log("jack_set_freewheel"); + jack_log("jack_set_freewheel"); return (*jack_set_freewheel_fun)(ext_client, onoff); } @@ -618,7 +618,7 @@ typedef int (*jack_set_buffer_size_fun_def)(jack_client_t* ext_client, jack_nfra static jack_set_buffer_size_fun_def jack_set_buffer_size_fun = 0; EXPORT int jack_set_buffer_size(jack_client_t* ext_client, jack_nframes_t buffer_size) { - jack_log("jack_set_buffer_size"); + jack_log("jack_set_buffer_size"); return (*jack_set_buffer_size_fun)(ext_client, buffer_size); } @@ -626,7 +626,7 @@ typedef int (*jack_set_buffer_size_callback_fun_def)(jack_client_t* ext_client, static jack_set_buffer_size_callback_fun_def jack_set_buffer_size_callback_fun = 0; EXPORT int jack_set_buffer_size_callback(jack_client_t* ext_client, JackBufferSizeCallback bufsize_callback, void* arg) { - jack_log("jack_set_buffer_size_callback"); + jack_log("jack_set_buffer_size_callback"); return (*jack_set_buffer_size_callback_fun)(ext_client, bufsize_callback, arg); } @@ -634,7 +634,7 @@ typedef int (*jack_set_sample_rate_callback_fun_def)(jack_client_t* ext_client, static jack_set_sample_rate_callback_fun_def jack_set_sample_rate_callback_fun = 0; EXPORT int jack_set_sample_rate_callback(jack_client_t* ext_client, JackSampleRateCallback srate_callback, void* arg) { - jack_log("jack_set_sample_rate_callback"); + jack_log("jack_set_sample_rate_callback"); return (*jack_set_sample_rate_callback_fun)(ext_client, srate_callback, arg); } @@ -642,7 +642,7 @@ typedef int (*jack_set_client_registration_callback_fun_def)(jack_client_t* ext_ static jack_set_client_registration_callback_fun_def jack_set_client_registration_callback_fun = 0; EXPORT int jack_set_client_registration_callback(jack_client_t* ext_client, JackClientRegistrationCallback registration_callback, void* arg) { - jack_log("jack_set_client_registration_callback"); + jack_log("jack_set_client_registration_callback"); return (*jack_set_client_registration_callback_fun)(ext_client, registration_callback, arg); } @@ -650,7 +650,7 @@ typedef int (*jack_set_port_registration_callback_fun_def)(jack_client_t* ext_cl static jack_set_port_registration_callback_fun_def jack_set_port_registration_callback_fun = 0; EXPORT int jack_set_port_registration_callback(jack_client_t* ext_client, JackPortRegistrationCallback registration_callback, void* arg) { - jack_log("jack_set_port_registration_callback"); + jack_log("jack_set_port_registration_callback"); return (*jack_set_port_registration_callback_fun)(ext_client, registration_callback, arg); } @@ -658,7 +658,7 @@ typedef int (*jack_set_port_connect_callback_fun_def)(jack_client_t* ext_client, static jack_set_port_connect_callback_fun_def jack_set_port_connect_callback_fun = 0; EXPORT int jack_set_port_connect_callback(jack_client_t* ext_client, JackPortConnectCallback connect_callback, void* arg) { - jack_log("jack_set_port_connect_callback"); + jack_log("jack_set_port_connect_callback"); return (*jack_set_port_connect_callback_fun)(ext_client, connect_callback, arg); } @@ -666,7 +666,7 @@ typedef int (*jack_set_graph_order_callback_fun_def)(jack_client_t* ext_client, static jack_set_graph_order_callback_fun_def jack_set_graph_order_callback_fun = 0; EXPORT int jack_set_graph_order_callback(jack_client_t* ext_client, JackGraphOrderCallback graph_callback, void* arg) { - jack_log("jack_set_graph_order_callback"); + jack_log("jack_set_graph_order_callback"); return (*jack_set_graph_order_callback_fun)(ext_client, graph_callback, arg); } @@ -674,7 +674,7 @@ typedef int (*jack_set_xrun_callback_fun_def)(jack_client_t* ext_client, JackXRu static jack_set_xrun_callback_fun_def jack_set_xrun_callback_fun = 0; EXPORT int jack_set_xrun_callback(jack_client_t* ext_client, JackXRunCallback xrun_callback, void* arg) { - jack_log("jack_set_xrun_callback"); + jack_log("jack_set_xrun_callback"); return (*jack_set_xrun_callback_fun)(ext_client, xrun_callback, arg); } @@ -682,7 +682,7 @@ typedef int (*jack_set_thread_init_callback_fun_def)(jack_client_t* ext_client, static jack_set_thread_init_callback_fun_def jack_set_thread_init_callback_fun = 0; EXPORT int jack_set_thread_init_callback(jack_client_t* ext_client, JackThreadInitCallback init_callback, void *arg) { - jack_log("jack_set_thread_init_callback"); + jack_log("jack_set_thread_init_callback"); return (*jack_set_thread_init_callback_fun)(ext_client, init_callback, arg); } @@ -690,7 +690,7 @@ typedef int (*jack_activate_fun_def)(jack_client_t* ext_client); static jack_activate_fun_def jack_activate_fun = 0; EXPORT int jack_activate(jack_client_t* ext_client) { - jack_log("jack_activate"); + jack_log("jack_activate"); return (*jack_activate_fun)(ext_client); } @@ -698,7 +698,7 @@ typedef int (*jack_deactivate_fun_def)(jack_client_t* ext_client); static jack_deactivate_fun_def jack_deactivate_fun = 0; EXPORT int jack_deactivate(jack_client_t* ext_client) { - jack_log("jack_deactivate"); + jack_log("jack_deactivate"); return (*jack_deactivate_fun)(ext_client); } @@ -706,7 +706,7 @@ typedef jack_port_t* (*jack_port_register_fun_def)(jack_client_t* ext_client, co static jack_port_register_fun_def jack_port_register_fun = 0; 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) { - jack_log("jack_port_register"); + jack_log("jack_port_register"); return (*jack_port_register_fun)(ext_client, port_name, port_type, flags, buffer_size); } @@ -714,7 +714,7 @@ typedef int (*jack_port_unregister_fun_def)(jack_client_t* ext_client, jack_port static jack_port_unregister_fun_def jack_port_unregister_fun = 0; EXPORT int jack_port_unregister(jack_client_t* ext_client, jack_port_t* port) { - jack_log("jack_port_unregister"); + jack_log("jack_port_unregister"); return (*jack_port_unregister_fun)(ext_client, port); } @@ -722,7 +722,7 @@ typedef int (*jack_port_is_mine_fun_def)(const jack_client_t* ext_client, const static jack_port_is_mine_fun_def jack_port_is_mine_fun = 0; EXPORT int jack_port_is_mine(const jack_client_t* ext_client, const jack_port_t* port) { - jack_log("jack_port_is_mine"); + jack_log("jack_port_is_mine"); return (*jack_port_is_mine_fun)(ext_client, port); } @@ -730,7 +730,7 @@ typedef const char** (*jack_port_get_connections_fun_def)(const jack_port_t* por static jack_port_get_connections_fun_def jack_port_get_connections_fun = 0; EXPORT const char** jack_port_get_connections(const jack_port_t* port) { - jack_log("jack_port_get_connections"); + jack_log("jack_port_get_connections"); return (*jack_port_get_connections_fun)(port); } @@ -739,7 +739,7 @@ typedef const char** (*jack_port_get_all_connections_fun_def)(const jack_client_ static jack_port_get_all_connections_fun_def jack_port_get_all_connections_fun = 0; EXPORT const char** jack_port_get_all_connections(const jack_client_t* ext_client, const jack_port_t* port) { - jack_log("jack_port_get_all_connections"); + jack_log("jack_port_get_all_connections"); return (*jack_port_get_all_connections_fun)(ext_client, port); } @@ -747,7 +747,7 @@ typedef jack_nframes_t (*jack_port_get_total_latency_fun_def)(jack_client_t* ext static jack_port_get_total_latency_fun_def jack_port_get_total_latency_fun = 0; EXPORT jack_nframes_t jack_port_get_total_latency(jack_client_t* ext_client, jack_port_t* port) { - jack_log("jack_port_get_total_latency"); + jack_log("jack_port_get_total_latency"); return (*jack_port_get_total_latency_fun)(ext_client, port); } @@ -755,7 +755,7 @@ typedef int (*jack_connect_fun_def)(jack_client_t* ext_client, const char* src, static jack_connect_fun_def jack_connect_fun = 0; EXPORT int jack_connect(jack_client_t* ext_client, const char* src, const char* dst) { - jack_log("jack_connect"); + jack_log("jack_connect"); return (*jack_connect_fun)(ext_client, src, dst); } @@ -763,7 +763,7 @@ typedef int (*jack_disconnect_fun_def)(jack_client_t* ext_client, const char* sr static jack_disconnect_fun_def jack_disconnect_fun = 0; EXPORT int jack_disconnect(jack_client_t* ext_client, const char* src, const char* dst) { - jack_log("jack_disconnect"); + jack_log("jack_disconnect"); return (*jack_disconnect_fun)(ext_client, src, dst); } @@ -771,7 +771,7 @@ typedef int (*jack_port_disconnect_fun_def)(jack_client_t* ext_client, jack_port static jack_port_disconnect_fun_def jack_port_disconnect_fun = 0; EXPORT int jack_port_disconnect(jack_client_t* ext_client, jack_port_t* src) { - jack_log("jack_port_disconnect"); + jack_log("jack_port_disconnect"); return (*jack_port_disconnect_fun)(ext_client, src); } @@ -779,7 +779,7 @@ typedef jack_nframes_t (*jack_get_sample_rate_fun_def)(jack_client_t* ext_client static jack_get_sample_rate_fun_def jack_get_sample_rate_fun = 0; EXPORT jack_nframes_t jack_get_sample_rate(jack_client_t* ext_client) { - jack_log("jack_get_sample_rate"); + jack_log("jack_get_sample_rate"); return (*jack_get_sample_rate_fun)(ext_client); } @@ -787,7 +787,7 @@ typedef jack_nframes_t (*jack_get_buffer_size_fun_def)(jack_client_t* ext_client static jack_get_buffer_size_fun_def jack_get_buffer_size_fun = 0; EXPORT jack_nframes_t jack_get_buffer_size(jack_client_t* ext_client) { - jack_log("jack_get_buffer_size"); + jack_log("jack_get_buffer_size"); return (*jack_get_buffer_size_fun)(ext_client); } @@ -795,7 +795,7 @@ typedef const char** (*jack_get_ports_fun_def)(jack_client_t* ext_client, const static jack_get_ports_fun_def jack_get_ports_fun = 0; EXPORT const char** jack_get_ports(jack_client_t* ext_client, const char* port_name_pattern, const char* type_name_pattern, unsigned long flags) { - jack_log("jack_get_ports"); + jack_log("jack_get_ports"); return (*jack_get_ports_fun)(ext_client, port_name_pattern, type_name_pattern, flags); } @@ -803,7 +803,7 @@ typedef jack_port_t* (*jack_port_by_name_fun_def)(jack_client_t* ext_client, con static jack_port_by_name_fun_def jack_port_by_name_fun = 0; EXPORT jack_port_t* jack_port_by_name(jack_client_t* ext_client, const char* portname) { - jack_log("jack_port_by_name"); + jack_log("jack_port_by_name"); return (*jack_port_by_name_fun)(ext_client, portname); } @@ -811,7 +811,7 @@ typedef jack_port_t* (*jack_port_by_id_fun_def)(const jack_client_t* ext_client, static jack_port_by_id_fun_def jack_port_by_id_fun = 0; EXPORT jack_port_t* jack_port_by_id(const jack_client_t* ext_client, jack_port_id_t id) { - jack_log("jack_port_by_id"); + jack_log("jack_port_by_id"); return (*jack_port_by_id_fun)(ext_client, id); } @@ -819,7 +819,7 @@ typedef int (*jack_engine_takeover_timebase_fun_def)(jack_client_t* ext_client); static jack_engine_takeover_timebase_fun_def jack_engine_takeover_timebase_fun = 0; EXPORT int jack_engine_takeover_timebase(jack_client_t* ext_client) { - jack_log("jack_engine_takeover_timebase"); + jack_log("jack_engine_takeover_timebase"); return (*jack_engine_takeover_timebase_fun)(ext_client); } @@ -827,7 +827,7 @@ typedef jack_nframes_t (*jack_frames_since_cycle_start_fun_def)(const jack_clien static jack_frames_since_cycle_start_fun_def jack_frames_since_cycle_start_fun = 0; EXPORT jack_nframes_t jack_frames_since_cycle_start(const jack_client_t* ext_client) { - jack_log("jack_frames_since_cycle_start"); + jack_log("jack_frames_since_cycle_start"); return (*jack_frames_since_cycle_start_fun)(ext_client); } @@ -835,7 +835,7 @@ typedef jack_time_t (*jack_get_time_fun_def)(); static jack_get_time_fun_def jack_get_time_fun = 0; EXPORT jack_time_t jack_get_time() { - jack_log("jack_get_time"); + jack_log("jack_get_time"); return (*jack_get_time_fun)(); } @@ -843,7 +843,7 @@ typedef jack_nframes_t (*jack_time_to_frames_fun_def)(const jack_client_t* ext_c static jack_time_to_frames_fun_def jack_time_to_frames_fun = 0; EXPORT jack_nframes_t jack_time_to_frames(const jack_client_t* ext_client, jack_time_t time) { - jack_log("jack_time_to_frames"); + jack_log("jack_time_to_frames"); return (*jack_time_to_frames_fun)(ext_client, time); } @@ -851,7 +851,7 @@ typedef jack_time_t (*jack_frames_to_time_fun_def)(const jack_client_t* ext_clie static jack_frames_to_time_fun_def jack_frames_to_time_fun = 0; EXPORT jack_time_t jack_frames_to_time(const jack_client_t* ext_client, jack_nframes_t frames) { - jack_log("jack_frames_to_time"); + jack_log("jack_frames_to_time"); return (*jack_frames_to_time_fun)(ext_client, frames); } @@ -859,7 +859,7 @@ typedef jack_nframes_t (*jack_frame_time_fun_def)(const jack_client_t* ext_clien static jack_frame_time_fun_def jack_frame_time_fun = 0; EXPORT jack_nframes_t jack_frame_time(const jack_client_t* ext_client) { - jack_log("jack_frame_time"); + jack_log("jack_frame_time"); return (*jack_frame_time_fun)(ext_client); } @@ -867,7 +867,7 @@ typedef jack_nframes_t (*jack_last_frame_time_fun_def)(const jack_client_t* ext_ static jack_last_frame_time_fun_def jack_last_frame_time_fun = 0; EXPORT jack_nframes_t jack_last_frame_time(const jack_client_t* ext_client) { - jack_log("jack_last_frame_time"); + jack_log("jack_last_frame_time"); return (*jack_last_frame_time_fun)(ext_client); } @@ -875,7 +875,7 @@ typedef float (*jack_cpu_load_fun_def)(jack_client_t* ext_client); static jack_cpu_load_fun_def jack_cpu_load_fun = 0; EXPORT float jack_cpu_load(jack_client_t* ext_client) { - jack_log("jack_cpu_load"); + jack_log("jack_cpu_load"); return (*jack_cpu_load_fun)(ext_client); } @@ -883,7 +883,7 @@ typedef pthread_t (*jack_client_thread_id_fun_def)(jack_client_t* ext_client); static jack_client_thread_id_fun_def jack_client_thread_id_fun = 0; EXPORT pthread_t jack_client_thread_id(jack_client_t* ext_client) { - jack_log("jack_client_thread_id"); + jack_log("jack_client_thread_id"); return (*jack_client_thread_id_fun)(ext_client); } @@ -891,43 +891,43 @@ typedef void (*jack_set_error_function_fun_def)(void (*func)(const char *)); static jack_set_error_function_fun_def jack_set_error_function_fun = 0; EXPORT void jack_set_error_function(void (*func)(const char *)) { - jack_log("jack_set_error_function"); - if (gLibrary) { - (*jack_set_error_function_fun)(func); - } else { - error_fun = func; // Keep the function - } + jack_log("jack_set_error_function"); + if (gLibrary) { + (*jack_set_error_function_fun)(func); + } else { + error_fun = func; // Keep the function + } } typedef void (*jack_set_info_function_fun_def)(void (*func)(const char *)); static jack_set_info_function_fun_def jack_set_info_function_fun = 0; EXPORT void jack_set_info_function(void (*func)(const char *)) { - jack_log("jack_set_info_function"); - if (gLibrary) { - (*jack_set_error_function_fun)(func); - } else { - info_fun = func; // Keep the function - } + jack_log("jack_set_info_function"); + if (gLibrary) { + (*jack_set_error_function_fun)(func); + } else { + info_fun = func; // Keep the function + } } typedef char* (*jack_get_client_name_fun_def)(jack_client_t* ext_client); static jack_get_client_name_fun_def jack_get_client_name_fun = 0; EXPORT char* jack_get_client_name (jack_client_t* ext_client) { - jack_log("jack_get_client_name"); + jack_log("jack_get_client_name"); return (*jack_get_client_name_fun)(ext_client); } typedef int (*jack_internal_client_new_fun_def)(const char *client_name, - const char *load_name, - const char *load_init); + const char *load_name, + const char *load_init); static jack_internal_client_new_fun_def jack_internal_client_new_fun = 0; EXPORT int jack_internal_client_new (const char *client_name, - const char *load_name, - const char *load_init) + const char *load_name, + const char *load_init) { - jack_log("jack_internal_client_new"); + jack_log("jack_internal_client_new"); return (*jack_internal_client_new_fun)(client_name, load_name, load_init); } @@ -935,15 +935,15 @@ typedef void (*jack_internal_client_close_fun_def)(const char *client_name); static jack_internal_client_close_fun_def jack_internal_client_close_fun = 0; EXPORT void jack_internal_client_close (const char *client_name) { - jack_log("jack_internal_client_close"); - (*jack_internal_client_close_fun)(client_name); + jack_log("jack_internal_client_close"); + (*jack_internal_client_close_fun)(client_name); } typedef int (*jack_client_name_size_fun_def)(void); static jack_client_name_size_fun_def jack_client_name_size_fun = 0; EXPORT int jack_client_name_size(void) { - jack_log("jack_client_name_size"); + jack_log("jack_client_name_size"); return (*jack_client_name_size_fun)(); } @@ -951,7 +951,7 @@ typedef int (*jack_port_name_size_fun_def)(void); static jack_port_name_size_fun_def jack_port_name_size_fun = 0; EXPORT int jack_port_name_size(void) { - jack_log("jack_port_name_size"); + jack_log("jack_port_name_size"); return (*jack_port_name_size_fun)(); } @@ -959,7 +959,7 @@ typedef int (*jack_port_type_size_fun_def)(void); static jack_port_type_size_fun_def jack_port_type_size_fun = 0; EXPORT int jack_port_type_size(void) { - jack_log("jack_port_type_size"); + jack_log("jack_port_type_size"); return (*jack_port_type_size_fun)(); } @@ -969,7 +969,7 @@ typedef int (*jack_release_timebase_fun_def)(jack_client_t* ext_client); static jack_release_timebase_fun_def jack_release_timebase_fun = 0; EXPORT int jack_release_timebase(jack_client_t* ext_client) { - jack_log("jack_release_timebase"); + jack_log("jack_release_timebase"); return (*jack_release_timebase_fun)(ext_client); } @@ -977,7 +977,7 @@ typedef int (*jack_set_sync_callback_fun_def)(jack_client_t* ext_client, JackSyn static jack_set_sync_callback_fun_def jack_set_sync_callback_fun = 0; EXPORT int jack_set_sync_callback(jack_client_t* ext_client, JackSyncCallback sync_callback, void *arg) { - jack_log("jack_set_sync_callback"); + jack_log("jack_set_sync_callback"); return (*jack_set_sync_callback_fun)(ext_client, sync_callback, arg); } @@ -985,7 +985,7 @@ typedef int (*jack_set_sync_timeout_fun_def)(jack_client_t* ext_client, jack_tim static jack_set_sync_timeout_fun_def jack_set_sync_timeout_fun = 0; EXPORT int jack_set_sync_timeout(jack_client_t* ext_client, jack_time_t timeout) { - jack_log("jack_set_sync_timeout"); + jack_log("jack_set_sync_timeout"); return (*jack_set_sync_timeout_fun)(ext_client, timeout); } @@ -993,7 +993,7 @@ typedef int (*jack_set_timebase_callback_fun_def)(jack_client_t* ext_client, int static jack_set_timebase_callback_fun_def jack_set_timebase_callback_fun = 0; EXPORT int jack_set_timebase_callback(jack_client_t* ext_client, int conditional, JackTimebaseCallback timebase_callback, void* arg) { - jack_log("jack_set_timebase_callback"); + jack_log("jack_set_timebase_callback"); return (*jack_set_timebase_callback_fun)(ext_client, conditional, timebase_callback, arg); } @@ -1001,7 +1001,7 @@ typedef int (*jack_transport_locate_fun_def)(jack_client_t* ext_client, jack_nfr static jack_transport_locate_fun_def jack_transport_locate_fun = 0; EXPORT int jack_transport_locate(jack_client_t* ext_client, jack_nframes_t frame) { - jack_log("jack_transport_locate"); + jack_log("jack_transport_locate"); return (*jack_transport_locate_fun)(ext_client, frame); } @@ -1009,7 +1009,7 @@ typedef jack_transport_state_t (*jack_transport_query_fun_def)(const jack_client static jack_transport_query_fun_def jack_transport_query_fun = 0; EXPORT jack_transport_state_t jack_transport_query(const jack_client_t* ext_client, jack_position_t* pos) { - jack_log("jack_transport_query"); + jack_log("jack_transport_query"); return (*jack_transport_query_fun)(ext_client, pos); } @@ -1017,7 +1017,7 @@ typedef jack_nframes_t (*jack_get_current_transport_frame_fun_def)(const jack_cl static jack_get_current_transport_frame_fun_def jack_get_current_transport_frame_fun = 0; EXPORT jack_nframes_t jack_get_current_transport_frame(const jack_client_t* ext_client) { - jack_log("jack_get_current_transport_frame"); + jack_log("jack_get_current_transport_frame"); return (*jack_get_current_transport_frame_fun)(ext_client); } @@ -1025,7 +1025,7 @@ typedef int (*jack_transport_reposition_fun_def)(jack_client_t* ext_client, jack static jack_transport_reposition_fun_def jack_transport_reposition_fun = 0; EXPORT int jack_transport_reposition(jack_client_t* ext_client, jack_position_t* pos) { - jack_log("jack_transport_reposition"); + jack_log("jack_transport_reposition"); return (*jack_transport_reposition_fun)(ext_client, pos); } @@ -1033,16 +1033,16 @@ typedef void (*jack_transport_start_fun_def)(jack_client_t* ext_client); static jack_transport_start_fun_def jack_transport_start_fun = 0; EXPORT void jack_transport_start(jack_client_t* ext_client) { - jack_log("jack_transport_start"); - (*jack_transport_start_fun)(ext_client); + jack_log("jack_transport_start"); + (*jack_transport_start_fun)(ext_client); } typedef void (*jack_transport_stop_fun_def)(jack_client_t* ext_client); static jack_transport_stop_fun_def jack_transport_stop_fun = 0; EXPORT void jack_transport_stop(jack_client_t* ext_client) { - jack_log("jack_transport_stop"); - (*jack_transport_stop_fun)(ext_client); + jack_log("jack_transport_stop"); + (*jack_transport_stop_fun)(ext_client); } // deprecated @@ -1051,7 +1051,7 @@ typedef void (*jack_get_transport_info_fun_def)(jack_client_t* ext_client, jack_ static jack_get_transport_info_fun_def jack_get_transport_info_fun = 0; EXPORT void jack_get_transport_info(jack_client_t* ext_client, jack_transport_info_t* tinfo) { - jack_log("jack_get_transport_info"); + jack_log("jack_get_transport_info"); (*jack_get_transport_info_fun)(ext_client, tinfo); } @@ -1059,7 +1059,7 @@ typedef void (*jack_set_transport_info_fun_def)(jack_client_t* ext_client, jack_ static jack_set_transport_info_fun_def jack_set_transport_info_fun = 0; EXPORT void jack_set_transport_info(jack_client_t* ext_client, jack_transport_info_t* tinfo) { - jack_log("jack_set_transport_info"); + jack_log("jack_set_transport_info"); (*jack_set_transport_info_fun)(ext_client, tinfo); } @@ -1069,7 +1069,7 @@ typedef float (*jack_get_max_delayed_usecs_fun_def)(jack_client_t* ext_client); static jack_get_max_delayed_usecs_fun_def jack_get_max_delayed_usecs_fun = 0; EXPORT float jack_get_max_delayed_usecs(jack_client_t* ext_client) { - jack_log("jack_get_max_delayed_usecs"); + jack_log("jack_get_max_delayed_usecs"); return (*jack_get_max_delayed_usecs_fun)(ext_client); } @@ -1077,7 +1077,7 @@ typedef float (*jack_get_xrun_delayed_usecs_fun_def)(jack_client_t* ext_client); static jack_get_xrun_delayed_usecs_fun_def jack_get_xrun_delayed_usecs_fun = 0; EXPORT float jack_get_xrun_delayed_usecs(jack_client_t* ext_client) { - jack_log("jack_get_xrun_delayed_usecs"); + jack_log("jack_get_xrun_delayed_usecs"); return (*jack_get_xrun_delayed_usecs_fun)(ext_client); } @@ -1085,7 +1085,7 @@ typedef void (*jack_reset_max_delayed_usecs_fun_def)(jack_client_t* ext_client); static jack_reset_max_delayed_usecs_fun_def jack_reset_max_delayed_usecs_fun = 0; EXPORT void jack_reset_max_delayed_usecs(jack_client_t* ext_client) { - jack_log("jack_reset_max_delayed_usecs"); + jack_log("jack_reset_max_delayed_usecs"); (*jack_reset_max_delayed_usecs_fun)(ext_client); } @@ -1095,7 +1095,7 @@ typedef int (*jack_acquire_real_time_scheduling_fun_def)(pthread_t thread, int p static jack_acquire_real_time_scheduling_fun_def jack_acquire_real_time_scheduling_fun = 0; EXPORT int jack_acquire_real_time_scheduling(pthread_t thread, int priority) { - jack_log("jack_acquire_real_time_scheduling"); + jack_log("jack_acquire_real_time_scheduling"); return (*jack_acquire_real_time_scheduling_fun)(thread, priority); } @@ -1114,7 +1114,7 @@ EXPORT int jack_client_create_thread(jack_client_t* client, start_routine callback, void *arg) { - jack_log("jack_client_create_thread"); + jack_log("jack_client_create_thread"); return (*jack_client_create_thread_fun)(client, thread, priority, realtime, callback, arg); } @@ -1122,7 +1122,7 @@ typedef int (*jack_drop_real_time_scheduling_fun_def)(pthread_t thread); static jack_drop_real_time_scheduling_fun_def jack_drop_real_time_scheduling_fun = 0; EXPORT int jack_drop_real_time_scheduling(pthread_t thread) { - jack_log("jack_client_create_thread"); + jack_log("jack_client_create_thread"); return (*jack_drop_real_time_scheduling_fun)(thread); } @@ -1132,7 +1132,7 @@ typedef char* (*jack_get_internal_client_name_fun_def)(jack_client_t* ext_client static jack_get_internal_client_name_fun_def jack_get_internal_client_name_fun = 0; EXPORT char* jack_get_internal_client_name(jack_client_t* ext_client, jack_intclient_t intclient) { - jack_log("jack_get_internal_client_name"); + jack_log("jack_get_internal_client_name"); return (*jack_get_internal_client_name_fun)(ext_client, intclient); } @@ -1140,7 +1140,7 @@ typedef jack_intclient_t (*jack_internal_client_handle_fun_def)(jack_client_t* e static jack_internal_client_handle_fun_def jack_internal_client_handle_fun = 0; EXPORT jack_intclient_t jack_internal_client_handle(jack_client_t* ext_client, const char* client_name, jack_status_t* status) { - jack_log("jack_internal_client_handle"); + jack_log("jack_internal_client_handle"); return (*jack_internal_client_handle_fun)(ext_client, client_name, status); } @@ -1148,7 +1148,7 @@ typedef jack_intclient_t (*jack_internal_client_load_aux_fun_def)(jack_client_t* static jack_internal_client_load_aux_fun_def jack_internal_client_load_aux_fun = 0; EXPORT jack_intclient_t jack_internal_client_load(jack_client_t* ext_client, const char* client_name, jack_options_t options, jack_status_t* status, ...) { - jack_log("jack_internal_client_load"); + jack_log("jack_internal_client_load"); va_list ap; va_start(ap, status); jack_intclient_t res = (*jack_internal_client_load_aux_fun)(ext_client, client_name, options, status, ap); @@ -1160,7 +1160,7 @@ typedef jack_status_t (*jack_internal_client_unload_fun_def)(jack_client_t* ext_ static jack_internal_client_unload_fun_def jack_internal_client_unload_fun = 0; EXPORT jack_status_t jack_internal_client_unload(jack_client_t* ext_client, jack_intclient_t intclient) { - jack_log("jack_internal_client_unload"); + jack_log("jack_internal_client_unload"); return (*jack_internal_client_unload_fun)(ext_client, intclient); } @@ -1168,66 +1168,66 @@ typedef jack_client_t * (*jack_client_open_aux_fun_def)(const char *ext_client_n static jack_client_open_aux_fun_def jack_client_open_aux_fun = 0; EXPORT jack_client_t * jack_client_open(const char *ext_client_name, jack_options_t options, jack_status_t *status, ...) { - jack_log("jack_client_open"); - - // Library check... + jack_log("jack_client_open"); + + // Library check... if (open_library()) { va_list ap; - va_start(ap, status); - jack_client_t* res = (*jack_client_open_aux_fun)(ext_client_name, options, status, ap); - va_end(ap); - return res; - } else { - - jack_varargs_t va; // variable arguments - jack_status_t my_status; - char client_name[JACK_CLIENT_NAME_SIZE]; - - if (ext_client_name == NULL) { - jack_log("jack_client_open called with a NULL client_name"); - return NULL; - } - - RewriteName(ext_client_name, client_name); - - if (status == NULL) // no status from caller? - status = &my_status; // use local status word - *status = (jack_status_t)0; - - // validate parameters - if ((options & ~JackOpenOptions)) { - int my_status1 = *status | (JackFailure | JackInvalidOption); - *status = (jack_status_t)my_status1; - return NULL; - } - - // parse variable arguments - va_list ap; - va_start(ap, status); - jack_varargs_parse(options, ap, &va); - va_end(ap); - - if (start_server(va.server_name, options)) { - int my_status1 = *status | JackFailure | JackServerFailed; + va_start(ap, status); + jack_client_t* res = (*jack_client_open_aux_fun)(ext_client_name, options, status, ap); + va_end(ap); + return res; + } else { + + jack_varargs_t va; // variable arguments + jack_status_t my_status; + char client_name[JACK_CLIENT_NAME_SIZE]; + + if (ext_client_name == NULL) { + jack_log("jack_client_open called with a NULL client_name"); + return NULL; + } + + RewriteName(ext_client_name, client_name); + + if (status == NULL) // no status from caller? + status = &my_status; // use local status word + *status = (jack_status_t)0; + + // validate parameters + if ((options & ~JackOpenOptions)) { + int my_status1 = *status | (JackFailure | JackInvalidOption); *status = (jack_status_t)my_status1; - return NULL; - } else if (open_library()) { - va_list ap; - va_start(ap, status); - jack_client_t* res = (*jack_client_open_aux_fun)(ext_client_name, options, status, ap); - va_end(ap); - return res; - } else { - return NULL; - } - } + return NULL; + } + + // parse variable arguments + va_list ap; + va_start(ap, status); + jack_varargs_parse(options, ap, &va); + va_end(ap); + + if (start_server(va.server_name, options)) { + int my_status1 = *status | JackFailure | JackServerFailed; + *status = (jack_status_t)my_status1; + return NULL; + } else if (open_library()) { + va_list ap; + va_start(ap, status); + jack_client_t* res = (*jack_client_open_aux_fun)(ext_client_name, options, status, ap); + va_end(ap); + return res; + } else { + return NULL; + } + } } typedef jack_client_t * (*jack_client_new_fun_def)(const char *client_name); static jack_client_new_fun_def jack_client_new_fun = 0; EXPORT jack_client_t * jack_client_new(const char *client_name) { - jack_log("jack_client_new"); + jack_log("jack_client_new"); // Library check... if (!open_library()) return 0; @@ -1239,20 +1239,20 @@ typedef int (*jack_client_close_fun_def)(jack_client_t *client); static jack_client_close_fun_def jack_client_close_fun = 0; EXPORT int jack_client_close(jack_client_t *client) { - jack_log("jack_client_close"); - if (client) { - int res = (*jack_client_close_fun)(client); - close_library(); - return res; - } else { - return -1; - } + jack_log("jack_client_close"); + if (client) { + int res = (*jack_client_close_fun)(client); + close_library(); + return res; + } else { + return -1; + } } // Library loader static bool get_jack_library_in_directory(const char* dir_name, const char* library_name, char* library_res_name) { - jack_log("get_jack_library_in_directory"); + jack_log("get_jack_library_in_directory"); struct dirent * dir_entry; DIR * dir_stream = opendir(dir_name); @@ -1261,8 +1261,8 @@ static bool get_jack_library_in_directory(const char* dir_name, const char* libr while ((dir_entry = readdir(dir_stream))) { if (strncmp(library_name, dir_entry->d_name, strlen(library_name)) == 0) { - jack_log("found"); - sprintf(library_res_name, "%s/%s", dir_name, dir_entry->d_name); + jack_log("found"); + sprintf(library_res_name, "%s/%s", dir_name, dir_entry->d_name); closedir(dir_stream); return true; } @@ -1282,30 +1282,30 @@ static bool get_jack_library(const char* library_name, char* library_res_name) static void close_library() { - jack_log("close_library"); + jack_log("close_library"); if (gLibrary) { dlclose(gLibrary); - gLibrary = 0; - } + gLibrary = 0; + } } static bool check_client(void* library) { jack_client_t* client = 0; - jack_log("check_client"); + jack_log("check_client"); // Get "new" and "close" entry points... jack_client_new_fun = (jack_client_new_fun_def)dlsym(library, "jack_client_new"); jack_client_close_fun = (jack_client_close_fun_def)dlsym(library, "jack_client_close"); - + // Try opening a client... if ((client = (*jack_client_new_fun)("dummy"))) { // server is running.... - jack_log("check_client 1 %x", jack_client_close_fun); + jack_log("check_client 1 %x", jack_client_close_fun); (*jack_client_close_fun)(client); - jack_log("check_client 2"); + jack_log("check_client 2"); return true; } else { - jack_log("check_client NO"); + jack_log("check_client NO"); return false; } } @@ -1318,25 +1318,25 @@ static bool open_library() if (jackLibrary) { - jack_log("jackLibrary"); + jack_log("jackLibrary"); if (check_client(jackLibrary)) { // jackd is running... - jack_log("jackd is running"); + jack_log("jackd is running"); gLibrary = jackLibrary; - if (jackmpLibrary) - dlclose(jackmpLibrary); - jack_log("jackd is running OK"); + if (jackmpLibrary) + dlclose(jackmpLibrary); + jack_log("jackd is running OK"); } else if (check_client(jackmpLibrary)) { // jackdmp is running... gLibrary = jackmpLibrary; - if (jackLibrary) - dlclose(jackLibrary); + if (jackLibrary) + dlclose(jackLibrary); } else { goto error; } } else if (jackmpLibrary) { - jack_log("jackmpLibrary"); + jack_log("jackmpLibrary"); if (check_client(jackmpLibrary)) { // jackd is running... gLibrary = jackmpLibrary; @@ -1349,22 +1349,22 @@ static bool open_library() goto error; } - // Load entry points... - jack_client_open_aux_fun = (jack_client_open_aux_fun_def)dlsym(gLibrary, "jack_client_open_aux"); + // Load entry points... + jack_client_open_aux_fun = (jack_client_open_aux_fun_def)dlsym(gLibrary, "jack_client_open_aux"); jack_client_new_fun = (jack_client_new_fun_def)dlsym(gLibrary, "jack_client_new"); - jack_client_close_fun = (jack_client_close_fun_def)dlsym(gLibrary, "jack_client_close"); - jack_client_name_size_fun = (jack_client_name_size_fun_def)dlsym(gLibrary, "jack_client_name_size"); - jack_get_client_name_fun = (jack_get_client_name_fun_def)dlsym(gLibrary, "jack_get_client_name"); - jack_internal_client_new_fun = (jack_internal_client_new_fun_def)dlsym(gLibrary, "jack_internal_client_new"); - jack_internal_client_close_fun = (jack_internal_client_close_fun_def)dlsym(gLibrary, "jack_internal_client_close"); - jack_is_realtime_fun = (jack_is_realtime_fun_def)dlsym(gLibrary, "jack_is_realtime"); + jack_client_close_fun = (jack_client_close_fun_def)dlsym(gLibrary, "jack_client_close"); + jack_client_name_size_fun = (jack_client_name_size_fun_def)dlsym(gLibrary, "jack_client_name_size"); + jack_get_client_name_fun = (jack_get_client_name_fun_def)dlsym(gLibrary, "jack_get_client_name"); + jack_internal_client_new_fun = (jack_internal_client_new_fun_def)dlsym(gLibrary, "jack_internal_client_new"); + jack_internal_client_close_fun = (jack_internal_client_close_fun_def)dlsym(gLibrary, "jack_internal_client_close"); + jack_is_realtime_fun = (jack_is_realtime_fun_def)dlsym(gLibrary, "jack_is_realtime"); jack_on_shutdown_fun = (jack_on_shutdown_fun_def)dlsym(gLibrary, "jack_on_shutdown"); jack_set_process_callback_fun = (jack_set_process_callback_fun_def)dlsym(gLibrary, "jack_set_process_callback"); - jack_thread_wait_fun = (jack_thread_wait_fun_def)dlsym(gLibrary, "jack_thread_wait"); - jack_cycle_wait_fun = (jack_cycle_wait_fun_def)dlsym(gLibrary, "jack_cycle_wait"); - jack_cycle_signal_fun = (jack_cycle_signal_fun_def)dlsym(gLibrary, "jack_cycle_signal"); - jack_set_process_thread_fun = (jack_set_process_thread_fun_def)dlsym(gLibrary, "jack_set_process_thread"); - jack_set_thread_init_callback_fun = (jack_set_thread_init_callback_fun_def)dlsym(gLibrary, "jack_set_thread_init_callback"); + jack_thread_wait_fun = (jack_thread_wait_fun_def)dlsym(gLibrary, "jack_thread_wait"); + jack_cycle_wait_fun = (jack_cycle_wait_fun_def)dlsym(gLibrary, "jack_cycle_wait"); + jack_cycle_signal_fun = (jack_cycle_signal_fun_def)dlsym(gLibrary, "jack_cycle_signal"); + jack_set_process_thread_fun = (jack_set_process_thread_fun_def)dlsym(gLibrary, "jack_set_process_thread"); + jack_set_thread_init_callback_fun = (jack_set_thread_init_callback_fun_def)dlsym(gLibrary, "jack_set_thread_init_callback"); jack_set_freewheel_callback_fun = (jack_set_freewheel_callback_fun_def)dlsym(gLibrary, "jack_set_freewheel_callback"); jack_set_freewheel_fun = (jack_set_freewheel_fun_def)dlsym(gLibrary, "jack_set_freewheel"); jack_set_buffer_size_fun = (jack_set_buffer_size_fun_def)dlsym(gLibrary, "jack_set_buffer_size"); @@ -1379,36 +1379,36 @@ static bool open_library() jack_deactivate_fun = (jack_deactivate_fun_def)dlsym(gLibrary, "jack_deactivate"); jack_port_register_fun = (jack_port_register_fun_def)dlsym(gLibrary, "jack_port_register"); jack_port_unregister_fun = (jack_port_unregister_fun_def)dlsym(gLibrary, "jack_port_unregister"); - jack_port_get_buffer_fun = (jack_port_get_buffer_fun_def)dlsym(gLibrary, "jack_port_get_buffer"); - jack_port_name_fun = (jack_port_name_fun_def)dlsym(gLibrary, "jack_port_name"); + jack_port_get_buffer_fun = (jack_port_get_buffer_fun_def)dlsym(gLibrary, "jack_port_get_buffer"); + jack_port_name_fun = (jack_port_name_fun_def)dlsym(gLibrary, "jack_port_name"); jack_port_short_name_fun = (jack_port_short_name_fun_def)dlsym(gLibrary, "jack_port_short_name"); jack_port_flags_fun = (jack_port_flags_fun_def)dlsym(gLibrary, "jack_port_flags"); jack_port_type_fun = (jack_port_type_fun_def)dlsym(gLibrary, "jack_port_type"); jack_port_is_mine_fun = (jack_port_is_mine_fun_def)dlsym(gLibrary, "jack_port_is_mine"); - jack_port_connected_fun = (jack_port_connected_fun_def)dlsym(gLibrary, "jack_port_connected"); + jack_port_connected_fun = (jack_port_connected_fun_def)dlsym(gLibrary, "jack_port_connected"); jack_port_connected_to_fun = (jack_port_connected_to_fun_def)dlsym(gLibrary, "jack_port_connected_to"); jack_port_get_connections_fun = (jack_port_get_connections_fun_def)dlsym(gLibrary, "jack_port_get_connections"); jack_port_get_all_connections_fun = (jack_port_get_all_connections_fun_def)dlsym(gLibrary, "jack_port_get_all_connections"); - jack_port_tie_fun = (jack_port_tie_fun_def)dlsym(gLibrary, "jack_port_tie"); + jack_port_tie_fun = (jack_port_tie_fun_def)dlsym(gLibrary, "jack_port_tie"); jack_port_untie_fun = (jack_port_untie_fun_def)dlsym(gLibrary, "jack_port_untie"); - jack_port_get_latency_fun = (jack_port_get_latency_fun_def)dlsym(gLibrary, "jack_port_get_latency"); + jack_port_get_latency_fun = (jack_port_get_latency_fun_def)dlsym(gLibrary, "jack_port_get_latency"); jack_port_get_total_latency_fun = (jack_port_get_total_latency_fun_def)dlsym(gLibrary, "jack_port_get_total_latency"); - jack_port_set_latency_fun = (jack_port_set_latency_fun_def)dlsym(gLibrary, "jack_port_set_latency"); - jack_recompute_total_latency_fun = (jack_recompute_total_latency_fun_def)dlsym(gLibrary, "jack_recompute_total_latency"); + jack_port_set_latency_fun = (jack_port_set_latency_fun_def)dlsym(gLibrary, "jack_port_set_latency"); + jack_recompute_total_latency_fun = (jack_recompute_total_latency_fun_def)dlsym(gLibrary, "jack_recompute_total_latency"); jack_recompute_total_latencies_fun = (jack_recompute_total_latencies_fun_def)dlsym(gLibrary, "jack_recompute_total_latencies"); - jack_port_set_name_fun = (jack_port_set_name_fun_def)dlsym(gLibrary, "jack_port_set_name"); - jack_port_set_alias_fun = (jack_port_set_alias_fun_def)dlsym(gLibrary, "jack_port_set_alias"); - jack_port_unset_alias_fun = (jack_port_unset_alias_fun_def)dlsym(gLibrary, "jack_port_unset_alias"); - jack_port_get_aliases_fun = (jack_port_get_aliases_fun_def)dlsym(gLibrary, "jack_port_get_aliases"); - jack_port_request_monitor_fun = (jack_port_request_monitor_fun_def)dlsym(gLibrary, "jack_port_request_monitor"); + jack_port_set_name_fun = (jack_port_set_name_fun_def)dlsym(gLibrary, "jack_port_set_name"); + jack_port_set_alias_fun = (jack_port_set_alias_fun_def)dlsym(gLibrary, "jack_port_set_alias"); + jack_port_unset_alias_fun = (jack_port_unset_alias_fun_def)dlsym(gLibrary, "jack_port_unset_alias"); + jack_port_get_aliases_fun = (jack_port_get_aliases_fun_def)dlsym(gLibrary, "jack_port_get_aliases"); + jack_port_request_monitor_fun = (jack_port_request_monitor_fun_def)dlsym(gLibrary, "jack_port_request_monitor"); jack_port_request_monitor_by_name_fun = (jack_port_request_monitor_by_name_fun_def)dlsym(gLibrary, "jack_port_request_monitor_by_name"); jack_port_ensure_monitor_fun = (jack_port_ensure_monitor_fun_def)dlsym(gLibrary, "jack_port_ensure_monitor"); jack_port_monitoring_input_fun = (jack_port_monitoring_input_fun_def)dlsym(gLibrary, "jack_port_monitoring_input"); jack_connect_fun = (jack_connect_fun_def)dlsym(gLibrary, "jack_connect"); jack_disconnect_fun = (jack_disconnect_fun_def)dlsym(gLibrary, "jack_disconnect"); - jack_port_disconnect_fun = (jack_port_disconnect_fun_def)dlsym(gLibrary, "jack_port_disconnect"); - jack_port_name_size_fun = (jack_port_name_size_fun_def)dlsym(gLibrary, "jack_port_name_size"); - jack_port_type_size_fun = (jack_port_type_size_fun_def)dlsym(gLibrary, "jack_port_type_size"); + jack_port_disconnect_fun = (jack_port_disconnect_fun_def)dlsym(gLibrary, "jack_port_disconnect"); + jack_port_name_size_fun = (jack_port_name_size_fun_def)dlsym(gLibrary, "jack_port_name_size"); + jack_port_type_size_fun = (jack_port_type_size_fun_def)dlsym(gLibrary, "jack_port_type_size"); jack_get_sample_rate_fun = (jack_get_sample_rate_fun_def)dlsym(gLibrary, "jack_get_sample_rate"); jack_get_buffer_size_fun = (jack_get_buffer_size_fun_def)dlsym(gLibrary, "jack_get_buffer_size"); jack_get_ports_fun = (jack_get_ports_fun_def)dlsym(gLibrary, "jack_get_ports"); @@ -1418,17 +1418,17 @@ static bool open_library() jack_frames_since_cycle_start_fun = (jack_frames_since_cycle_start_fun_def)dlsym(gLibrary, "jack_frames_since_cycle_start"); jack_get_time_fun = (jack_get_time_fun_def)dlsym(gLibrary, "jack_get_time"); jack_time_to_frames_fun = (jack_time_to_frames_fun_def)dlsym(gLibrary, "jack_time_to_frames"); - jack_frames_to_time_fun = (jack_frames_to_time_fun_def)dlsym(gLibrary, "jack_frames_to_time"); + jack_frames_to_time_fun = (jack_frames_to_time_fun_def)dlsym(gLibrary, "jack_frames_to_time"); jack_frame_time_fun = (jack_frame_time_fun_def)dlsym(gLibrary, "jack_frame_time"); jack_last_frame_time_fun = (jack_last_frame_time_fun_def)dlsym(gLibrary, "jack_last_frame_time"); jack_cpu_load_fun = (jack_cpu_load_fun_def)dlsym(gLibrary, "jack_cpu_load"); jack_client_thread_id_fun = (jack_client_thread_id_fun_def)dlsym(gLibrary, "jack_client_thread_id"); - jack_set_error_function_fun = (jack_set_error_function_fun_def)dlsym(gLibrary, "jack_set_error_function"); - jack_set_info_function_fun = (jack_set_info_function_fun_def)dlsym(gLibrary, "jack_set_info_function"); - jack_get_max_delayed_usecs_fun = (jack_get_max_delayed_usecs_fun_def)dlsym(gLibrary, "jack_get_max_delayed_usecs"); + jack_set_error_function_fun = (jack_set_error_function_fun_def)dlsym(gLibrary, "jack_set_error_function"); + jack_set_info_function_fun = (jack_set_info_function_fun_def)dlsym(gLibrary, "jack_set_info_function"); + jack_get_max_delayed_usecs_fun = (jack_get_max_delayed_usecs_fun_def)dlsym(gLibrary, "jack_get_max_delayed_usecs"); jack_get_xrun_delayed_usecs_fun = (jack_get_xrun_delayed_usecs_fun_def)dlsym(gLibrary, "jack_get_xrun_delayed_usecs"); jack_reset_max_delayed_usecs_fun = (jack_reset_max_delayed_usecs_fun_def)dlsym(gLibrary, "jack_reset_max_delayed_usecs"); - jack_release_timebase_fun = (jack_release_timebase_fun_def)dlsym(gLibrary, "jack_release_timebase"); + jack_release_timebase_fun = (jack_release_timebase_fun_def)dlsym(gLibrary, "jack_release_timebase"); jack_set_sync_callback_fun = (jack_set_sync_callback_fun_def)dlsym(gLibrary, "jack_set_sync_callback"); jack_set_sync_timeout_fun = (jack_set_sync_timeout_fun_def)dlsym(gLibrary, "jack_set_sync_timeout"); jack_set_timebase_callback_fun = (jack_set_timebase_callback_fun_def)dlsym(gLibrary, "jack_set_timebase_callback"); @@ -1447,14 +1447,14 @@ static bool open_library() jack_internal_client_handle_fun = (jack_internal_client_handle_fun_def)dlsym(gLibrary, "jack_internal_client_handle"); jack_internal_client_load_aux_fun = (jack_internal_client_load_aux_fun_def)dlsym(gLibrary, "jack_internal_client_load_aux"); jack_internal_client_unload_fun = (jack_internal_client_unload_fun_def)dlsym(gLibrary, "jack_internal_client_unload"); - - // Functions were kept... - if (error_fun) - jack_set_error_function_fun(error_fun); - if (info_fun) - jack_set_info_function_fun(info_fun); - - jack_log("init_library OK"); + + // Functions were kept... + if (error_fun) + jack_set_error_function_fun(error_fun); + if (info_fun) + jack_set_info_function_fun(info_fun); + + jack_log("init_library OK"); return true; error: @@ -1462,6 +1462,6 @@ error: dlclose(jackLibrary); if (jackmpLibrary) dlclose(jackmpLibrary); - gLibrary = 0; + gLibrary = 0; return false; } diff --git a/common/JackAudioDriver.cpp b/common/JackAudioDriver.cpp index a70fd93f..d0eceee4 100644 --- a/common/JackAudioDriver.cpp +++ b/common/JackAudioDriver.cpp @@ -118,7 +118,8 @@ int JackAudioDriver::Attach() } port = fGraphManager->GetPort(port_index); port->SetAlias(alias); - port->SetLatency(fEngineControl->fBufferSize + fPlaybackLatency); + // Add more latency if "async" mode is used... + port->SetLatency(fEngineControl->fBufferSize + ((fEngineControl->fSyncMode) ? 0 : fEngineControl->fBufferSize) + fPlaybackLatency); fPlaybackPortList[i] = port_index; jack_log("JackAudioDriver::Attach fPlaybackPortList[i] port_index = %ld", port_index); diff --git a/common/JackClient.cpp b/common/JackClient.cpp index ccbbb97d..85ae43c0 100644 --- a/common/JackClient.cpp +++ b/common/JackClient.cpp @@ -250,9 +250,9 @@ int JackClient::Activate() #endif */ - //if (fProcess || fThreadFun) - if (StartThread() < 0) - return -1; + //if (fProcess || fThreadFun) + if (StartThread() < 0) + return -1; int result = -1; fChannel->ClientActivate(GetClientControl()->fRefNum, &result); @@ -293,8 +293,8 @@ int JackClient::Deactivate() fThread->Kill(); #endif */ - //if (fProcess || fThreadFun) - fThread->Kill(); + //if (fProcess || fThreadFun) + fThread->Kill(); return result; } @@ -317,9 +317,9 @@ bool JackClient::Init() int JackClient::StartThread() { jack_log("JackClient::StartThread : period = %ld computation = %ld constraint = %ld", - long(int64_t(GetEngineControl()->fPeriod) / 1000.0f), - long(int64_t(GetEngineControl()->fComputation) / 1000.0f), - long(int64_t(GetEngineControl()->fConstraint) / 1000.0f)); + long(int64_t(GetEngineControl()->fPeriod) / 1000.0f), + long(int64_t(GetEngineControl()->fComputation) / 1000.0f), + long(int64_t(GetEngineControl()->fConstraint) / 1000.0f)); // Will do "something" on OSX only... fThread->SetParams(GetEngineControl()->fPeriod, GetEngineControl()->fComputation, GetEngineControl()->fConstraint); @@ -344,9 +344,9 @@ int JackClient::StartThread() bool JackClient::Execute() { if (fThreadFun) { - // Execute a dummy cycle to be sure thread has the correct properties (ensure thread creation is finished) - WaitSync(); - SignalSync(); + // Execute a dummy cycle to be sure thread has the correct properties (ensure thread creation is finished) + WaitSync(); + SignalSync(); fThreadFun(fThreadFunArg); } else { if (WaitFirstSync()) @@ -797,9 +797,9 @@ int JackClient::SetProcessCallback(JackProcessCallback callback, void *arg) jack_error("You cannot set callbacks on an active client"); return -1; } else if (fThreadFun) { - jack_error ("A thread callback has already been setup, both models cannot be used at the same time!"); - return -1; - } else { + jack_error ("A thread callback has already been setup, both models cannot be used at the same time!"); + return -1; + } else { fProcessArg = arg; fProcess = callback; return 0; @@ -920,9 +920,9 @@ int JackClient::SetProcessThread(JackThreadCallback fun, void *arg) jack_error("You cannot set callbacks on an active client"); return -1; } else if (fProcess) { - jack_error ("A process callback has already been setup, both models cannot be used at the same time!"); - return -1; - } else { + jack_error ("A process callback has already been setup, both models cannot be used at the same time!"); + return -1; + } else { fThreadFun = fun; fThreadFunArg = arg; return 0; diff --git a/common/JackDebugClient.h b/common/JackDebugClient.h index 72d2499e..81563a6b 100644 --- a/common/JackDebugClient.h +++ b/common/JackDebugClient.h @@ -91,7 +91,7 @@ class JackDebugClient : public JackClient int PortConnect(const char* src, const char* dst); int PortDisconnect(const char* src, const char* dst); - int PortDisconnect(jack_port_id_t src); + int PortDisconnect(jack_port_id_t src); int PortIsMine(jack_port_id_t port_index); diff --git a/common/JackEngine.cpp b/common/JackEngine.cpp index ccbd73f3..7c7d6b32 100644 --- a/common/JackEngine.cpp +++ b/common/JackEngine.cpp @@ -555,8 +555,8 @@ int JackEngine::ClientInternalClose(int refnum, bool wait) int JackEngine::ClientCloseAux(int refnum, JackClientInterface* client, bool wait) { jack_log("JackEngine::ClientCloseAux ref = %ld name = %s", - refnum, - (client->GetClientControl()) ? client->GetClientControl()->fName : "No name"); + refnum, + (client->GetClientControl()) ? client->GetClientControl()->fName : "No name"); // Remove the client from the table ReleaseRefnum(refnum); diff --git a/common/JackGraphManager.cpp b/common/JackGraphManager.cpp index e4ac86d5..f26d008c 100644 --- a/common/JackGraphManager.cpp +++ b/common/JackGraphManager.cpp @@ -275,7 +275,7 @@ int JackGraphManager::ComputeTotalLatencies() void JackGraphManager::SetBufferSize(jack_nframes_t buffer_size) { JackLock lock (this); - jack_log("JackGraphManager::SetBufferSize size = %ld", (long int)buffer_size); + jack_log("JackGraphManager::SetBufferSize size = %ld", buffer_size); jack_port_id_t port_index; for (port_index = FIRST_AVAILABLE_PORT; port_index < PORT_NUM; port_index++) { @@ -704,12 +704,12 @@ const char** JackGraphManager::GetConnections(jack_port_id_t port_index) next_index = GetCurrentIndex(); } while (cur_index != next_index); // Until a coherent state has been read - if (res[0]) { // at least one connection - return res; - } else { // empty array, should return NULL - free(res); - return NULL; - } + if (res[0]) { // at least one connection + return res; + } else { // empty array, should return NULL + free(res); + return NULL; + } } // Client diff --git a/common/JackInternalClient.cpp b/common/JackInternalClient.cpp index 65604755..01501a3d 100644 --- a/common/JackInternalClient.cpp +++ b/common/JackInternalClient.cpp @@ -56,11 +56,11 @@ JackSynchro** GetSynchroTable() JackInternalClient::JackInternalClient(JackServer* server, JackSynchro** table): JackClient(table) { fClientControl = new JackClientControl(); - /* - TODO: here we use a "direct access" to server internal, which is not safe if library clients access the server using - the "command thread" at the same time. So using the "command thread" also for internal clients would be safer. - We may want to keep the "direct access" to server internal mode for "server embeded in client process" kind of use. - */ + /* + TODO: here we use a "direct access" to server internal, which is not safe if library clients access the server using + the "command thread" at the same time. So using the "command thread" also for internal clients would be safer. + We may want to keep the "direct access" to server internal mode for "server embeded in client process" kind of use. + */ fChannel = new JackInternalClientChannel(server); } diff --git a/common/JackLibAPI.cpp b/common/JackLibAPI.cpp index 15f7354c..17e9f923 100644 --- a/common/JackLibAPI.cpp +++ b/common/JackLibAPI.cpp @@ -39,10 +39,10 @@ extern "C" { #endif - EXPORT jack_client_t * jack_client_open_aux (const char *client_name, + EXPORT jack_client_t * jack_client_open_aux (const char *client_name, jack_options_t options, jack_status_t *status, va_list ap); - EXPORT jack_client_t * jack_client_open (const char *client_name, + EXPORT jack_client_t * jack_client_open (const char *client_name, jack_options_t options, jack_status_t *status, ...); EXPORT int jack_client_close (jack_client_t *client); @@ -65,8 +65,8 @@ EXPORT jack_client_t* jack_client_open_aux(const char* ext_client_name, jack_opt jack_error("jack_client_open called with a NULL client_name"); return NULL; } - - jack_log("jack_client_open %s", ext_client_name); + + jack_log("jack_client_open %s", ext_client_name); JackTools::RewriteName(ext_client_name, client_name); if (status == NULL) /* no status from caller? */ @@ -82,9 +82,9 @@ EXPORT jack_client_t* jack_client_open_aux(const char* ext_client_name, jack_opt /* parse variable arguments */ if (ap) - jack_varargs_parse(options, ap, &va); + jack_varargs_parse(options, ap, &va); - JackLibGlobals::Init(); // jack library initialisation + JackLibGlobals::Init(); // jack library initialisation #ifndef WIN32 if (try_start_server(&va, options, status)) { @@ -118,7 +118,7 @@ EXPORT jack_client_t* jack_client_open_aux(const char* ext_client_name, jack_opt EXPORT jack_client_t* jack_client_open(const char* ext_client_name, jack_options_t options, jack_status_t* status, ...) { - va_list ap; + va_list ap; va_start(ap, status); jack_client_t* res = jack_client_open_aux(ext_client_name, options, status, ap); va_end(ap); diff --git a/common/JackProcessSync.h b/common/JackProcessSync.h index 85bc5959..0c9a1824 100644 --- a/common/JackProcessSync.h +++ b/common/JackProcessSync.h @@ -91,7 +91,7 @@ class JackProcessSync : public JackSyncInterface gettimeofday(&T1, 0); pthread_mutex_unlock(&fLock); jack_log("JackProcessSync::Wait finished delta = %5.1lf", - (1e6 * T1.tv_sec - 1e6 * T0.tv_sec + T1.tv_usec - T0.tv_usec)); + (1e6 * T1.tv_sec - 1e6 * T0.tv_sec + T1.tv_usec - T0.tv_usec)); return (res == 0); } @@ -158,7 +158,7 @@ class JackInterProcessSync : public JackSyncInterface bool res = fSynchro->TimedWait(usec); gettimeofday(&T1, 0); jack_log("JackInterProcessSync::Wait finished delta = %5.1lf", - (1e6 * T1.tv_sec - 1e6 * T0.tv_sec + T1.tv_usec - T0.tv_usec)); + (1e6 * T1.tv_sec - 1e6 * T0.tv_sec + T1.tv_usec - T0.tv_usec)); return res; } diff --git a/common/JackServer.h b/common/JackServer.h index 2a0b1c67..61311ff3 100644 --- a/common/JackServer.h +++ b/common/JackServer.h @@ -54,7 +54,7 @@ class EXPORT JackServer JackEngineControl* fEngineControl; JackGraphManager* fGraphManager; JackServerChannelInterface* fChannel; - JackConnectionManager fConnectionState; + JackConnectionManager fConnectionState; JackSynchro* fSynchroTable[CLIENT_NUM]; bool fFreewheel; long fLoopback; diff --git a/common/JackServerAPI.cpp b/common/JackServerAPI.cpp index 31920e60..62cab1f7 100644 --- a/common/JackServerAPI.cpp +++ b/common/JackServerAPI.cpp @@ -42,7 +42,7 @@ extern "C" { #endif - EXPORT jack_client_t * jack_client_open_aux (const char *client_name, + EXPORT jack_client_t * jack_client_open_aux (const char *client_name, jack_options_t options, jack_status_t *status, va_list ap); EXPORT jack_client_t * jack_client_open (const char *client_name, @@ -62,14 +62,14 @@ EXPORT jack_client_t* jack_client_open_aux(const char* ext_client_name, jack_opt jack_status_t my_status; JackClient* client; char client_name[JACK_CLIENT_NAME_SIZE]; - - if (ext_client_name == NULL) { + + if (ext_client_name == NULL) { jack_error("jack_client_open called with a NULL client_name"); return NULL; } - - jack_log("jack_client_open %s", ext_client_name); - JackTools::RewriteName(ext_client_name, client_name); + + jack_log("jack_client_open %s", ext_client_name); + JackTools::RewriteName(ext_client_name, client_name); if (status == NULL) /* no status from caller? */ status = &my_status; /* use local status word */ @@ -83,9 +83,9 @@ EXPORT jack_client_t* jack_client_open_aux(const char* ext_client_name, jack_opt } /* parse variable arguments */ - if (ap) - jack_varargs_parse(options, ap, &va); - + if (ap) + jack_varargs_parse(options, ap, &va); + if (!JackServerGlobals::Init()) { // jack server initialisation int my_status1 = (JackFailure | JackServerError); *status = (jack_status_t)my_status1; @@ -116,7 +116,7 @@ EXPORT jack_client_t* jack_client_open_aux(const char* ext_client_name, jack_opt EXPORT jack_client_t* jack_client_open(const char* ext_client_name, jack_options_t options, jack_status_t* status, ...) { - va_list ap; + va_list ap; va_start(ap, status); jack_client_t* res = jack_client_open_aux(ext_client_name, options, status, ap); va_end(ap); diff --git a/common/JackServerGlobals.cpp b/common/JackServerGlobals.cpp index 95254864..c2a59134 100644 --- a/common/JackServerGlobals.cpp +++ b/common/JackServerGlobals.cpp @@ -244,7 +244,7 @@ bool JackServerGlobals::Init() if (driver_nargs == 0) { jack_error("No driver specified ... hmm. JACK won't do" - " anything when run like this."); + " anything when run like this."); goto error; } diff --git a/common/JackTools.cpp b/common/JackTools.cpp index b4d1e066..f6ea7b0f 100644 --- a/common/JackTools.cpp +++ b/common/JackTools.cpp @@ -72,8 +72,7 @@ char* JackTools::ServerDir(const char* server_name, char* server_dir) } void JackTools::CleanupFiles(const char* server_name) -{ -} +{} int JackTools::GetTmpdir() { diff --git a/common/transport_types.h b/common/transport_types.h index d3824f63..52f92661 100644 --- a/common/transport_types.h +++ b/common/transport_types.h @@ -86,7 +86,7 @@ extern "C" /* JackPositionTimecode fields: (EXPERIMENTAL: could change) */ double frame_time; /**< current time in seconds */ double next_time; /**< next sequential frame_time - (unless repositioned) */ + (unless repositioned) */ /* For binary compatibility, new fields should be allocated from * this padding area with new valid bits controlling access, so diff --git a/linux/alsa/JackAlsaDriver.cpp b/linux/alsa/JackAlsaDriver.cpp index 2cfe071c..74e1abae 100644 --- a/linux/alsa/JackAlsaDriver.cpp +++ b/linux/alsa/JackAlsaDriver.cpp @@ -2145,7 +2145,9 @@ int JackAlsaDriver::Attach() } port = fGraphManager->GetPort(port_index); port->SetAlias(alias); - port->SetLatency((alsa_driver->frames_per_cycle * (alsa_driver->user_nperiods - 1)) + alsa_driver->playback_frame_latency); + // Add one buffer more latency if "async" mode is used... + port->SetLatency((alsa_driver->frames_per_cycle * (alsa_driver->user_nperiods - 1)) + + ((fEngineControl->fSyncMode) ? 0 : fEngineControl->fBufferSize) + alsa_driver->playback_frame_latency); fPlaybackPortList[i] = port_index; jack_log("JackAudioDriver::Attach fPlaybackPortList[i] %ld ", port_index); diff --git a/linux/alsa/memops.h b/linux/alsa/memops.h index dc9d5bd0..3a3429d9 100644 --- a/linux/alsa/memops.h +++ b/linux/alsa/memops.h @@ -84,8 +84,7 @@ extern "C" void sample_merge_d32u24_sS (char *dst, jack_default_audio_sample_t *src, unsigned long nsamples, unsigned long dst_skip, dither_state_t *state); static __inline__ void - sample_merge (jack_default_audio_sample_t *dst, jack_default_audio_sample_t *src, unsigned long cnt) - { + sample_merge (jack_default_audio_sample_t *dst, jack_default_audio_sample_t *src, unsigned long cnt) { while (cnt--) { *dst += *src; dst++; @@ -94,8 +93,7 @@ extern "C" } static __inline__ void - sample_memcpy (jack_default_audio_sample_t *dst, jack_default_audio_sample_t *src, unsigned long cnt) - { + sample_memcpy (jack_default_audio_sample_t *dst, jack_default_audio_sample_t *src, unsigned long cnt) { memcpy (dst, src, cnt * sizeof (jack_default_audio_sample_t)); } diff --git a/linux/firewire/JackFFADODriver.cpp b/linux/firewire/JackFFADODriver.cpp index 2bbc5d4e..03b26213 100644 --- a/linux/firewire/JackFFADODriver.cpp +++ b/linux/firewire/JackFFADODriver.cpp @@ -585,7 +585,8 @@ int JackFFADODriver::Attach() } port = fGraphManager->GetPort(port_index); - port->SetLatency((driver->period_size * (driver->device_options.nb_buffers - 1)) + driver->playback_frame_latency); + // Add one buffer more latency if "async" mode is used... + port->SetLatency((driver->period_size * (driver->device_options.nb_buffers - 1)) + ((fEngineControl->fSyncMode) ? 0 : fEngineControl->fBufferSize) + driver->playback_frame_latency); fPlaybackPortList[chn] = port_index; jack_log("JackFFADODriver::Attach fPlaybackPortList[i] %ld ", port_index); fPlaybackChannels++; diff --git a/linux/freebob/JackFreebobDriver.cpp b/linux/freebob/JackFreebobDriver.cpp index c68d3d85..72588ba3 100644 --- a/linux/freebob/JackFreebobDriver.cpp +++ b/linux/freebob/JackFreebobDriver.cpp @@ -771,7 +771,8 @@ int JackFreebobDriver::Attach() return -1; } port = fGraphManager->GetPort(port_index); - port->SetLatency((driver->period_size * (driver->device_options.nb_buffers - 1)) + driver->playback_frame_latency); + // Add one buffer more latency if "async" mode is used... + port->SetLatency((driver->period_size * (driver->device_options.nb_buffers - 1)) + ((fEngineControl->fSyncMode) ? 0 : fEngineControl->fBufferSize) + driver->playback_frame_latency); fPlaybackPortList[i] = port_index; jack_log("JackFreebobDriver::Attach fPlaybackPortList[i] %ld ", port_index); driver->playback_nchannels_audio++; diff --git a/macosx/JackCoreAudioDriver.cpp b/macosx/JackCoreAudioDriver.cpp index 057283e5..eb00a2e6 100644 --- a/macosx/JackCoreAudioDriver.cpp +++ b/macosx/JackCoreAudioDriver.cpp @@ -28,8 +28,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. #include "driver_interface.h" #include <iostream> -#define IO_CPU 0 - namespace Jack { @@ -421,7 +419,7 @@ OSStatus JackCoreAudioDriver::GetTotalChannels(AudioDeviceID device, int* channe } JackCoreAudioDriver::JackCoreAudioDriver(const char* name, JackEngine* engine, JackSynchro** table) - : JackAudioDriver(name, engine, table), fJackInputData(NULL), fDriverOutputData(NULL), fState(false) + : JackAudioDriver(name, engine, table), fJackInputData(NULL), fDriverOutputData(NULL), fState(false), fIOUsage(1.f) {} JackCoreAudioDriver::~JackCoreAudioDriver() @@ -848,17 +846,14 @@ int JackCoreAudioDriver::AddListeners() return -1; } -#if IO_CPU if (!fEngineControl->fSyncMode) { UInt32 outSize = sizeof(float); - float iousage = 0.5f; - err = AudioDeviceSetProperty(fDeviceID, NULL, 0, false, kAudioDevicePropertyIOCycleUsage, outSize, &iousage); + err = AudioDeviceSetProperty(fDeviceID, NULL, 0, false, kAudioDevicePropertyIOCycleUsage, outSize, &fIOUsage); if (err != noErr) { jack_error("Error calling AudioDeviceSetProperty kAudioDevicePropertyIOCycleUsage"); printError(err); } } -#endif return 0; } @@ -1032,7 +1027,8 @@ int JackCoreAudioDriver::Attach() port = fGraphManager->GetPort(port_index); port->SetAlias(alias); - port->SetLatency(fEngineControl->fBufferSize + value1 + value2 + fPlaybackLatency); + // Add more latency if "async" mode is used... + port->SetLatency(fEngineControl->fBufferSize + ((fEngineControl->fSyncMode) ? 0 : fEngineControl->fBufferSize * fIOUsage) + value1 + value2 + fPlaybackLatency); fPlaybackPortList[i] = port_index; // Monitor ports diff --git a/macosx/JackCoreAudioDriver.h b/macosx/JackCoreAudioDriver.h index e8cc55c1..df5bc611 100644 --- a/macosx/JackCoreAudioDriver.h +++ b/macosx/JackCoreAudioDriver.h @@ -71,6 +71,7 @@ class JackCoreAudioDriver : public JackAudioDriver char fPlaybackUID[256]; bool fMonitor; + float fIOUsage; static OSStatus Render(void *inRefCon, AudioUnitRenderActionFlags *ioActionFlags, diff --git a/macosx/JackMachThread.cpp b/macosx/JackMachThread.cpp index 738de54b..081f3641 100644 --- a/macosx/JackMachThread.cpp +++ b/macosx/JackMachThread.cpp @@ -155,7 +155,7 @@ int JackMachThread::Kill() int JackMachThread::AcquireRealTime() { jack_log("JackMachThread::AcquireRealTime fPeriod = %ld fComputation = %ld fConstraint = %ld", - long(fPeriod / 1000), long(fComputation / 1000), long(fConstraint / 1000)); + long(fPeriod / 1000), long(fComputation / 1000), long(fConstraint / 1000)); return (fThread) ? AcquireRealTimeImp(fThread, fPeriod, fComputation, fConstraint) : -1; } |