mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-14 18:46:34 +01:00
Clean up b5e479df and expose API to queue latency-updates
This commit is contained in:
parent
b5e479dfc3
commit
1796ee60b2
2 changed files with 33 additions and 23 deletions
|
|
@ -210,8 +210,7 @@ class LIBARDOUR_API AudioEngine : public PortManager, public SessionHandlePtr
|
||||||
static void destroy();
|
static void destroy();
|
||||||
void died ();
|
void died ();
|
||||||
|
|
||||||
/* The backend will cause these at the appropriate time(s)
|
/* The backend will cause these at the appropriate time(s) */
|
||||||
*/
|
|
||||||
int process_callback (pframes_t nframes);
|
int process_callback (pframes_t nframes);
|
||||||
int buffer_size_change (pframes_t nframes);
|
int buffer_size_change (pframes_t nframes);
|
||||||
int sample_rate_change (pframes_t nframes);
|
int sample_rate_change (pframes_t nframes);
|
||||||
|
|
@ -259,6 +258,7 @@ class LIBARDOUR_API AudioEngine : public PortManager, public SessionHandlePtr
|
||||||
void reset_silence_countdown ();
|
void reset_silence_countdown ();
|
||||||
|
|
||||||
void add_pending_port_deletion (Port*);
|
void add_pending_port_deletion (Port*);
|
||||||
|
void queue_latency_update (bool);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
AudioEngine ();
|
AudioEngine ();
|
||||||
|
|
|
||||||
|
|
@ -1416,27 +1416,37 @@ void
|
||||||
AudioEngine::latency_callback (bool for_playback)
|
AudioEngine::latency_callback (bool for_playback)
|
||||||
{
|
{
|
||||||
DEBUG_TRACE (DEBUG::BackendCallbacks, string_compose (X_("latency callback playback ? %1\n"), for_playback));
|
DEBUG_TRACE (DEBUG::BackendCallbacks, string_compose (X_("latency callback playback ? %1\n"), for_playback));
|
||||||
if (_session) {
|
if (!_session) {
|
||||||
if (in_process_thread ()) {
|
return;
|
||||||
/* internal backends emit the latency callback in the rt-callback,
|
}
|
||||||
* async to connect/disconnect or port creation/deletion.
|
|
||||||
* All is fine.
|
if (in_process_thread ()) {
|
||||||
*
|
/* internal backends emit the latency callback in the rt-callback,
|
||||||
* However jack 1/2 emit the callback in sync with creating the port
|
* async to connect/disconnect or port creation/deletion.
|
||||||
* (or while handling the connection change).
|
* All is fine.
|
||||||
* e.g. JACK2 jack_port_register() blocks and the jack_latency_callback
|
*/
|
||||||
* from a different thread: https://pastebin.com/mitGBwpq
|
_session->update_latency (for_playback);
|
||||||
* but at this point in time Ardour still holds the process callback
|
} else {
|
||||||
* because JACK2 can process in parallel to latency callbacks.
|
/* However jack 1/2 emit the callback in sync with creating the port
|
||||||
*
|
* (or while handling the connection change).
|
||||||
* see also Session::update_latency() and git-ref 1983f56592dfea5f7498
|
* e.g. JACK2 jack_port_register() blocks and the jack_latency_callback
|
||||||
*/
|
* from a different thread: https://pastebin.com/mitGBwpq
|
||||||
_session->update_latency (for_playback);
|
* but at this point in time Ardour still holds the process callback
|
||||||
} else if (for_playback) {
|
* because JACK2 can process in parallel to latency callbacks.
|
||||||
g_atomic_int_set (&_pending_playback_latency_callback, 1);
|
*
|
||||||
} else {
|
* see also Session::update_latency() and git-ref 1983f56592dfea5f7498
|
||||||
g_atomic_int_set (&_pending_capture_latency_callback, 1);
|
*/
|
||||||
}
|
queue_latency_update (for_playback);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
AudioEngine::queue_latency_update (bool for_playback)
|
||||||
|
{
|
||||||
|
if (for_playback) {
|
||||||
|
g_atomic_int_set (&_pending_playback_latency_callback, 1);
|
||||||
|
} else {
|
||||||
|
g_atomic_int_set (&_pending_capture_latency_callback, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue