From e9935704f8b035045d05b912f4f038bfff83a6c6 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sun, 3 Feb 2013 16:30:35 +0000 Subject: Fix compilation with GCC 4.6. git-svn-id: http://svn.drobilla.net/lad/trunk/machina@5038 a436a847-0d15-0410-975c-d299462d15a1 --- src/engine/Edge.cpp | 4 ++-- src/engine/Edge.hpp | 13 +++++-------- src/engine/JackDriver.cpp | 6 +++--- src/engine/JackDriver.hpp | 2 -- src/engine/machina/Driver.hpp | 23 ++++++++++------------- src/engine/machina/types.hpp | 5 +++++ 6 files changed, 25 insertions(+), 28 deletions(-) (limited to 'src/engine') diff --git a/src/engine/Edge.cpp b/src/engine/Edge.cpp index d1f8240..cb2441d 100644 --- a/src/engine/Edge.cpp +++ b/src/engine/Edge.cpp @@ -28,7 +28,7 @@ void Edge::set(URIInt key, const Raul::Atom& value) { if (key == URIs::instance().machina_probability) { - _probability.set(value.get()); + _probability = value.get(); } } @@ -59,7 +59,7 @@ Edge::write_state(Sord::Model& model) model.add_statement( rdf_id, Sord::URI(model.world(), MACHINA_NS_probability), - Sord::Literal::decimal(model.world(), _probability.get(), 7)); + Sord::Literal::decimal(model.world(), _probability, 7)); } } // namespace machina diff --git a/src/engine/Edge.hpp b/src/engine/Edge.hpp index e2ddb98..7795854 100644 --- a/src/engine/Edge.hpp +++ b/src/engine/Edge.hpp @@ -19,8 +19,6 @@ #include -#include "raul/DoubleBuffer.hpp" - #include "machina/types.hpp" #include "Action.hpp" @@ -34,9 +32,9 @@ class Edge : public Stateful { public: Edge(WPtr tail, SPtr head, float probability=1.0f) - : _probability(probability) - , _tail(tail) + : _tail(tail) , _head(head) + , _probability(probability) {} void set(URIInt key, const Raul::Atom& value); @@ -48,14 +46,13 @@ public: void set_tail(WPtr tail) { _tail = tail; } void set_head(SPtr head) { _head = head; } - inline float probability() { return _probability.get(); } - inline void set_probability(float p) { _probability.set(p); } + inline float probability() const { return _probability; } + inline void set_probability(float p) { _probability = p; } private: - Raul::DoubleBuffer _probability; - WPtr _tail; SPtr _head; + float _probability; }; } // namespace machina diff --git a/src/engine/JackDriver.cpp b/src/engine/JackDriver.cpp index 2bf24de..27d295c 100644 --- a/src/engine/JackDriver.cpp +++ b/src/engine/JackDriver.cpp @@ -212,7 +212,7 @@ JackDriver::read_input_playing(SPtr machine, const SPtr learn = machine->pending_learn(); if (learn) { learn->enter_action()->set_event(ev.size, ev.buffer); - learn->start(_quantization.get(), + learn->start(_quantization, TimeStamp(TimeUnit::frames(sample_rate()), jack_last_frame_time(_client) + ev.time, 0)); @@ -304,7 +304,7 @@ JackDriver::on_process(jack_nframes_t nframes) return; } - _context.time().set_bpm(_bpm.get()); + _context.time().set_bpm(_bpm); assert(_output_port); jack_midi_clear_buffer(jack_port_get_buffer(_output_port, nframes)); @@ -431,7 +431,7 @@ JackDriver::set_play_state(PlayState state) void JackDriver::start_record(bool step) { - const double q = (step || _quantize_record) ? _quantization.get() : 0.0; + const double q = (step || _quantize_record) ? _quantization : 0.0; switch (_play_state) { case PlayState::STOPPED: case PlayState::PLAYING: diff --git a/src/engine/JackDriver.hpp b/src/engine/JackDriver.hpp index a67afbc..fefb744 100644 --- a/src/engine/JackDriver.hpp +++ b/src/engine/JackDriver.hpp @@ -17,8 +17,6 @@ #ifndef MACHINA_JACKDRIVER_HPP #define MACHINA_JACKDRIVER_HPP -#include - #include #include diff --git a/src/engine/machina/Driver.hpp b/src/engine/machina/Driver.hpp index f21bb07..d913741 100644 --- a/src/engine/machina/Driver.hpp +++ b/src/engine/machina/Driver.hpp @@ -17,9 +17,6 @@ #ifndef MACHINA_DRIVER_HPP #define MACHINA_DRIVER_HPP -#include - -#include "raul/DoubleBuffer.hpp" #include "raul/RingBuffer.hpp" #include "machina/types.hpp" @@ -63,8 +60,8 @@ public: _updates = b; } - virtual void set_bpm(double bpm) { _bpm.set(bpm); } - virtual void set_quantization(double q) { _quantization.set(q); } + virtual void set_bpm(double bpm) { _bpm = bpm; } + virtual void set_quantization(double q) { _quantization = q; } virtual void set_quantize_record(bool q) { _quantize_record = q; } virtual void set_play_state(PlayState state) { _play_state = state; } @@ -72,16 +69,16 @@ public: virtual void activate() {} virtual void deactivate() {} - PlayState play_state() const { return _play_state.load(); } + PlayState play_state() const { return _play_state; } protected: - Raul::Forge& _forge; - SPtr _machine; - SPtr _updates; - std::atomic _play_state; - Raul::DoubleBuffer _bpm; - Raul::DoubleBuffer _quantization; - bool _quantize_record; + Raul::Forge& _forge; + SPtr _machine; + SPtr _updates; + PlayState _play_state; + double _bpm; + double _quantization; + bool _quantize_record; }; } // namespace machina diff --git a/src/engine/machina/types.hpp b/src/engine/machina/types.hpp index 38cd29c..fff2601 100644 --- a/src/engine/machina/types.hpp +++ b/src/engine/machina/types.hpp @@ -27,11 +27,16 @@ typedef unsigned char byte; typedef uint32_t URIInt; +#if __cplusplus >= 201103L template using SPtr = std::shared_ptr; template using WPtr = std::weak_ptr; +#else +#define SPtr std::shared_ptr +#define WPtr std::weak_ptr +#endif template void NullDeleter(T* ptr) {} -- cgit v1.2.1