diff options
Diffstat (limited to 'src/engine/machina')
-rw-r--r-- | src/engine/machina/Driver.hpp | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/src/engine/machina/Driver.hpp b/src/engine/machina/Driver.hpp index 1fad9b3..f21bb07 100644 --- a/src/engine/machina/Driver.hpp +++ b/src/engine/machina/Driver.hpp @@ -19,6 +19,7 @@ #include <atomic> +#include "raul/DoubleBuffer.hpp" #include "raul/RingBuffer.hpp" #include "machina/types.hpp" @@ -36,6 +37,9 @@ public: : _forge(forge) , _machine(machine) , _play_state(PlayState::STOPPED) + , _bpm(120.0) + , _quantization(0.125) + , _quantize_record(0) {} enum class PlayState { @@ -59,9 +63,10 @@ public: _updates = b; } - virtual void set_bpm(double bpm) = 0; - virtual void set_quantization(double q) = 0; - virtual void set_play_state(PlayState state) = 0; + virtual void set_bpm(double bpm) { _bpm.set(bpm); } + virtual void set_quantization(double q) { _quantization.set(q); } + virtual void set_quantize_record(bool q) { _quantize_record = q; } + virtual void set_play_state(PlayState state) { _play_state = state; } virtual bool is_activated() const { return false; } virtual void activate() {} @@ -70,10 +75,13 @@ public: PlayState play_state() const { return _play_state.load(); } protected: - Raul::Forge& _forge; - SPtr<Machine> _machine; - SPtr<Raul::RingBuffer> _updates; - std::atomic<PlayState> _play_state; + Raul::Forge& _forge; + SPtr<Machine> _machine; + SPtr<Raul::RingBuffer> _updates; + std::atomic<PlayState> _play_state; + Raul::DoubleBuffer<double> _bpm; + Raul::DoubleBuffer<double> _quantization; + bool _quantize_record; }; } // namespace machina |