aboutsummaryrefslogtreecommitdiffstats
path: root/src/engine/machina
diff options
context:
space:
mode:
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;