13
0

Add two utility methods to abstract PortAudioBackend state

These may change as support for callback API is added
This commit is contained in:
Tim Mayberry 2015-08-27 18:52:08 +10:00
parent f143d76523
commit 23a490c906
2 changed files with 18 additions and 4 deletions

View File

@ -433,16 +433,27 @@ static void * pthread_process (void *arg)
return 0;
}
bool
PortAudioBackend::engine_halted ()
{
return !_active && _run;
}
bool
PortAudioBackend::running ()
{
return _active || _run;
}
int
PortAudioBackend::_start (bool for_latency_measurement)
{
if (!_active && _run) {
// recover from 'halted', reap threads
if (engine_halted()) {
stop();
}
if (_active || _run) {
DEBUG_AUDIO("Already active.\n");
if (running()) {
DEBUG_AUDIO("Already started.\n");
return -1;
}

View File

@ -330,6 +330,9 @@ class PortAudioBackend : public AudioBackend {
void process_incoming_midi ();
void process_outgoing_midi ();
bool engine_halted ();
bool running ();
private:
std::string _instance_name;
PortAudioIO *_pcmio;