aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2008-11-17 06:10:23 +0000
committerDavid Robillard <d@drobilla.net>2008-11-17 06:10:23 +0000
commit1e7e76a2f69a67affd0ccc4e6735f4728c84cd72 (patch)
treec670b33622f0a9f0e4fe1cce71d561c97fba1a9c /src
parenta22ca975556ef1516302f5e559748f9a37dbcd99 (diff)
downloadmachina-1e7e76a2f69a67affd0ccc4e6735f4728c84cd72.tar.gz
machina-1e7e76a2f69a67affd0ccc4e6735f4728c84cd72.tar.bz2
machina-1e7e76a2f69a67affd0ccc4e6735f4728c84cd72.zip
Fix mutation.
git-svn-id: http://svn.drobilla.net/lad/trunk/machina@1758 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src')
-rw-r--r--src/engine/Mutation.cpp7
-rw-r--r--src/engine/Node.cpp2
2 files changed, 7 insertions, 2 deletions
diff --git a/src/engine/Mutation.cpp b/src/engine/Mutation.cpp
index 8c8c245..62abad5 100644
--- a/src/engine/Mutation.cpp
+++ b/src/engine/Mutation.cpp
@@ -58,7 +58,12 @@ AddNode::mutate(Machine& machine)
SharedPtr<Node> note_node = machine.random_node();
if (!note_node)
return;
- uint8_t note = PtrCast<MidiAction>(note_node->enter_action())->event()[1];
+
+ uint8_t note = rand() % 128;
+
+ SharedPtr<MidiAction> enter_action = PtrCast<MidiAction>(note_node->enter_action());
+ if (enter_action)
+ note = enter_action->event()[1];
node->set_enter_action(ActionFactory::note_on(note));
node->set_exit_action(ActionFactory::note_off(note));
diff --git a/src/engine/Node.cpp b/src/engine/Node.cpp
index 067b54d..b9b7605 100644
--- a/src/engine/Node.cpp
+++ b/src/engine/Node.cpp
@@ -44,7 +44,7 @@ Node::Node(const Node& copy)
, _is_initial(copy._is_initial)
, _is_selector(copy._is_selector)
, _is_active(false)
- , _enter_time(copy.enter_time())
+ , _enter_time(copy._enter_time)
, _duration(copy._duration)
, _enter_action(ActionFactory::copy(copy._enter_action))
, _exit_action(ActionFactory::copy(copy._exit_action))