diff options
author | David Robillard <d@drobilla.net> | 2013-02-03 16:30:35 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2013-02-03 16:30:35 +0000 |
commit | e9935704f8b035045d05b912f4f038bfff83a6c6 (patch) | |
tree | 8db60fe7d8c25cde8d070dcdfcedc0f91805b0fc /src/engine | |
parent | d9a7d225e4dd7c4736a834d8d6beaee38e10663f (diff) | |
download | machina-e9935704f8b035045d05b912f4f038bfff83a6c6.tar.gz machina-e9935704f8b035045d05b912f4f038bfff83a6c6.tar.bz2 machina-e9935704f8b035045d05b912f4f038bfff83a6c6.zip |
Fix compilation with GCC 4.6.
git-svn-id: http://svn.drobilla.net/lad/trunk/machina@5038 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/engine')
-rw-r--r-- | src/engine/Edge.cpp | 4 | ||||
-rw-r--r-- | src/engine/Edge.hpp | 13 | ||||
-rw-r--r-- | src/engine/JackDriver.cpp | 6 | ||||
-rw-r--r-- | src/engine/JackDriver.hpp | 2 | ||||
-rw-r--r-- | src/engine/machina/Driver.hpp | 23 | ||||
-rw-r--r-- | src/engine/machina/types.hpp | 5 |
6 files changed, 25 insertions, 28 deletions
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<float>()); + _probability = value.get<float>(); } } @@ -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 <list> -#include "raul/DoubleBuffer.hpp" - #include "machina/types.hpp" #include "Action.hpp" @@ -34,9 +32,9 @@ class Edge : public Stateful { public: Edge(WPtr<Node> tail, SPtr<Node> 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<Node> tail) { _tail = tail; } void set_head(SPtr<Node> 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<float> _probability; - WPtr<Node> _tail; SPtr<Node> _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> machine, const SPtr<LearnRequest> 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 <atomic> - #include <jack/jack.h> #include <jack/midiport.h> 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 <atomic> - -#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> _machine; - SPtr<Raul::RingBuffer> _updates; - std::atomic<PlayState> _play_state; - Raul::DoubleBuffer<double> _bpm; - Raul::DoubleBuffer<double> _quantization; - bool _quantize_record; + Raul::Forge& _forge; + SPtr<Machine> _machine; + SPtr<Raul::RingBuffer> _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 <class T> using SPtr = std::shared_ptr<T>; template <class T> using WPtr = std::weak_ptr<T>; +#else +#define SPtr std::shared_ptr +#define WPtr std::weak_ptr +#endif template <class T> void NullDeleter(T* ptr) {} |