summaryrefslogtreecommitdiffstats
path: root/src/server
diff options
context:
space:
mode:
Diffstat (limited to 'src/server')
-rw-r--r--src/server/PortImpl.cpp2
-rw-r--r--src/server/internals/Note.cpp11
2 files changed, 10 insertions, 3 deletions
diff --git a/src/server/PortImpl.cpp b/src/server/PortImpl.cpp
index 910349ca..f943fbb8 100644
--- a/src/server/PortImpl.cpp
+++ b/src/server/PortImpl.cpp
@@ -246,7 +246,7 @@ PortImpl::set_voice_value(const Context& context,
const FrameTime offset = time - context.start();
// Same deal as above
if (offset < context.nframes()) {
- buffer(voice)->append_event(time - context.start(),
+ buffer(voice)->append_event(offset,
sizeof(value),
_bufs.uris().atom_Float,
(const uint8_t*)&value);
diff --git a/src/server/internals/Note.cpp b/src/server/internals/Note.cpp
index 88fb1cd1..feb3890f 100644
--- a/src/server/internals/Note.cpp
+++ b/src/server/internals/Note.cpp
@@ -277,6 +277,11 @@ NoteNode::note_on(ProcessContext& context, uint8_t note_num, uint8_t velocity, F
key->voice = voice_num;
key->time = time;
+ // Check if we just triggered this voice at the same time
+ // (Double note-on at the same sample on the same voice)
+ const bool double_trigger = (voice->state == Voice::State::ACTIVE &&
+ voice->time == time);
+
// Trigger voice
voice->state = Voice::State::ACTIVE;
voice->note = note_num;
@@ -289,8 +294,10 @@ NoteNode::note_on(ProcessContext& context, uint8_t note_num, uint8_t velocity, F
_num_port->set_voice_value(context, voice_num, time, (float)note_num);
_vel_port->set_voice_value(context, voice_num, time, velocity / 127.0f);
_gate_port->set_voice_value(context, voice_num, time, 1.0f);
- _trig_port->set_voice_value(context, voice_num, time, 1.0f);
- _trig_port->set_voice_value(context, voice_num, time + 1, 0.0f);
+ if (!double_trigger) {
+ _trig_port->set_voice_value(context, voice_num, time, 1.0f);
+ _trig_port->set_voice_value(context, voice_num, time + 1, 0.0f);
+ }
assert(key->state == Key::State::ON_ASSIGNED);
assert(voice->state == Voice::State::ACTIVE);