Mercurial > hg > sonic-visualiser
comparison audioio/AudioJACKTarget.cpp @ 41:fbd7a497fd89
* Audition effects plugins during playback
author | Chris Cannam |
---|---|
date | Wed, 04 Oct 2006 11:01:39 +0000 |
parents | 42a78f0e8fe2 |
children | c0ae41c72421 |
comparison
equal
deleted
inserted
replaced
40:75c5951cf9d7 | 41:fbd7a497fd89 |
---|---|
76 if (!s) return 1; | 76 if (!s) return 1; |
77 func f = (func)s; | 77 func f = (func)s; |
78 return f(client, process_callback, arg); | 78 return f(client, process_callback, arg); |
79 } | 79 } |
80 | 80 |
81 static int dynamic_jack_set_xrun_callback(jack_client_t *client, | |
82 JackXRunCallback xrun_callback, | |
83 void *arg) | |
84 { | |
85 typedef int (*func)(jack_client_t *client, | |
86 JackXRunCallback xrun_callback, | |
87 void *arg); | |
88 void *s = symbol("jack_set_xrun_callback"); | |
89 if (!s) return 1; | |
90 func f = (func)s; | |
91 return f(client, xrun_callback, arg); | |
92 } | |
93 | |
81 static const char **dynamic_jack_get_ports(jack_client_t *client, | 94 static const char **dynamic_jack_get_ports(jack_client_t *client, |
82 const char *port_name_pattern, | 95 const char *port_name_pattern, |
83 const char *type_name_pattern, | 96 const char *type_name_pattern, |
84 unsigned long flags) | 97 unsigned long flags) |
85 { | 98 { |
163 | 176 |
164 #define jack_client_new dynamic_jack_client_new | 177 #define jack_client_new dynamic_jack_client_new |
165 #define jack_get_buffer_size dynamic_jack_get_buffer_size | 178 #define jack_get_buffer_size dynamic_jack_get_buffer_size |
166 #define jack_get_sample_rate dynamic_jack_get_sample_rate | 179 #define jack_get_sample_rate dynamic_jack_get_sample_rate |
167 #define jack_set_process_callback dynamic_jack_set_process_callback | 180 #define jack_set_process_callback dynamic_jack_set_process_callback |
181 #define jack_set_xrun_callback dynamic_jack_set_xrun_callback | |
168 #define jack_activate dynamic_jack_activate | 182 #define jack_activate dynamic_jack_activate |
169 #define jack_deactivate dynamic_jack_deactivate | 183 #define jack_deactivate dynamic_jack_deactivate |
170 #define jack_client_close dynamic_jack_client_close | 184 #define jack_client_close dynamic_jack_client_close |
171 #define jack_get_ports dynamic_jack_get_ports | 185 #define jack_get_ports dynamic_jack_get_ports |
172 #define jack_port_register dynamic_jack_port_register | 186 #define jack_port_register dynamic_jack_port_register |
202 if (!m_client) return; | 216 if (!m_client) return; |
203 | 217 |
204 m_bufferSize = jack_get_buffer_size(m_client); | 218 m_bufferSize = jack_get_buffer_size(m_client); |
205 m_sampleRate = jack_get_sample_rate(m_client); | 219 m_sampleRate = jack_get_sample_rate(m_client); |
206 | 220 |
221 jack_set_xrun_callback(m_client, xrunStatic, this); | |
207 jack_set_process_callback(m_client, processStatic, this); | 222 jack_set_process_callback(m_client, processStatic, this); |
208 | 223 |
209 if (jack_activate(m_client)) { | 224 if (jack_activate(m_client)) { |
210 std::cerr << "ERROR: AudioJACKTarget: Failed to activate JACK client" | 225 std::cerr << "ERROR: AudioJACKTarget: Failed to activate JACK client" |
211 << std::endl; | 226 << std::endl; |
232 | 247 |
233 int | 248 int |
234 AudioJACKTarget::processStatic(jack_nframes_t nframes, void *arg) | 249 AudioJACKTarget::processStatic(jack_nframes_t nframes, void *arg) |
235 { | 250 { |
236 return ((AudioJACKTarget *)arg)->process(nframes); | 251 return ((AudioJACKTarget *)arg)->process(nframes); |
252 } | |
253 | |
254 int | |
255 AudioJACKTarget::xrunStatic(void *arg) | |
256 { | |
257 return ((AudioJACKTarget *)arg)->xrun(); | |
237 } | 258 } |
238 | 259 |
239 void | 260 void |
240 AudioJACKTarget::sourceModelReplaced() | 261 AudioJACKTarget::sourceModelReplaced() |
241 { | 262 { |
363 | 384 |
364 m_mutex.unlock(); | 385 m_mutex.unlock(); |
365 return 0; | 386 return 0; |
366 } | 387 } |
367 | 388 |
389 int | |
390 AudioJACKTarget::xrun() | |
391 { | |
392 std::cerr << "AudioJACKTarget: xrun!" << std::endl; | |
393 } | |
368 | 394 |
369 #ifdef INCLUDE_MOCFILES | 395 #ifdef INCLUDE_MOCFILES |
370 #include "AudioJACKTarget.moc.cpp" | 396 #include "AudioJACKTarget.moc.cpp" |
371 #endif | 397 #endif |
372 | 398 |