mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-16 11:46:25 +01:00
Refactor port change handling part of PA Backend process function into new method
This commit is contained in:
parent
684701427e
commit
7b23f80b03
2 changed files with 35 additions and 29 deletions
|
|
@ -1601,6 +1601,24 @@ PortAudioBackend::main_blocking_process_thread ()
|
||||||
Glib::usleep (100); // don't hog cpu
|
Glib::usleep (100); // don't hog cpu
|
||||||
}
|
}
|
||||||
|
|
||||||
|
process_port_connection_changes();
|
||||||
|
}
|
||||||
|
_pcmio->close_stream();
|
||||||
|
_active = false;
|
||||||
|
if (_run) {
|
||||||
|
engine.halted_callback(get_error_string(AudioDeviceIOError).c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef USE_MMCSS_THREAD_PRIORITIES
|
||||||
|
mmcss::revert_thread_characteristics (task_handle);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
PortAudioBackend::process_port_connection_changes ()
|
||||||
|
{
|
||||||
bool connections_changed = false;
|
bool connections_changed = false;
|
||||||
bool ports_changed = false;
|
bool ports_changed = false;
|
||||||
if (!pthread_mutex_trylock (&_port_callback_mutex)) {
|
if (!pthread_mutex_trylock (&_port_callback_mutex)) {
|
||||||
|
|
@ -1629,21 +1647,7 @@ PortAudioBackend::main_blocking_process_thread ()
|
||||||
engine.latency_callback(false);
|
engine.latency_callback(false);
|
||||||
engine.latency_callback(true);
|
engine.latency_callback(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
_pcmio->close_stream();
|
|
||||||
_active = false;
|
|
||||||
if (_run) {
|
|
||||||
engine.halted_callback(get_error_string(AudioDeviceIOError).c_str());
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef USE_MMCSS_THREAD_PRIORITIES
|
|
||||||
mmcss::revert_thread_characteristics (task_handle);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -323,6 +323,8 @@ class PortAudioBackend : public AudioBackend {
|
||||||
bool start_blocking_process_thread ();
|
bool start_blocking_process_thread ();
|
||||||
bool stop_blocking_process_thread ();
|
bool stop_blocking_process_thread ();
|
||||||
|
|
||||||
|
void process_port_connection_changes ();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::string _instance_name;
|
std::string _instance_name;
|
||||||
PortAudioIO *_pcmio;
|
PortAudioIO *_pcmio;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue