git-svn-id: http://subversion.jackaudio.org/jack/jack2/branches/libjacknet@3564 0c269be4-1314-0410-8aa9-9f06e86f4224tags/1.9.8
@@ -23,42 +23,58 @@ Paul Davis | |||||
--------------------------- | --------------------------- | ||||
Jackdmp changes log | Jackdmp changes log | ||||
--------------------------- | |||||
--------------------------- | |||||
2009-06-19 Stephane Letz <letz@grame.fr> | |||||
* Correct JackTransportEngine::MakeAllLocating, sync callback has to be called in this case also. | |||||
2009-06-17 Stephane Letz <letz@grame.fr> | |||||
* Move DBus based audio device reservation code in ALSA backend compilation. | |||||
2009-06-16 Stephane Letz <letz@grame.fr> | |||||
* Correct JackFifo::TimedWait for EINTR handling. | |||||
2009-06-05 Stephane Letz <letz@grame.fr> | |||||
* Correct jack_set_error_function, jack_set_info_function and jack_set_thread_creator functions. | |||||
2009-05-18 Stephane Letz <letz@grame.fr> | 2009-05-18 Stephane Letz <letz@grame.fr> | ||||
* Correct wcsript files to create jackdbus only (and not create jackd anymore) when compiled in --dbus mode, add a --classic option. Both options are possible but issue a warning. | |||||
* Correct wcsript files to create jackdbus only (and not create jackd anymore) when compiled in --dbus mode, add a --classic option. Both options are possible but issue a warning. | |||||
2009-05-15 Stephane Letz <letz@grame.fr> | 2009-05-15 Stephane Letz <letz@grame.fr> | ||||
* Move InitFrameTime in JackDriver::Start method. | |||||
* Move InitFrameTime in JackDriver::Start method. | |||||
2009-05-13 Stephane Letz <letz@grame.fr> | 2009-05-13 Stephane Letz <letz@grame.fr> | ||||
* Reworked Torben Hohn fix for server restart issue on Windows. | |||||
* Reworked Torben Hohn fix for server restart issue on Windows. | |||||
2009-05-11 Stephane Letz <letz@grame.fr> | 2009-05-11 Stephane Letz <letz@grame.fr> | ||||
* New jack_free function added in jack.h. | |||||
* Torben Hohn fix for InitTime and GetMicroSeconds in JackWinTime.c. | |||||
* New jack_free function added in jack.h. | |||||
* Torben Hohn fix for InitTime and GetMicroSeconds in JackWinTime.c. | |||||
2009-05-07 Stephane Letz <letz@grame.fr> | 2009-05-07 Stephane Letz <letz@grame.fr> | ||||
* Cleanup "loopback" stuff in server. | |||||
* Cleanup "loopback" stuff in server. | |||||
2009-05-06 Stephane Letz <letz@grame.fr> | 2009-05-06 Stephane Letz <letz@grame.fr> | ||||
* Fix transport callback (timebase master, sync) issue when used after jack_activate (RT thread was not running). | |||||
* Fix transport callback (timebase master, sync) issue when used after jack_activate (RT thread was not running). | |||||
* D-Bus access for jackctl_server_add_slave/jackctl_server_remove_slave API. | * D-Bus access for jackctl_server_add_slave/jackctl_server_remove_slave API. | ||||
2009-05-05 Stephane Letz <letz@grame.fr> | 2009-05-05 Stephane Letz <letz@grame.fr> | ||||
* First working version of native MIDI backend (JackCoreMidiDriver, JackWinMMEDriver). | * First working version of native MIDI backend (JackCoreMidiDriver, JackWinMMEDriver). | ||||
2009-04-22 Stephane Letz <letz@grame.fr> | 2009-04-22 Stephane Letz <letz@grame.fr> | ||||
* jackctl_server_load_master renamed to jackctl_server_switch_master, jackctl_server_unload_master is removed. | * jackctl_server_load_master renamed to jackctl_server_switch_master, jackctl_server_unload_master is removed. | ||||
2009-04-21 Stephane Letz <letz@grame.fr> | 2009-04-21 Stephane Letz <letz@grame.fr> | ||||
* Add jackctl_server_load_master/jackctl_server_unload_master API. | * Add jackctl_server_load_master/jackctl_server_unload_master API. | ||||
@@ -278,12 +278,12 @@ static inline void WaitGraphChange() | |||||
EXPORT void jack_set_error_function (print_function func) | EXPORT void jack_set_error_function (print_function func) | ||||
{ | { | ||||
jack_error_callback = func; | |||||
jack_error_callback = (func == NULL) ? &default_jack_error_callback : func; | |||||
} | } | ||||
EXPORT void jack_set_info_function (print_function func) | EXPORT void jack_set_info_function (print_function func) | ||||
{ | { | ||||
jack_info_callback = func; | |||||
jack_info_callback = (func == NULL) ? &default_jack_info_callback : func; | |||||
} | } | ||||
EXPORT jack_client_t* jack_client_new(const char* client_name) | EXPORT jack_client_t* jack_client_new(const char* client_name) | ||||
@@ -1799,7 +1799,7 @@ EXPORT int jack_client_kill_thread(jack_client_t* client, pthread_t thread) | |||||
#ifndef WIN32 | #ifndef WIN32 | ||||
EXPORT void jack_set_thread_creator (jack_thread_creator_t jtc) | EXPORT void jack_set_thread_creator (jack_thread_creator_t jtc) | ||||
{ | { | ||||
JackGlobals::fJackThreadCreator = jtc; | |||||
JackGlobals::fJackThreadCreator = (jtc == NULL) ? pthread_create : jtc; | |||||
} | } | ||||
#endif | #endif | ||||
@@ -739,9 +739,10 @@ int JackEngine::PortUnRegister(int refnum, jack_port_id_t port_index) | |||||
int JackEngine::PortConnect(int refnum, const char* src, const char* dst) | int JackEngine::PortConnect(int refnum, const char* src, const char* dst) | ||||
{ | { | ||||
jack_log("JackEngine::PortConnect src = %s dst = %s", src, dst); | jack_log("JackEngine::PortConnect src = %s dst = %s", src, dst); | ||||
AssertRefnum(refnum); | |||||
jack_port_id_t port_src, port_dst; | jack_port_id_t port_src, port_dst; | ||||
return (fGraphManager->CheckPorts(src, dst, &port_src, &port_dst) < 0) | |||||
return (fGraphManager->GetTwoPorts(src, dst, &port_src, &port_dst) < 0) | |||||
? -1 | ? -1 | ||||
: PortConnect(refnum, port_src, port_dst); | : PortConnect(refnum, port_src, port_dst); | ||||
} | } | ||||
@@ -788,14 +789,9 @@ int JackEngine::PortDisconnect(int refnum, const char* src, const char* dst) | |||||
AssertRefnum(refnum); | AssertRefnum(refnum); | ||||
jack_port_id_t port_src, port_dst; | jack_port_id_t port_src, port_dst; | ||||
if (fGraphManager->CheckPorts(src, dst, &port_src, &port_dst) < 0) { | |||||
return -1; | |||||
} else if (fGraphManager->Disconnect(port_src, port_dst) == 0) { | |||||
NotifyPortConnect(port_src, port_dst, false); | |||||
return 0; | |||||
} else { | |||||
return -1; | |||||
} | |||||
return (fGraphManager->GetTwoPorts(src, dst, &port_src, &port_dst) < 0) | |||||
? -1 | |||||
: PortDisconnect(refnum, port_src, port_dst); | |||||
} | } | ||||
int JackEngine::PortDisconnect(int refnum, jack_port_id_t src, jack_port_id_t dst) | int JackEngine::PortDisconnect(int refnum, jack_port_id_t src, jack_port_id_t dst) | ||||
@@ -808,21 +804,23 @@ int JackEngine::PortDisconnect(int refnum, jack_port_id_t src, jack_port_id_t ds | |||||
jack_int_t connections[CONNECTION_NUM_FOR_PORT]; | jack_int_t connections[CONNECTION_NUM_FOR_PORT]; | ||||
fGraphManager->GetConnections(src, connections); | fGraphManager->GetConnections(src, connections); | ||||
// Notifications | |||||
JackPort* port = fGraphManager->GetPort(src); | JackPort* port = fGraphManager->GetPort(src); | ||||
int ret = 0; | |||||
if (port->GetFlags() & JackPortIsOutput) { | if (port->GetFlags() & JackPortIsOutput) { | ||||
for (int i = 0; (i < CONNECTION_NUM_FOR_PORT) && (connections[i] != EMPTY); i++) { | for (int i = 0; (i < CONNECTION_NUM_FOR_PORT) && (connections[i] != EMPTY); i++) { | ||||
jack_log("NotifyPortConnect src = %ld dst = %ld false", src, connections[i]); | |||||
NotifyPortConnect(src, connections[i], false); | |||||
if (PortDisconnect(refnum, src, connections[i]) != 0) { | |||||
ret = -1; | |||||
} | |||||
} | } | ||||
} else { | } else { | ||||
for (int i = 0; (i < CONNECTION_NUM_FOR_PORT) && (connections[i] != EMPTY); i++) { | for (int i = 0; (i < CONNECTION_NUM_FOR_PORT) && (connections[i] != EMPTY); i++) { | ||||
jack_log("NotifyPortConnect src = %ld dst = %ld false", connections[i], src); | |||||
NotifyPortConnect(connections[i], src, false); | |||||
if (PortDisconnect(refnum, connections[i], src) != 0) { | |||||
ret = -1; | |||||
} | |||||
} | } | ||||
} | } | ||||
return fGraphManager->DisconnectAll(src); | |||||
return ret; | |||||
} else if (fGraphManager->CheckPorts(src, dst) < 0) { | } else if (fGraphManager->CheckPorts(src, dst) < 0) { | ||||
return -1; | return -1; | ||||
} else if (fGraphManager->Disconnect(src, dst) == 0) { | } else if (fGraphManager->Disconnect(src, dst) == 0) { | ||||
@@ -836,6 +834,7 @@ int JackEngine::PortDisconnect(int refnum, jack_port_id_t src, jack_port_id_t ds | |||||
int JackEngine::PortRename(int refnum, jack_port_id_t port, const char* name) | int JackEngine::PortRename(int refnum, jack_port_id_t port, const char* name) | ||||
{ | { | ||||
AssertRefnum(refnum); | |||||
fGraphManager->GetPort(port)->SetName(name); | fGraphManager->GetPort(port)->SetName(name); | ||||
NotifyPortRename(port); | NotifyPortRename(port); | ||||
return 0; | return 0; | ||||
@@ -118,17 +118,23 @@ SERVER_EXPORT void jack_log(const char *fmt,...) | |||||
} | } | ||||
} | } | ||||
static void default_jack_error_callback(const char *desc) | |||||
SERVER_EXPORT void default_jack_error_callback(const char *desc) | |||||
{ | { | ||||
fprintf(stderr, "%s\n", desc); | fprintf(stderr, "%s\n", desc); | ||||
fflush(stderr); | fflush(stderr); | ||||
} | } | ||||
static void default_jack_info_callback (const char *desc) | |||||
SERVER_EXPORT void default_jack_info_callback(const char *desc) | |||||
{ | { | ||||
fprintf(stdout, "%s\n", desc); | fprintf(stdout, "%s\n", desc); | ||||
fflush(stdout); | fflush(stdout); | ||||
} | } | ||||
SERVER_EXPORT void silent_jack_error_callback(const char *desc) | |||||
{} | |||||
SERVER_EXPORT void silent_jack_info_callback(const char *desc) | |||||
{} | |||||
SERVER_EXPORT void (*jack_error_callback)(const char *desc) = &default_jack_error_callback; | SERVER_EXPORT void (*jack_error_callback)(const char *desc) = &default_jack_error_callback; | ||||
SERVER_EXPORT void (*jack_info_callback)(const char *desc) = &default_jack_info_callback; | SERVER_EXPORT void (*jack_info_callback)(const char *desc) = &default_jack_info_callback; |
@@ -45,6 +45,12 @@ extern "C" | |||||
SERVER_EXPORT extern void (*jack_error_callback)(const char *desc); | SERVER_EXPORT extern void (*jack_error_callback)(const char *desc); | ||||
SERVER_EXPORT extern void (*jack_info_callback)(const char *desc); | SERVER_EXPORT extern void (*jack_info_callback)(const char *desc); | ||||
SERVER_EXPORT extern void default_jack_error_callback(const char *desc); | |||||
SERVER_EXPORT extern void default_jack_info_callback(const char *desc); | |||||
SERVER_EXPORT extern void silent_jack_error_callback(const char *desc); | |||||
SERVER_EXPORT extern void silent_jack_info_callback(const char *desc); | |||||
typedef void (* jack_log_function_t)(int level, const char *message); | typedef void (* jack_log_function_t)(int level, const char *message); | ||||
@@ -52,8 +58,8 @@ extern "C" | |||||
void jack_log_function(int level, const char *message); | void jack_log_function(int level, const char *message); | ||||
SERVER_EXPORT void set_threaded_log_function(); | SERVER_EXPORT void set_threaded_log_function(); | ||||
extern int jack_verbose; | |||||
extern int jack_verbose; | |||||
#ifdef __cplusplus | #ifdef __cplusplus | ||||
} | } | ||||
@@ -627,7 +627,7 @@ int JackGraphManager::CheckPorts(jack_port_id_t port_src, jack_port_id_t port_ds | |||||
return 0; | return 0; | ||||
} | } | ||||
int JackGraphManager::CheckPorts(const char* src_name, const char* dst_name, jack_port_id_t* port_src, jack_port_id_t* port_dst) | |||||
int JackGraphManager::GetTwoPorts(const char* src_name, const char* dst_name, jack_port_id_t* port_src, jack_port_id_t* port_dst) | |||||
{ | { | ||||
jack_log("JackGraphManager::CheckConnect src_name = %s dst_name = %s", src_name, dst_name); | jack_log("JackGraphManager::CheckConnect src_name = %s dst_name = %s", src_name, dst_name); | ||||
@@ -641,7 +641,7 @@ int JackGraphManager::CheckPorts(const char* src_name, const char* dst_name, jac | |||||
return -1; | return -1; | ||||
} | } | ||||
return CheckPorts(*port_src, *port_dst); | |||||
return 0; | |||||
} | } | ||||
// Client : port array | // Client : port array | ||||
@@ -91,7 +91,7 @@ class SERVER_EXPORT JackGraphManager : public JackShmMem, public JackAtomicState | |||||
void GetConnections(jack_port_id_t port_index, jack_int_t* connections); // TODO | void GetConnections(jack_port_id_t port_index, jack_int_t* connections); // TODO | ||||
const char** GetPorts(const char* port_name_pattern, const char* type_name_pattern, unsigned long flags); | const char** GetPorts(const char* port_name_pattern, const char* type_name_pattern, unsigned long flags); | ||||
int CheckPorts(const char* src, const char* dst, jack_port_id_t* src_index, jack_port_id_t* dst_index); | |||||
int GetTwoPorts(const char* src, const char* dst, jack_port_id_t* src_index, jack_port_id_t* dst_index); | |||||
int CheckPorts(jack_port_id_t port_src, jack_port_id_t port_dst); | int CheckPorts(jack_port_id_t port_src, jack_port_id_t port_dst); | ||||
void DisconnectAllInput(jack_port_id_t port_index); | void DisconnectAllInput(jack_port_id_t port_index); | ||||
@@ -141,6 +141,7 @@ void JackTransportEngine::MakeAllLocating(JackClientInterface** table) | |||||
if (client) { | if (client) { | ||||
JackClientControl* control = client->GetClientControl(); | JackClientControl* control = client->GetClientControl(); | ||||
control->fTransportState = JackTransportStopped; | control->fTransportState = JackTransportStopped; | ||||
control->fTransportSync = true; | |||||
control->fTransportTimebase = true; | control->fTransportTimebase = true; | ||||
jack_log("MakeAllLocating ref = %ld", i); | jack_log("MakeAllLocating ref = %ld", i); | ||||
} | } | ||||
@@ -0,0 +1,168 @@ | |||||
/* | |||||
Copyright (C) 2009 Grame | |||||
This program is free software; you can redistribute it and/or modify | |||||
it under the terms of the GNU Lesser General Public License as published by | |||||
the Free Software Foundation; either version 2.1 of the License, or | |||||
(at your option) any later version. | |||||
This program is distributed in the hope that it will be useful, | |||||
but WITHOUT ANY WARRANTY; without even the implied warranty of | |||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||||
GNU Lesser General Public License for more details. | |||||
You should have received a copy of the GNU Lesser General Public License | |||||
along with this program; if not, write to the Free Software | |||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |||||
*/ | |||||
/* | |||||
Completed from Julien Pommier (PianoTeq : http://www.pianoteq.com/) code. | |||||
*/ | |||||
#include "jack.h" | |||||
#include <math.h> | |||||
#include <dlfcn.h> | |||||
#include <stdlib.h> | |||||
#include <cassert> | |||||
#include <iostream> | |||||
/* dynamically load libjack and forward all registered calls to libjack | |||||
(similar to what relaytool is trying to do, but more portably..) | |||||
*/ | |||||
using std::cerr; | |||||
int libjack_is_present = 0; // public symbol, similar to what relaytool does. | |||||
static void *libjack_handle = 0; | |||||
static void __attribute__((constructor)) tryload_libjack() | |||||
{ | |||||
if (getenv("SKIP_LIBJACK") == 0) { // just in case libjack is causing troubles.. | |||||
libjack_handle = dlopen("libjack.so.0", RTLD_LAZY); | |||||
} | |||||
libjack_is_present = (libjack_handle != 0); | |||||
} | |||||
void *load_jack_function(const char *fn_name) | |||||
{ | |||||
void *fn = 0; | |||||
if (!libjack_handle) { | |||||
std::cerr << "libjack not found, so do not try to load " << fn_name << " ffs !\n"; | |||||
return 0; | |||||
} | |||||
fn = dlsym(libjack_handle, fn_name); | |||||
if (!fn) { | |||||
std::cerr << "could not dlsym(" << libjack_handle << "), " << dlerror() << "\n"; | |||||
} | |||||
return fn; | |||||
} | |||||
#define DECL_FUNCTION(return_type, fn_name, arguments_types, arguments) \ | |||||
typedef return_type (*fn_name##_ptr_t)arguments_types; \ | |||||
return_type fn_name arguments_types { \ | |||||
static fn_name##_ptr_t fn = 0; \ | |||||
if (fn == 0) { fn = (fn_name##_ptr_t)load_jack_function(#fn_name); } \ | |||||
if (fn) return (*fn)arguments; \ | |||||
else return 0; \ | |||||
} | |||||
#define DECL_VOID_FUNCTION(fn_name, arguments_types, arguments) \ | |||||
typedef void (*fn_name##_ptr_t)arguments_types; \ | |||||
void fn_name arguments_types { \ | |||||
static fn_name##_ptr_t fn = 0; \ | |||||
if (fn == 0) { fn = (fn_name##_ptr_t)load_jack_function(#fn_name); } \ | |||||
if (fn) (*fn)arguments; \ | |||||
} | |||||
DECL_VOID_FUNCTION(jack_get_version, (int *major_ptr, int *minor_ptr, int *micro_ptr, int *proto_ptr), (major_ptr, minor_ptr, micro_ptr, proto_ptr)); | |||||
DECL_FUNCTION(const char *, jack_get_version_string, (), ()); | |||||
DECL_FUNCTION(jack_client_t *, jack_client_open, (const char *client_name, jack_options_t options, jack_status_t *status, ...), | |||||
(client_name, options, status)); | |||||
DECL_FUNCTION(int, jack_client_close, (jack_client_t *client), (client)); | |||||
DECL_FUNCTION(int, jack_client_new, (const char *client_name), (client_name)); | |||||
DECL_FUNCTION(int, jack_client_name_size, (), ()); | |||||
DECL_FUNCTION(char*, jack_get_client_name, (jack_client_t *client), (client)); | |||||
DECL_FUNCTION(int, jack_internal_client_new, (const char *client_name, | |||||
const char *load_name, | |||||
const char *load_init), (client_name, load_name, load_init)); | |||||
DECL_VOID_FUNCTION(jack_internal_client_close, (const char *client_name), (client_name)); | |||||
DECL_FUNCTION(int, jack_is_realtime, (jack_client_t *client), (client)); | |||||
DECL_VOID_FUNCTION(jack_on_shutdown, (jack_client_t *client, JackShutdownCallback shutdown_callback, void *arg), (client, function, arg)); | |||||
DECL_FUNCTION(int, jack_set_process_callback, (jack_client_t *client, | |||||
JackProcessCallback process_callback, | |||||
void *arg), (client, process_callback, arg)); | |||||
DECL_FUNCTION(jack_nframes_t, jack_thread_wait, (jack_client_t *client, int status), (client, status)); | |||||
// | |||||
DECL_FUNCTION(jack_nframes_t, jack_cycle_wait, (jack_client_t *client), (client)); | |||||
DECL_VOID_FUNCTION(jack_cycle_signal, (jack_client_t *client, , int status), (client, status)); | |||||
DECL_FUNCTION(int, jack_set_process_thread, (jack_client_t *client, | |||||
JackThreadCallback fun, | |||||
void *arg), (client, fun, arg)); | |||||
DECL_FUNCTION(int, jack_set_thread_init_callback, (jack_client_t *client, | |||||
JackThreadInitCallback thread_init_callback, | |||||
void *arg), (client, thread_init_callback, arg)); | |||||
DECL_FUNCTION(int, jack_set_freewheel_callback, (jack_client_t *client, | |||||
JackFreewheelCallback freewheel_callback, | |||||
void *arg), (client, freewheel_callback, arg)); | |||||
DECL_FUNCTION(int, jack_set_freewheel, (jack_client_t *client, int onoff), (client, onoff)); | |||||
DECL_FUNCTION(int, jack_set_buffer_size, (jack_client_t *client, jack_nframes_t nframes), (client, nframes)); | |||||
DECL_FUNCTION(int, jack_set_buffer_size_callback, (jack_client_t *client, | |||||
JackBufferSizeCallback bufsize_callback, | |||||
void *arg), (client, bufsize_callback, arg)); | |||||
DECL_FUNCTION(int, jack_set_sample_rate_callback, (jack_client_t *client, | |||||
JackSampleRateCallback srate_callback, | |||||
void *arg), (client, srate_callback, arg)); | |||||
DECL_FUNCTION(int, jack_set_client_registration_callback, (jack_client_t *client, | |||||
JackClientRegistrationCallback registration_callback, | |||||
void *arg), (client, registration_callback, arg)); | |||||
DECL_FUNCTION(int, jack_set_port_registration_callback, (jack_client_t *client, | |||||
JackPortRegistrationCallback registration_callback, | |||||
void *arg), (client, registration_callback, arg)); | |||||
DECL_FUNCTION(int, jack_set_port_connect_callback, (jack_client_t *client, | |||||
JackPortConnectCallback connect_callback, | |||||
void *arg), (client, connect_callback, arg)); | |||||
DECL_FUNCTION(int, jack_set_port_rename_callback, (jack_client_t *client, | |||||
JackPortRenameCallback rename_callback, | |||||
void *arg), (client, rename_callback, arg)); | |||||
DECL_FUNCTION(int, jack_set_graph_order_callback, (jack_client_t *client, | |||||
JackGraphOrderCallback graph_callback, | |||||
void *arg), (client, graph_callback, arg)); | |||||
DECL_FUNCTION(int, jack_set_xrun_callback, (jack_client_t *client, | |||||
JackXRunCallback xrun_callback, | |||||
void *arg), (client, xrun_callback, arg)); | |||||
DECL_FUNCTION(int, jack_activate, (jack_client_t *client), (client)); | |||||
DECL_FUNCTION(int, jack_deactivate, (jack_client_t *client), (client)); | |||||
DECL_FUNCTION(jack_port_t *, jack_port_register, (jack_client_t *client, const char *port_name, const char *port_type, | |||||
unsigned long flags, unsigned long buffer_size), | |||||
(client, port_name, port_type, flags, buffer_size)); | |||||
DECL_FUNCTION(int, jack_port_unregister, (jack_client_t *client, jack_port_t* port), (client, port)); | |||||
DECL_FUNCTION(void *, jack_port_get_buffer, (jack_port_t *port, jack_nframes_t nframes), (port, nframes)); | |||||
DECL_FUNCTION(const char*, jack_port_name, (const jack_port_t *port), (port)); | |||||
DECL_FUNCTION(const char*, jack_port_short_name, (const jack_port_t *port), (port)); | |||||
DECL_FUNCTION(int, jack_port_flags, (const jack_port_t *port), (port)); | |||||
DECL_FUNCTION(const char*, jack_port_type, (const jack_port_t *port), (port)); | |||||
DECL_FUNCTION(jack_port_type_id_t, jack_port_type_id, (const jack_port_t *port), (port)); | |||||
DECL_FUNCTION(int, jack_port_is_mine, (const jack_client_t *client, const jack_port_t* port), (client, port)); | |||||
DECL_FUNCTION(int, jack_port_connected, (const jack_port_t *port), (port)); | |||||
DECL_FUNCTION(int, jack_port_connected_to, (const jack_port_t *port, const char *port_name), (port, port_name)); | |||||
DECL_FUNCTION(const char**, jack_port_get_connections, (const jack_port_t *port), (port)); | |||||
DECL_FUNCTION(const char**, jack_port_get_all_connections, (const jack_port_t *port), (port)); | |||||
DECL_FUNCTION(int, jack_port_tie, (jack_port_t *src, jack_port_t *dst), (src, dst)); | |||||
DECL_FUNCTION(int, jack_port_untie, (jack_port_t *port), (port)); | |||||
DECL_FUNCTION(jack_nframes_t, jack_get_buffer_size, (jack_client_t *client), (client)); | |||||
DECL_FUNCTION(jack_nframes_t, jack_get_sample_rate, (jack_client_t *client), (client)); | |||||
DECL_FUNCTION(jack_nframes_t, jack_port_get_total_latency, (jack_client_t *client, jack_port_t *port), (client, port)); | |||||
DECL_VOID_FUNCTION(jack_set_error_function, (void (*func)(const char *)), (func)); | |||||
DECL_FUNCTION(const char**, jack_get_ports, (jack_client_t *client, const char *port_name_pattern, const char * type_name_pattern, | |||||
unsigned long flags), (client, port_name_pattern, type_name_pattern, flags)); | |||||
DECL_FUNCTION(int, jack_connect, (jack_client_t *client, const char *source_port, const char *destination_port), (client, source_port, destination_port)); | |||||
DECL_FUNCTION(int, jack_set_port_connect_callback, (jack_client_t *client, JackPortConnectCallback connect_callback, void *arg), | |||||
(client, connect_callback, arg)); | |||||
DECL_FUNCTION(jack_port_t *, jack_port_by_id, (jack_client_t *client, jack_port_id_t port_id), (client, port_id)); |
@@ -76,9 +76,6 @@ static void notify_server_stop(const char* server_name) | |||||
#endif | #endif | ||||
static void silent_jack_error_callback(const char *desc) | |||||
{} | |||||
static void copyright(FILE* file) | static void copyright(FILE* file) | ||||
{ | { | ||||
fprintf(file, "jackdmp " VERSION "\n" | fprintf(file, "jackdmp " VERSION "\n" | ||||
@@ -208,7 +205,7 @@ int main(int argc, char* argv[]) | |||||
jackctl_parameter_t* param; | jackctl_parameter_t* param; | ||||
union jackctl_parameter_value value; | union jackctl_parameter_value value; | ||||
copyright(stdout); | |||||
copyright(stdout); | |||||
server_ctl = jackctl_server_create(); | server_ctl = jackctl_server_create(); | ||||
if (server_ctl == NULL) { | if (server_ctl == NULL) { | ||||
@@ -359,10 +356,10 @@ int main(int argc, char* argv[]) | |||||
if (show_version) { | if (show_version) { | ||||
printf( "jackdmp version " VERSION | printf( "jackdmp version " VERSION | ||||
" tmpdir " jack_server_dir | |||||
" protocol %d" | |||||
"\n", JACK_PROTOCOL_VERSION); | |||||
return -1; | |||||
" tmpdir " jack_server_dir | |||||
" protocol %d" | |||||
"\n", JACK_PROTOCOL_VERSION); | |||||
return -1; | |||||
} | } | ||||
if (!seen_audio_driver) { | if (!seen_audio_driver) { | ||||
@@ -1047,6 +1047,7 @@ extern void (*jack_error_callback)(const char *msg); | |||||
/** | /** | ||||
* Set the @ref jack_error_callback for error message display. | * Set the @ref jack_error_callback for error message display. | ||||
* Set it to NULL to restore default_jack_error_callback function. | |||||
* | * | ||||
* The JACK library provides two built-in callbacks for this purpose: | * The JACK library provides two built-in callbacks for this purpose: | ||||
* default_jack_error_callback() and silent_jack_error_callback(). | * default_jack_error_callback() and silent_jack_error_callback(). | ||||
@@ -1065,6 +1066,10 @@ extern void (*jack_info_callback)(const char *msg); | |||||
/** | /** | ||||
* Set the @ref jack_info_callback for info message display. | * Set the @ref jack_info_callback for info message display. | ||||
* Set it to NULL to restore default_jack_info_callback function. | |||||
* | |||||
* The JACK library provides two built-in callbacks for this purpose: | |||||
* default_jack_info_callback() and silent_jack_info_callback(). | |||||
*/ | */ | ||||
void jack_set_info_function (void (*func)(const char *)); | void jack_set_info_function (void (*func)(const char *)); | ||||
@@ -116,8 +116,8 @@ int jack_client_stop_thread(jack_client_t* client, pthread_t thread); | |||||
* @returns 0, if successful; otherwise an error number. | * @returns 0, if successful; otherwise an error number. | ||||
*/ | */ | ||||
int jack_client_kill_thread(jack_client_t* client, pthread_t thread); | int jack_client_kill_thread(jack_client_t* client, pthread_t thread); | ||||
#ifndef WIN32 | |||||
#ifndef WIN32 | |||||
typedef int (*jack_thread_creator_t)(pthread_t*, | typedef int (*jack_thread_creator_t)(pthread_t*, | ||||
const pthread_attr_t*, | const pthread_attr_t*, | ||||
@@ -137,11 +137,13 @@ int jack_client_stop_thread(jack_client_t* client, pthread_t thread); | |||||
* that all threads that might call win32 functions are known | * that all threads that might call win32 functions are known | ||||
* to Wine. | * to Wine. | ||||
* | * | ||||
* Set it to NULL to restore thread creation function. | |||||
* | |||||
* @param creator a function that creates a new thread | * @param creator a function that creates a new thread | ||||
* | * | ||||
*/ | */ | ||||
void jack_set_thread_creator (jack_thread_creator_t creator); | |||||
void jack_set_thread_creator (jack_thread_creator_t creator); | |||||
#endif | #endif | ||||
/* @} */ | /* @} */ | ||||
@@ -141,9 +141,6 @@ def build(bld): | |||||
'../posix/JackSocketServerNotifyChannel.cpp', | '../posix/JackSocketServerNotifyChannel.cpp', | ||||
'../posix/JackNetUnixSocket.cpp', | '../posix/JackNetUnixSocket.cpp', | ||||
] | ] | ||||
if bld.env['IS_LINUX'] and bld.env['BUILD_JACKDBUS']: | |||||
serverlib.source += ['../dbus/reserve.c', '../dbus/audio_reserve.c'] | |||||
if bld.env['IS_SUN']: | if bld.env['IS_SUN']: | ||||
serverlib.source += [ | serverlib.source += [ | ||||
@@ -1352,14 +1352,14 @@ jack_controller_dbus_disconnect_ports_by_id( | |||||
if (port1_ptr == NULL) | if (port1_ptr == NULL) | ||||
{ | { | ||||
jack_dbus_error(call, JACK_DBUS_ERROR_INVALID_ARGS, "cannot find port %" PRIu64, port1_id); | jack_dbus_error(call, JACK_DBUS_ERROR_INVALID_ARGS, "cannot find port %" PRIu64, port1_id); | ||||
return; | |||||
goto unlock; | |||||
} | } | ||||
port2_ptr = jack_controller_patchbay_find_port_by_id(patchbay_ptr, port2_id); | port2_ptr = jack_controller_patchbay_find_port_by_id(patchbay_ptr, port2_id); | ||||
if (port2_ptr == NULL) | if (port2_ptr == NULL) | ||||
{ | { | ||||
jack_dbus_error(call, JACK_DBUS_ERROR_INVALID_ARGS, "cannot find port %" PRIu64, port2_id); | jack_dbus_error(call, JACK_DBUS_ERROR_INVALID_ARGS, "cannot find port %" PRIu64, port2_id); | ||||
return; | |||||
goto unlock; | |||||
} | } | ||||
if (!jack_controller_patchbay_disconnect( | if (!jack_controller_patchbay_disconnect( | ||||
@@ -36,18 +36,24 @@ def build(bld): | |||||
jackd.target = 'jackd' | jackd.target = 'jackd' | ||||
create_jack_driver_obj(bld, 'dummy', '../common/JackDummyDriver.cpp') | create_jack_driver_obj(bld, 'dummy', '../common/JackDummyDriver.cpp') | ||||
alsa_driver_src = ['alsa/JackAlsaDriver.cpp', | |||||
'alsa/alsa_rawmidi.c', | |||||
'alsa/alsa_seqmidi.c', | |||||
'alsa/alsa_midi_jackmp.cpp', | |||||
'../common/memops.c', | |||||
'alsa/generic_hw.c', | |||||
'alsa/hdsp.c', | |||||
'alsa/hammerfall.c', | |||||
'alsa/ice1712.c' | |||||
] | |||||
if bld.env['BUILD_JACKDBUS']: | |||||
alsa_driver_src += ['../dbus/reserve.c', '../dbus/audio_reserve.c'] | |||||
if bld.env['BUILD_DRIVER_ALSA'] == True: | if bld.env['BUILD_DRIVER_ALSA'] == True: | ||||
create_jack_driver_obj(bld, 'alsa', ['alsa/JackAlsaDriver.cpp', | |||||
'alsa/alsa_rawmidi.c', | |||||
'alsa/alsa_seqmidi.c', | |||||
'alsa/alsa_midi_jackmp.cpp', | |||||
'../common/memops.c', | |||||
'alsa/generic_hw.c', | |||||
'alsa/hdsp.c', | |||||
'alsa/hammerfall.c', | |||||
'alsa/ice1712.c' | |||||
], "ALSA") | |||||
create_jack_driver_obj(bld, 'alsa', alsa_driver_src, "ALSA") | |||||
if bld.env['BUILD_DRIVER_FREEBOB'] == True: | if bld.env['BUILD_DRIVER_FREEBOB'] == True: | ||||
create_jack_driver_obj(bld, 'freebob', 'freebob/JackFreebobDriver.cpp', "LIBFREEBOB") | create_jack_driver_obj(bld, 'freebob', 'freebob/JackFreebobDriver.cpp', "LIBFREEBOB") | ||||
@@ -101,12 +101,16 @@ bool JackFifo::TimedWait(long usec) | |||||
// Does not work on OSX ?? | // Does not work on OSX ?? | ||||
bool JackFifo::TimedWait(long usec) | bool JackFifo::TimedWait(long usec) | ||||
{ | { | ||||
assert(fFifo >= 0); | |||||
if ((poll(&fPoll, 1, usec / 1000) < 0) && (errno != EINTR)) { | |||||
jack_error("JackFifo::TimedWait name = %s err = %s", fName, strerror(errno)); | |||||
int res; | |||||
if (fFifo < 0) { | |||||
jack_error("JackFifo::TimedWait name = %s already desallocated!!", fName); | |||||
return false; | return false; | ||||
} | } | ||||
do { | |||||
res = poll(&fPoll, 1, usec / 1000); | |||||
} while (res < 0 && errno == EINTR); | |||||
if (fPoll.revents & POLLIN) { | if (fPoll.revents & POLLIN) { | ||||
return Wait(); | return Wait(); | ||||
@@ -27,6 +27,8 @@ Copyright (C) 2004-2006 Grame | |||||
namespace Jack | namespace Jack | ||||
{ | { | ||||
class JackServer; | |||||
class JackClientPipeThread : public JackRunnableInterface | class JackClientPipeThread : public JackRunnableInterface | ||||
{ | { | ||||
@@ -61,15 +61,13 @@ def set_options(opt): | |||||
opt.tool_options('compiler_cc') | opt.tool_options('compiler_cc') | ||||
opt.add_option('--libdir', type='string', help="Library directory [Default: <prefix>/lib]") | opt.add_option('--libdir', type='string', help="Library directory [Default: <prefix>/lib]") | ||||
opt.add_option('--classic', action='store_true', default=False, help='Enable standard JACK (jackd)') | |||||
opt.add_option('--dbus', action='store_true', default=False, help='Enable D-Bus JACK (jackdbus)') | opt.add_option('--dbus', action='store_true', default=False, help='Enable D-Bus JACK (jackdbus)') | ||||
opt.add_option('--classic', action='store_true', default=False, help='Force enable standard JACK (jackd) even if D-Bus JACK (jackdbus) is enabled too') | |||||
opt.add_option('--doxygen', action='store_true', default=False, help='Enable build of doxygen documentation') | opt.add_option('--doxygen', action='store_true', default=False, help='Enable build of doxygen documentation') | ||||
opt.add_option('--profile', action='store_true', default=False, help='Build with engine profiling') | opt.add_option('--profile', action='store_true', default=False, help='Build with engine profiling') | ||||
opt.add_option('--mixed', action='store_true', default=False, help='Build with 32/64 bits mixed mode') | opt.add_option('--mixed', action='store_true', default=False, help='Build with 32/64 bits mixed mode') | ||||
opt.add_option('--clients', default=64, type="int", dest="clients", help='Maximum number of JACK clients') | opt.add_option('--clients', default=64, type="int", dest="clients", help='Maximum number of JACK clients') | ||||
opt.add_option('--ports', default=1024, type="int", dest="ports", help='Maximum number of ports') | opt.add_option('--ports', default=1024, type="int", dest="ports", help='Maximum number of ports') | ||||
opt.add_option('--clients', default=64, type="int", dest="clients", help='Maximum number of JACK clients') | |||||
opt.add_option('--ports', default=1024, type="int", dest="ports", help='Maximum number of ports') | |||||
opt.sub_options('dbus') | opt.sub_options('dbus') | ||||
def configure(conf): | def configure(conf): | ||||
@@ -124,7 +122,12 @@ def configure(conf): | |||||
conf.env['BUILD_WITH_PROFILE'] = Options.options.profile | conf.env['BUILD_WITH_PROFILE'] = Options.options.profile | ||||
conf.env['BUILD_WITH_32_64'] = Options.options.mixed | conf.env['BUILD_WITH_32_64'] = Options.options.mixed | ||||
conf.env['BUILD_JACKDBUS'] = Options.options.dbus | conf.env['BUILD_JACKDBUS'] = Options.options.dbus | ||||
conf.env['BUILD_JACKD'] = Options.options.classic | |||||
conf.env['BUILD_CLASSIC'] = Options.options.classic | |||||
if conf.env['BUILD_JACKDBUS']: | |||||
conf.env['BUILD_JACKD'] = conf.env['BUILD_CLASSIC'] | |||||
else: | |||||
conf.env['BUILD_JACKD'] = True | |||||
if Options.options.libdir: | if Options.options.libdir: | ||||
conf.env['LIBDIR'] = Options.options.libdir | conf.env['LIBDIR'] = Options.options.libdir | ||||
@@ -171,13 +174,12 @@ def configure(conf): | |||||
display_feature('Build doxygen documentation', conf.env['BUILD_DOXYGEN_DOCS']) | display_feature('Build doxygen documentation', conf.env['BUILD_DOXYGEN_DOCS']) | ||||
display_feature('Build with engine profiling', conf.env['BUILD_WITH_PROFILE']) | display_feature('Build with engine profiling', conf.env['BUILD_WITH_PROFILE']) | ||||
display_feature('Build with 32/64 bits mixed mode', conf.env['BUILD_WITH_32_64']) | display_feature('Build with 32/64 bits mixed mode', conf.env['BUILD_WITH_32_64']) | ||||
display_feature('Build standard JACK (jackd)', conf.env['BUILD_JACKD']) | |||||
display_feature('Build D-Bus JACK (jackdbus)', conf.env['BUILD_JACKDBUS']) | |||||
if conf.env['BUILD_JACKDBUS'] and conf.env['BUILD_JACKD']: | if conf.env['BUILD_JACKDBUS'] and conf.env['BUILD_JACKD']: | ||||
display_feature('Build standard (jackd) and D-Bus JACK (jackdbus) : WARNING !! mixing both program may cause issues...', True) | |||||
elif conf.env['BUILD_JACKDBUS']: | |||||
display_feature('Build D-Bus JACK (jackdbus)', True) | |||||
else: | |||||
conf.env['BUILD_JACKD'] = True; # jackd is always built be default | |||||
display_feature('Build standard JACK (jackd)', True) | |||||
print Logs.colors.RED + 'WARNING !! mixing both jackd and jackdbus may cause issues!' + Logs.colors.NORMAL | |||||
if conf.env['IS_LINUX']: | if conf.env['IS_LINUX']: | ||||
display_feature('Build with ALSA support', conf.env['BUILD_DRIVER_ALSA'] == True) | display_feature('Build with ALSA support', conf.env['BUILD_DRIVER_ALSA'] == True) | ||||