aboutsummaryrefslogtreecommitdiffstats
path: root/src/engine/machina
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2013-01-11 22:15:55 +0000
committerDavid Robillard <d@drobilla.net>2013-01-11 22:15:55 +0000
commit6c61c79d43d1d4715ce04b46e459279d0fa6c854 (patch)
tree6193c4f634494260b33190dbdf1cf4cb440d19be /src/engine/machina
parent5df770bf97b1cc7ac1c73e68fb617164f662d7b7 (diff)
downloadmachina-6c61c79d43d1d4715ce04b46e459279d0fa6c854.tar.gz
machina-6c61c79d43d1d4715ce04b46e459279d0fa6c854.tar.bz2
machina-6c61c79d43d1d4715ce04b46e459279d0fa6c854.zip
Move MIDISink from Machine state to Context parameter.
git-svn-id: http://svn.drobilla.net/lad/trunk/machina@4925 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/engine/machina')
-rw-r--r--src/engine/machina/Context.hpp7
-rw-r--r--src/engine/machina/Machine.hpp9
2 files changed, 10 insertions, 6 deletions
diff --git a/src/engine/machina/Context.hpp b/src/engine/machina/Context.hpp
index 270ede7..c863cc4 100644
--- a/src/engine/machina/Context.hpp
+++ b/src/engine/machina/Context.hpp
@@ -19,10 +19,13 @@
#define MACHINA_CONTEXT_HPP
#include "raul/Atom.hpp"
+#include "raul/SharedPtr.hpp"
#include "raul/TimeSlice.hpp"
namespace Machina {
+class MIDISink;
+
class Context {
public:
Context(Raul::Forge& forge, uint32_t rate, uint32_t ppqn, double bpm)
@@ -30,13 +33,17 @@ public:
, _time(rate, ppqn, bpm)
{}
+ void set_sink(MIDISink* sink) { _sink = sink; }
+
Raul::Forge& forge() { return _forge; }
const Raul::TimeSlice& time() const { return _time; }
Raul::TimeSlice& time() { return _time; }
+ MIDISink* sink() { return _sink; }
private:
Raul::Forge& _forge;
Raul::TimeSlice _time;
+ MIDISink* _sink;
};
} // namespace Machina
diff --git a/src/engine/machina/Machine.hpp b/src/engine/machina/Machine.hpp
index 6691b43..164c2e4 100644
--- a/src/engine/machina/Machine.hpp
+++ b/src/engine/machina/Machine.hpp
@@ -66,7 +66,7 @@ public:
void write_state(Sord::Model& model);
// Audio context
- void reset(Raul::TimeStamp time);
+ void reset(MIDISink* sink, Raul::TimeStamp time);
uint32_t run(Context& context, SharedPtr<UpdateBuffer> updates);
// Any context
@@ -82,19 +82,16 @@ public:
SharedPtr<Node> random_node();
SharedPtr<Edge> random_edge();
- void set_sink(SharedPtr<MIDISink> sink);
-
private:
// Audio context
SharedPtr<Node> earliest_node() const;
- bool enter_node(Context& context, SharedPtr<MIDISink> sink, SharedPtr<Node> node, SharedPtr<UpdateBuffer> updates);
- void exit_node(Context& context, SharedPtr<MIDISink> sink, SharedPtr<Node>, SharedPtr<UpdateBuffer> updates);
+ bool enter_node(Context& context, SharedPtr<Node> node, SharedPtr<UpdateBuffer> updates);
+ void exit_node(Context& context, SharedPtr<Node> node, SharedPtr<UpdateBuffer> updates);
static const size_t MAX_ACTIVE_NODES = 128;
std::vector< SharedPtr<Node> > _active_nodes;
SharedPtr<LearnRequest> _pending_learn;
- WeakPtr<MIDISink> _sink;
Nodes _nodes;
Raul::TimeStamp _time;
bool _is_activated;