diff options
Diffstat (limited to 'src/engine')
-rw-r--r-- | src/engine/JackDriver.cpp | 11 | ||||
-rw-r--r-- | src/engine/JackDriver.hpp | 4 |
2 files changed, 9 insertions, 6 deletions
diff --git a/src/engine/JackDriver.cpp b/src/engine/JackDriver.cpp index ca86111..018dd59 100644 --- a/src/engine/JackDriver.cpp +++ b/src/engine/JackDriver.cpp @@ -44,6 +44,8 @@ JackDriver::JackDriver(SharedPtr<Machine> machine) , _cycle_time(48000, MACHINA_PPQN, 120.0) , _bpm(120.0) , _quantization(0.0f) + , _stop(0) + , _stop_flag(false) , _record_dur(_frames_unit) // = 0 , _recording(0) , _is_activated(false) @@ -332,7 +334,7 @@ JackDriver::on_process(jack_nframes_t nframes) machine->set_sink(shared_from_this()); - if (_stop.pending()) + if (_stop_flag) machine->reset(_cycle_time.start_beats()); process_input(machine, _cycle_time); @@ -372,10 +374,10 @@ end: * we need to finalize it next cycle. */ _last_machine = machine; - if (_stop.pending()) { + if (_stop_flag) { _cycle_time.set_slice(TimeStamp(_frames_unit, 0, 0), TimeStamp(_frames_unit, 0, 0)); - _stop.finish(); + _stop_flag = false; } } @@ -386,7 +388,8 @@ JackDriver::stop() if (recording()) finish_record(); - _stop(); // waits + _stop_flag= true; + _stop.wait(); _machine->deactivate(); } diff --git a/src/engine/JackDriver.hpp b/src/engine/JackDriver.hpp index 133c7ed..f1d38b8 100644 --- a/src/engine/JackDriver.hpp +++ b/src/engine/JackDriver.hpp @@ -23,7 +23,6 @@ #include <jack/jack.h> #include <jack/midiport.h> -#include "raul/Command.hpp" #include "raul/DoubleBuffer.hpp" #include "raul/Semaphore.hpp" #include "raul/SharedPtr.hpp" @@ -113,7 +112,8 @@ private: Raul::DoubleBuffer<double> _bpm; Raul::DoubleBuffer<double> _quantization; - Raul::Command _stop; + Raul::Semaphore _stop; + bool _stop_flag; Raul::TimeDuration _record_dur; Raul::AtomicInt _recording; |