Skip to content
This repository has been archived by the owner on Oct 11, 2023. It is now read-only.

Commit

Permalink
Retrigger logic
Browse files Browse the repository at this point in the history
  • Loading branch information
Olivier Gillet committed Apr 9, 2015
1 parent 1930f42 commit 9942c14
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions cvpal/midi_handler.cc
Expand Up @@ -175,17 +175,19 @@ void MidiHandler::NoteOn(uint8_t channel, uint8_t note, uint8_t velocity) {
case 0x0d:
{
uint8_t voice = channel == 0x03 ? 1 : 0;
force_retrigger_[voice] = mono_allocator_[voice].size()
&& !legato_[voice] ? kRetriggerDuration : 0;
mono_allocator_[voice].NoteOn(note, velocity);
if (state_.gate[channel == 0x01 ? 1 : voice] && !legato_[voice]) {
force_retrigger_[voice] = kRetriggerDuration;
}
}
break;

case 0x04:
{
uint8_t voice = poly_allocator_.NoteOn(note);
force_retrigger_[voice] = active_note_[voice] != 0xff
? kRetriggerDuration : 0;
if (state_.gate[voice] && !legato_[voice]) {
force_retrigger_[voice] = kRetriggerDuration;
}
active_note_[voice] = note;
}
break;
Expand Down

0 comments on commit 9942c14

Please sign in to comment.