From d88a8a0a01baff2c4038c315672c6c670361b82c Mon Sep 17 00:00:00 2001 From: David Robillard Date: Fri, 11 Jan 2013 03:35:17 +0000 Subject: Use C++11 atomics. git-svn-id: http://svn.drobilla.net/lad/trunk/machina@4916 a436a847-0d15-0410-975c-d299462d15a1 --- src/engine/JackDriver.cpp | 8 ++++---- src/engine/JackDriver.hpp | 4 +++- src/engine/MidiAction.hpp | 9 +++++---- 3 files changed, 12 insertions(+), 9 deletions(-) (limited to 'src/engine') 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) , _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, 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(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 = _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 + #include #include @@ -115,7 +117,7 @@ private: bool _stop_flag; Raul::TimeDuration _record_dur; - Raul::AtomicInt _recording; + std::atomic _recording; SharedPtr _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 + #include "raul/TimeSlice.hpp" #include "machina/types.hpp" @@ -47,9 +48,9 @@ public: private: - size_t _size; - const size_t _max_size; - Raul::AtomicPtr _event; + size_t _size; + const size_t _max_size; + std::atomic _event; }; } // namespace Machina -- cgit v1.2.1