MCPcopy Create free account
hub / github.com/StrangeLoopsAudio/gRainbow / handleNoteOff

Method handleNoteOff

Source/DSP/GranularSynth.cpp:744–762  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

742}
743
744void GranularSynth::handleNoteOff(juce::MidiKeyboardState*, int, int midiNoteNumber, float) {
745 const Utils::PitchClass pitchClass = Utils::getPitchClass(midiNoteNumber);
746
747 for (GrainNote* gNote : mActiveNotes) {
748 if (gNote->pitch == midiNoteNumber && gNote->removeTs == -1) {
749 // Set timestamp to delete note based on release time and set note off for all generators
750 float release = mParameters.getFloatParam(mParameters.global.ampEnvRelease, true);;
751 for (size_t i = 0; i < NUM_GENERATORS; ++i) {
752 gNote->genAmpEnvs[i].noteOff(mTotalSamps);
753 }
754 gNote->removeTs = mTotalSamps + static_cast<int>(release * mSampleRate);
755 break;
756 }
757 }
758 // Update mod envelopes
759 for (auto& env : mParameters.global.modEnvs) {
760 env.handleNoteOff(mTotalSamps);
761 }
762}
763
764void GranularSynth::makePitchSpec() {
765 mPitchSpecBuffer.clear();

Callers

nothing calls this directly

Calls 3

getPitchClassFunction · 0.85
getFloatParamMethod · 0.80
noteOffMethod · 0.80

Tested by

no test coverage detected