aboutsummaryrefslogtreecommitdiffstats
path: root/src/engine
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2007-12-02 04:43:48 +0000
committerDavid Robillard <d@drobilla.net>2007-12-02 04:43:48 +0000
commit0e03c5f94d91086ac1b9f3b42cee4459290e353e (patch)
tree4ae2e6f69c5b127bc2d0ba2920a7e9a2741c0339 /src/engine
parent377f82ab766acf2c52674c11d507aeaee4349f46 (diff)
downloadmachina-0e03c5f94d91086ac1b9f3b42cee4459290e353e.tar.gz
machina-0e03c5f94d91086ac1b9f3b42cee4459290e353e.tar.bz2
machina-0e03c5f94d91086ac1b9f3b42cee4459290e353e.zip
Ability to add notes to non-MIDI-note nodes (ie make noise with mouse only).
Fix note label display. Canvas prettiness ++. git-svn-id: http://svn.drobilla.net/lad/machina@937 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/engine')
-rw-r--r--src/engine/Loader.cpp2
-rw-r--r--src/engine/MachineBuilder.cpp4
-rw-r--r--src/engine/Node.cpp22
-rw-r--r--src/engine/machina/Node.hpp16
4 files changed, 23 insertions, 21 deletions
diff --git a/src/engine/Loader.cpp b/src/engine/Loader.cpp
index aa4d403..4449ae2 100644
--- a/src/engine/Loader.cpp
+++ b/src/engine/Loader.cpp
@@ -130,7 +130,7 @@ Loader::load(const Glib::ustring& uri)
results = query.run(_rdf_world, model);
for (Query::Results::iterator i = results.begin(); i != results.end(); ++i) {
- Created::iterator node_i = created.find((const char*)(*i)["initialNode"]);
+ Created::iterator node_i = created.find((const char*)(*i)["node"]);
if (node_i != created.end()) {
SharedPtr<Node> node = node_i->second;
const int note_num = (*i)["note"];
diff --git a/src/engine/MachineBuilder.cpp b/src/engine/MachineBuilder.cpp
index af486df..1830ee6 100644
--- a/src/engine/MachineBuilder.cpp
+++ b/src/engine/MachineBuilder.cpp
@@ -214,8 +214,8 @@ MachineBuilder::event(Raul::BeatTime time_offset,
assert(_connect_node->outgoing_edges().empty());
_connect_node->set_enter_action(resolved->enter_action());
_connect_node->set_exit_action(resolved->exit_action());
- resolved->remove_enter_action();
- resolved->remove_exit_action();
+ resolved->set_enter_action(SharedPtr<Action>());
+ resolved->set_exit_action(SharedPtr<Action>());
set_node_duration(_connect_node, resolved->duration());
resolved = _connect_node;
if (_machine->nodes().find(_connect_node) == _machine->nodes().end())
diff --git a/src/engine/Node.cpp b/src/engine/Node.cpp
index cb1a8eb..77c6d00 100644
--- a/src/engine/Node.cpp
+++ b/src/engine/Node.cpp
@@ -47,6 +47,7 @@ Node::set_selector(bool yn)
for (Edges::iterator i = _outgoing_edges.begin(); i != _outgoing_edges.end(); ++i)
(*i)->set_probability((*i)->probability() / prob_sum);
}
+ _changed = true;
}
@@ -54,28 +55,15 @@ void
Node::set_enter_action(SharedPtr<Action> action)
{
_enter_action = action;
+ _changed = true;
}
void
-Node::remove_enter_action()
-{
- _enter_action.reset();
-}
-
-
-
-void
Node::set_exit_action(SharedPtr<Action> action)
{
_exit_action = action;
-}
-
-
-void
-Node::remove_exit_action()
-{
- _exit_action.reset();
+ _changed = true;
}
@@ -84,8 +72,10 @@ Node::enter(SharedPtr<Raul::MIDISink> sink, BeatTime time)
{
assert(!_is_active);
+ _changed = true;
_is_active = true;
_enter_time = time;
+
if (sink && _enter_action)
_enter_action->execute(sink, time);
}
@@ -98,6 +88,8 @@ Node::exit(SharedPtr<Raul::MIDISink> sink, BeatTime time)
if (sink && _exit_action)
_exit_action->execute(sink, time);
+
+ _changed = true;
_is_active = false;
_enter_time = 0;
}
diff --git a/src/engine/machina/Node.hpp b/src/engine/machina/Node.hpp
index 2e26f0a..041f443 100644
--- a/src/engine/machina/Node.hpp
+++ b/src/engine/machina/Node.hpp
@@ -47,10 +47,7 @@ public:
Node(BeatCount duration=0, bool initial=false);
void set_enter_action(SharedPtr<Action> action);
- void remove_enter_action();
-
void set_exit_action(SharedPtr<Action> action);
- void remove_exit_action();
SharedPtr<Action> enter_action() { return _enter_action; }
SharedPtr<Action> exit_action() { return _exit_action; }
@@ -73,11 +70,24 @@ public:
void set_duration(BeatCount d) { _duration = d; }
bool is_selector() const { return _is_selector; }
void set_selector(bool i);
+
+ /// Schroedinger's flag
+ inline bool changed() {
+ if (_changed) {
+ _changed = false;
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ void set_changed() { _changed = true; }
typedef Raul::List<SharedPtr<Edge> > Edges;
Edges& outgoing_edges() { return _outgoing_edges; }
private:
+ bool _changed;
bool _is_initial;
bool _is_selector;
bool _is_active;