diff options
author | David Robillard <d@drobilla.net> | 2007-03-25 21:56:31 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2007-03-25 21:56:31 +0000 |
commit | 3dee4f8a64548dbb2aa11521e258865e5b93e9e3 (patch) | |
tree | 6920121a656323214baec8ca063cafa11460348f | |
parent | fc857d5e0130bdf0dd948f805ed8d70f1c018dee (diff) | |
download | machina-3dee4f8a64548dbb2aa11521e258865e5b93e9e3.tar.gz machina-3dee4f8a64548dbb2aa11521e258865e5b93e9e3.tar.bz2 machina-3dee4f8a64548dbb2aa11521e258865e5b93e9e3.zip |
Fixed construction algorithm bugs.
git-svn-id: http://svn.drobilla.net/lad/machina@377 a436a847-0d15-0410-975c-d299462d15a1
-rw-r--r-- | src/engine/Machine.cpp | 10 | ||||
-rw-r--r-- | src/engine/SMFDriver.cpp | 12 | ||||
-rw-r--r-- | src/engine/machina/Machine.hpp | 2 |
3 files changed, 13 insertions, 11 deletions
diff --git a/src/engine/Machine.cpp b/src/engine/Machine.cpp index 91dcfe4..600dd3d 100644 --- a/src/engine/Machine.cpp +++ b/src/engine/Machine.cpp @@ -55,7 +55,7 @@ Machine::set_sink(SharedPtr<Raul::MIDISink> sink) void Machine::add_node(SharedPtr<Node> node) { - cerr << "ADDING NODE " << node.get() << endl; + //cerr << "ADDING NODE " << node.get() << endl; _nodes.push_back(node); } @@ -289,7 +289,7 @@ Machine::write_state(Raul::RDFWriter& writer) for (Nodes::const_iterator n = _nodes.begin(); n != _nodes.end(); ++n) { - cerr << "Writing node " << count++ << " state." << endl; + //cerr << "Writing node " << count++ << " state." << endl; (*n)->write_state(writer); @@ -308,12 +308,12 @@ Machine::write_state(Raul::RDFWriter& writer) for (Nodes::const_iterator n = _nodes.begin(); n != _nodes.end(); ++n) { - cerr << "Writing node " << count++ << " edges: "; + //cerr << "Writing node " << count++ << " edges: "; for (Node::Edges::const_iterator e = (*n)->outgoing_edges().begin(); e != (*n)->outgoing_edges().end(); ++e) { - cerr << "."; + //cerr << "."; (*e)->write_state(writer); @@ -322,7 +322,7 @@ Machine::write_state(Raul::RDFWriter& writer) (*e)->id()); } - cerr << endl; + //cerr << endl; } } diff --git a/src/engine/SMFDriver.cpp b/src/engine/SMFDriver.cpp index ff55e00..33fc686 100644 --- a/src/engine/SMFDriver.cpp +++ b/src/engine/SMFDriver.cpp @@ -120,8 +120,8 @@ SMFDriver::connect_nodes(SharedPtr<Machine> m, SharedPtr<Node> delay_node; - cout << "Connect nodes durations: " << tail->duration() << " .. " << head->duration() << endl; - cout << "Connect nodes times: " << tail_end_time << " .. " << head_start_time << endl; + //cerr << "Connect nodes durations: " << tail->duration() << " .. " << head->duration() << endl; + //cerr << "Connect nodes times: " << tail_end_time << " .. " << head_start_time << endl; if (head_start_time == tail_end_time) { // Connect directly @@ -132,7 +132,7 @@ SMFDriver::connect_nodes(SharedPtr<Machine> m, tail->add_outgoing_edge(SharedPtr<Edge>(new Edge(tail, head))); } else { // Need to actually create a delay node - cerr << "Adding delay node for " << tail_end_time << " .. " << head_start_time << endl; + //cerr << "Adding delay node for " << tail_end_time << " .. " << head_start_time << endl; delay_node = SharedPtr<Node>(new Node()); delay_node->set_duration(head_start_time - tail_end_time); tail->add_outgoing_edge(SharedPtr<Edge>(new Edge(tail, delay_node))); @@ -255,6 +255,8 @@ SMFDriver::learn_track(SharedPtr<Machine> m, resolved->remove_exit_action(); connect_node->set_duration(resolved->duration()); resolved = connect_node; + if (m->nodes().find(connect_node) == m->nodes().end()) + m->add_node(connect_node); } else { connect_node = resolved; m->add_node(resolved); @@ -300,9 +302,9 @@ SMFDriver::learn_track(SharedPtr<Machine> m, } if (added_nodes > 0) - if (initial_node->outgoing_edges().size() == 1) + /*if (initial_node->outgoing_edges().size() == 1) (*initial_node->outgoing_edges().begin())->dst()->set_initial(true); - else + else*/ m->add_node(initial_node); } diff --git a/src/engine/machina/Machine.hpp b/src/engine/machina/Machine.hpp index e5bef23..7424f31 100644 --- a/src/engine/machina/Machine.hpp +++ b/src/engine/machina/Machine.hpp @@ -61,7 +61,7 @@ public: void clear_pending_learn() { _pending_learn.reset(); } typedef Raul::List<SharedPtr<Node> > Nodes; - const Nodes& nodes() { return _nodes; } + Nodes& nodes() { return _nodes; } void set_sink(SharedPtr<Raul::MIDISink> sink); |