Mercurial > hg > svapp
changeset 56:75ad3f8f65aa
* use jack_client_open
author | Chris Cannam |
---|---|
date | Thu, 08 Nov 2007 16:14:32 +0000 |
parents | 9fa273598830 |
children | eb596ef12041 |
files | audioio/AudioJACKTarget.cpp |
diffstat | 1 files changed, 24 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/audioio/AudioJACKTarget.cpp Wed Nov 07 16:37:17 2007 +0000 +++ b/audioio/AudioJACKTarget.cpp Thu Nov 08 16:14:32 2007 +0000 @@ -65,6 +65,19 @@ return symbol; } +static jack_client_t *dynamic_jack_client_open(const char *client_name, + jack_options_t options, + jack_status_t *status, ...) +{ + typedef jack_client_t (*func)(const char *client_name, + jack_options_t options, + jack_status_t *status, ...); + void *s = symbol("jack_client_open"); + if (!s) return 0; + func f = (func)s; + return f(client_name, options, status); // varargs not supported here +} + static int dynamic_jack_set_process_callback(jack_client_t *client, JackProcessCallback process_callback, void *arg) @@ -175,6 +188,7 @@ dynamic1(const char *, jack_port_name, const jack_port_t *, 0); #define jack_client_new dynamic_jack_client_new +#define jack_client_open dynamic_jack_client_open #define jack_get_buffer_size dynamic_jack_get_buffer_size #define jack_get_sample_rate dynamic_jack_get_sample_rate #define jack_set_process_callback dynamic_jack_set_process_callback @@ -199,22 +213,20 @@ m_bufferSize(0), m_sampleRate(0) { - char name[100]; - strcpy(name, "Sonic Visualiser"); - m_client = jack_client_new(name); + JackOptions options = JackNullOption; +#ifdef HAVE_PORTAUDIO + options = JackNoStartServer; +#endif + + JackStatus status = JackStatus(0); + m_client = jack_client_open("Sonic Visualiser", options, &status); if (!m_client) { - sprintf(name, "Sonic Visualiser (%d)", (int)getpid()); - m_client = jack_client_new(name); - if (!m_client) { - std::cerr - << "ERROR: AudioJACKTarget: Failed to connect to JACK server" - << std::endl; - } + std::cerr << "AudioJACKTarget: Failed to connect to JACK server: status code " + << status << std::endl; + return; } - if (!m_client) return; - m_bufferSize = jack_get_buffer_size(m_client); m_sampleRate = jack_get_sample_rate(m_client);