Skip to content

Commit

Permalink
fix #273150: incorrect off_by processing
Browse files Browse the repository at this point in the history
Move off_by processing before processing voices
  • Loading branch information
anatoly-os committed Jun 8, 2018
1 parent b5893a0 commit 9bd5522
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions zerberus/zerberus.cpp
Expand Up @@ -98,16 +98,6 @@ void Zerberus::trigger(Channel* channel, int key, int velo, Trigger trigger, int
double random = (double) rand() / (double) RAND_MAX;
for (Zone* z : i->zones()) {
if (z->match(channel, key, velo, trigger, random, cc, ccVal)) {
if (freeVoices.empty()) {
qDebug("Zerberus: out of voices...");
return;
}
Voice* voice = freeVoices.pop();
Q_ASSERT(voice->isOff());
voice->start(channel, key, velo, z, durSinceNoteOn);
voice->setNext(activeVoices);
activeVoices = voice;

//
// handle offBy voices
//
Expand All @@ -121,6 +111,17 @@ void Zerberus::trigger(Channel* channel, int key, int velo, Trigger trigger, int
}
}
}

if (freeVoices.empty()) {
qDebug("Zerberus: out of voices...");
return;
}

Voice* voice = freeVoices.pop();
Q_ASSERT(voice->isOff());
voice->start(channel, key, velo, z, durSinceNoteOn);
voice->setNext(activeVoices);
activeVoices = voice;
}
}
}
Expand Down

0 comments on commit 9bd5522

Please sign in to comment.