This commit is contained in:
2026-06-14 12:48:42 -05:00
parent 397e1fe7dc
commit cfc8cb2b51
3 changed files with 51 additions and 5 deletions

View File

@@ -10,12 +10,19 @@ Synth::Synth(ConfigService* config, LoggerService* logger, ScopeBuffer* scope, N
void Synth::handleNoteEvent(const NoteEvent& event) {
Voice* v = findVoiceByNote(event.note);
if(v != nullptr) v->noteOff();
// Voice* v = findVoiceByNote(event.note);
// if(v != nullptr) v->noteOff();
// stop all voices that are currently playing this note
for(Voice& v : voices_) {
if(v.isActive() && v.note() == event.note) {
v.noteOff();
}
}
if(event.type == NoteEventType::NoteOn) {
v = findFreeVoice();
Voice* v = findFreeVoice();
if(v != nullptr) v->noteOn(event.note, event.velocity);
}