aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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))