From f2ea059db3b8ea1e52616fc434971adf078340b3 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Sat, 24 Jan 2015 22:45:42 +0100 Subject: DummyBackend: sync switch to freewheeling --- libs/backends/dummy/dummy_audiobackend.cc | 12 +++++++----- libs/backends/dummy/dummy_audiobackend.h | 1 + 2 files changed, 8 insertions(+), 5 deletions(-) (limited to 'libs/backends') diff --git a/libs/backends/dummy/dummy_audiobackend.cc b/libs/backends/dummy/dummy_audiobackend.cc index ca9f590b76..2aa2f485b8 100644 --- a/libs/backends/dummy/dummy_audiobackend.cc +++ b/libs/backends/dummy/dummy_audiobackend.cc @@ -58,6 +58,7 @@ static int64_t _x_get_monotonic_usec() { DummyAudioBackend::DummyAudioBackend (AudioEngine& e, AudioBackendInfo& info) : AudioBackend (e, info) , _running (false) + , _freewheel (false) , _freewheeling (false) , _device ("") , _samplerate (48000) @@ -446,11 +447,7 @@ DummyAudioBackend::stop () int DummyAudioBackend::freewheel (bool onoff) { - if (onoff == _freewheeling) { - return 0; - } _freewheeling = onoff; - engine.freewheel_callback (onoff); return 0; } @@ -1157,6 +1154,11 @@ DummyAudioBackend::main_process_thread () clock1 = _x_get_monotonic_usec(); while (_running) { + if (_freewheeling != _freewheel) { + _freewheel = _freewheeling; + engine.freewheel_callback (_freewheel); + } + // re-set input buffers, generate on demand. for (std::vector::const_iterator it = _system_inputs.begin (); it != _system_inputs.end (); ++it) { (*it)->next_period(); @@ -1198,7 +1200,7 @@ DummyAudioBackend::main_process_thread () } } - if (!_freewheeling) { + if (!_freewheel) { const int64_t nomial_time = 1e6 * _samples_per_period / _samplerate; clock2 = _x_get_monotonic_usec(); #ifdef PLATFORM_WINDOWS diff --git a/libs/backends/dummy/dummy_audiobackend.h b/libs/backends/dummy/dummy_audiobackend.h index 417789e537..4f8aa89f60 100644 --- a/libs/backends/dummy/dummy_audiobackend.h +++ b/libs/backends/dummy/dummy_audiobackend.h @@ -377,6 +377,7 @@ class DummyAudioBackend : public AudioBackend { static std::vector _device_status; bool _running; + bool _freewheel; bool _freewheeling; std::string _device; -- cgit v1.2.3