Skip to content

Commit

Permalink
fix clouds singing until audio stops
Browse files Browse the repository at this point in the history
  • Loading branch information
bboettcher3 committed Jan 16, 2024
1 parent a50cf84 commit dd8831e
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions Source/DSP/GranularSynth.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -522,6 +522,12 @@ void GranularSynth::handleGrainAddRemove(int blockSize) {
}
}
for (auto* gNote : notesToRemove) {
for (Utils::MidiNote* it = mMidiNotes.begin(); it != mMidiNotes.end(); it++) {
if (Utils::getPitchClass(it->pitch) == gNote->pitchClass) {
mMidiNotes.remove(it);
break; // will only be at most 1 note (TODO assuming mouse and midi aren't set at same time)
}
}
mActiveNotes.removeObject(gNote);
}
}
Expand Down Expand Up @@ -742,13 +748,6 @@ void GranularSynth::handleNoteOn(juce::MidiKeyboardState*, int, int midiNoteNumb
void GranularSynth::handleNoteOff(juce::MidiKeyboardState*, int, int midiNoteNumber, float) {
const Utils::PitchClass pitchClass = Utils::getPitchClass(midiNoteNumber);

for (Utils::MidiNote* it = mMidiNotes.begin(); it != mMidiNotes.end(); it++) {
if (it->pitch == pitchClass) {
mMidiNotes.remove(it);
break; // will only be at most 1 note (TODO assuming mouse and midi aren't set at same time)
}
}

for (GrainNote* gNote : mActiveNotes) {
if (gNote->pitchClass == pitchClass && gNote->removeTs == -1) {
// Set timestamp to delete note based on release time and set note off for all generators
Expand Down

0 comments on commit dd8831e

Please sign in to comment.