diff options
author | David Robillard <d@drobilla.net> | 2013-01-11 03:35:17 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2013-01-11 03:35:17 +0000 |
commit | d88a8a0a01baff2c4038c315672c6c670361b82c (patch) | |
tree | 7e8ba0eeac7a2859b4ff2cc80e7b928ce9fee0eb /src | |
parent | d042196133a6854beaff64f37753af7bc5755092 (diff) | |
download | machina-d88a8a0a01baff2c4038c315672c6c670361b82c.tar.gz machina-d88a8a0a01baff2c4038c315672c6c670361b82c.tar.bz2 machina-d88a8a0a01baff2c4038c315672c6c670361b82c.zip |
Use C++11 atomics.
git-svn-id: http://svn.drobilla.net/lad/trunk/machina@4916 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src')
-rw-r--r-- | src/engine/JackDriver.cpp | 8 | ||||
-rw-r--r-- | src/engine/JackDriver.hpp | 4 | ||||
-rw-r--r-- | src/engine/MidiAction.hpp | 9 |
3 files changed, 12 insertions, 9 deletions
diff --git a/src/engine/JackDriver.cpp b/src/engine/JackDriver.cpp index 0d6b945..2775dcc 100644 --- a/src/engine/JackDriver.cpp +++ b/src/engine/JackDriver.cpp @@ -46,7 +46,7 @@ JackDriver::JackDriver(SharedPtr<Machine> machine) , _stop(0) , _stop_flag(false) , _record_dur(_frames_unit) // = 0 - , _recording(0) + , _recording(false) , _is_activated(false) { } @@ -168,7 +168,7 @@ JackDriver::process_input(SharedPtr<Machine> machine, const TimeSlice& time) //assert(time.offset_ticks().is_zero()); assert(_input_port); - if (_recording.get()) { + if (_recording) { const jack_nframes_t nframes = time.length_ticks().ticks(); void* jack_buffer = jack_port_get_buffer(_input_port, nframes); @@ -389,13 +389,13 @@ JackDriver::start_record(bool step) _recorder = SharedPtr<Recorder>(new Recorder(1024, _beats_unit, _quantization.get(), step)); _recorder->start(); _record_dur = 0; - _recording = 1; + _recording = true; } void JackDriver::finish_record() { - _recording = 0; + _recording = false; SharedPtr<Machine> machine = _recorder->finish(); _recorder.reset(); machine->activate(); diff --git a/src/engine/JackDriver.hpp b/src/engine/JackDriver.hpp index cfdd0d6..f1eb80c 100644 --- a/src/engine/JackDriver.hpp +++ b/src/engine/JackDriver.hpp @@ -18,6 +18,8 @@ #ifndef MACHINA_JACKDRIVER_HPP #define MACHINA_JACKDRIVER_HPP +#include <atomic> + #include <boost/enable_shared_from_this.hpp> #include <jack/jack.h> @@ -115,7 +117,7 @@ private: bool _stop_flag; Raul::TimeDuration _record_dur; - Raul::AtomicInt _recording; + std::atomic<bool> _recording; SharedPtr<Recorder> _recorder; bool _is_activated; }; diff --git a/src/engine/MidiAction.hpp b/src/engine/MidiAction.hpp index a2d8dda..729ac59 100644 --- a/src/engine/MidiAction.hpp +++ b/src/engine/MidiAction.hpp @@ -18,7 +18,8 @@ #ifndef MACHINA_MIDIACTION_HPP #define MACHINA_MIDIACTION_HPP -#include "raul/AtomicPtr.hpp" +#include <atomic> + #include "raul/TimeSlice.hpp" #include "machina/types.hpp" @@ -47,9 +48,9 @@ public: private: - size_t _size; - const size_t _max_size; - Raul::AtomicPtr<byte> _event; + size_t _size; + const size_t _max_size; + std::atomic<byte*> _event; }; } // namespace Machina |