From f9c827a15fda4a0ce2ca3cfdc64ec1448385f149 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sun, 25 Mar 2007 03:01:32 +0000 Subject: Added node properties window. Improved learning algorithm. git-svn-id: http://svn.drobilla.net/lad/machina@375 a436a847-0d15-0410-975c-d299462d15a1 --- src/engine/machina/Machine.hpp | 1 + src/engine/machina/Node.hpp | 14 +++++++------- src/engine/machina/SMFDriver.hpp | 7 +++++++ 3 files changed, 15 insertions(+), 7 deletions(-) (limited to 'src/engine/machina') diff --git a/src/engine/machina/Machine.hpp b/src/engine/machina/Machine.hpp index b8e371d..e5bef23 100644 --- a/src/engine/machina/Machine.hpp +++ b/src/engine/machina/Machine.hpp @@ -43,6 +43,7 @@ public: bool is_finished() { return _is_finished; } void add_node(SharedPtr node); + void remove_node(SharedPtr node); void learn(SharedPtr learn); void write_state(Raul::RDFWriter& writer); diff --git a/src/engine/machina/Node.hpp b/src/engine/machina/Node.hpp index 2f9c2e4..5181149 100644 --- a/src/engine/machina/Node.hpp +++ b/src/engine/machina/Node.hpp @@ -46,11 +46,11 @@ public: Node(BeatCount duration=0, bool initial=false); - void add_enter_action(SharedPtr action); - void remove_enter_action(SharedPtr action); + void set_enter_action(SharedPtr action); + void remove_enter_action(); - void add_exit_action(SharedPtr action); - void remove_exit_action(SharedPtr action); + void set_exit_action(SharedPtr action); + void remove_exit_action(); SharedPtr enter_action() { return _enter_action; } SharedPtr exit_action() { return _exit_action; } @@ -67,13 +67,13 @@ public: bool is_initial() const { return _is_initial; } void set_initial(bool i) { _is_initial = i; } bool is_active() const { return _is_active; } - BeatTime enter_time() const { return _enter_time; } - BeatTime exit_time() const { return _enter_time + _duration; } + BeatTime enter_time() const { assert(_is_active); return _enter_time; } + BeatTime exit_time() const { assert(_is_active); return _enter_time + _duration; } BeatCount duration() { return _duration; } void set_duration(BeatCount d) { _duration = d; } typedef Raul::List > Edges; - const Edges& outgoing_edges() const { return _outgoing_edges; } + Edges& outgoing_edges() { return _outgoing_edges; } private: bool _is_initial; diff --git a/src/engine/machina/SMFDriver.hpp b/src/engine/machina/SMFDriver.hpp index 090eb02..7fec256 100644 --- a/src/engine/machina/SMFDriver.hpp +++ b/src/engine/machina/SMFDriver.hpp @@ -55,6 +55,13 @@ public: private: SharedPtr _writer; + bool is_delay_node(SharedPtr node) const; + + SharedPtr + connect_nodes(SharedPtr m, + SharedPtr tail, Raul::BeatTime tail_end_time, + SharedPtr head, Raul::BeatTime head_start_time); + void learn_track(SharedPtr machine, Raul::SMFReader& reader, unsigned track, -- cgit v1.2.1