diff --git a/source/synthesis/framework/Synthesiser/BKSynthesiser.cpp b/source/synthesis/framework/Synthesiser/BKSynthesiser.cpp index 4045fe2..f3ab471 100644 --- a/source/synthesis/framework/Synthesiser/BKSynthesiser.cpp +++ b/source/synthesis/framework/Synthesiser/BKSynthesiser.cpp @@ -271,18 +271,18 @@ void BKSynthesiser::noteOn (const int midiChannel, stopVoice (voice, 1.0f, true); - for (auto transpOffset : midiNoteOffsets) + for (auto transp : midiNoteTranspositions) { // DBG("num noteOn sounds = " + juce::String(sounds->size())); for (auto* sound : *sounds) { //DBG("noteOn velocity = " + juce::String(velocity)); - if (sound->appliesToNote (std::round(midiNoteNumber + transpOffset)) && sound->appliesToChannel (midiChannel) && sound->appliesToVelocity (velocity)) + if (sound->appliesToNote (std::round(midiNoteNumber + transp)) && sound->appliesToChannel (midiChannel) && sound->appliesToVelocity (velocity)) { // If hitting a note that's still ringing, stop it first (it could be // still playing because of the sustain or sostenuto pedal). /** - * moved loop below up out of the transpOffset loop, to avoid voice handling problems with multiple transpositions + * moved loop below up out of the transp loop, to avoid voice handling problems with multiple transpositions */ /* for (auto* voice : voices) @@ -295,7 +295,7 @@ void BKSynthesiser::noteOn (const int midiChannel, midiChannel, midiNoteNumber, velocity, - transpOffset); + transp); break; } @@ -308,12 +308,12 @@ void BKSynthesiser::startVoice (BKSamplerVoice* const voice, const int midiChannel, const int midiNoteNumber, const float velocity, - const float tuningOffset) + const float transposition) { playingVoicesByNote.getReference(midiNoteNumber).addIfNotAlreadyThere(voice); //playingVoicesByNote[midiNoteNumber].addIfNotAlreadyThere(voice); - //DBG("playingVoicesByNote[midiNoteNumber] adding = " + juce::String(midiNoteNumber) + " " + juce::String(tuningOffset) + " size = " + juce::String(playingVoicesByNote[midiNoteNumber].size())); + //DBG("playingVoicesByNote[midiNoteNumber] adding = " + juce::String(midiNoteNumber) + " " + juce::String(transposition) + " size = " + juce::String(playingVoicesByNote[midiNoteNumber].size())); //if (voice != nullptr && sound != nullptr) { @@ -329,7 +329,7 @@ void BKSynthesiser::startVoice (BKSamplerVoice* const voice, voice->setSostenutoPedalDown (false); voice->setSustainPedalDown (sustainPedalsDown[midiChannel]); - voice->startNote (midiNoteNumber, velocity, tuningOffset, sound, + voice->startNote (midiNoteNumber, velocity, transposition, sound, lastPitchWheelValues [midiChannel - 1]); @@ -371,7 +371,7 @@ void BKSynthesiser::noteOff (const int midiChannel, /* - for (auto transpOffset : midiNoteOffsets) // need to take into account that this might have changed in the meantime... + for (auto transpOffset : midiNoteTranspositions) // need to take into account that this might have changed in the meantime... { //DBG("noteOff for transpOffset " + juce::String(midiNoteNumber) + " " + juce::String(transpOffset)); @@ -384,7 +384,7 @@ void BKSynthesiser::noteOff (const int midiChannel, if (auto sound = voice->getCurrentlyPlayingSound()) { //DBG("noteOff for transpOffset " + juce::String(midiNoteNumber) + " " + juce::String(transpOffset)); - //for (auto transpOffset : midiNoteOffsets) + //for (auto transpOffset : midiNoteTranspositions) { if (sound->appliesToNote (std::round (midiNoteNumber + transpOffset)) && sound->appliesToChannel (midiChannel)) diff --git a/source/synthesis/framework/Synthesiser/BKSynthesiser.h b/source/synthesis/framework/Synthesiser/BKSynthesiser.h index 918ff33..e9a771d 100644 --- a/source/synthesis/framework/Synthesiser/BKSynthesiser.h +++ b/source/synthesis/framework/Synthesiser/BKSynthesiser.h @@ -302,7 +302,7 @@ class BKSynthesiser } void updateMidiNoteOffsets(juce::Array newOffsets) { - midiNoteOffsets = newOffsets; + midiNoteTranspositions = newOffsets; } juce::ADSR::Parameters globalADSR; @@ -358,7 +358,7 @@ class BKSynthesiser int midiChannel, int midiNoteNumber, float velocity, - float tuningOffset); + float transposition); /** Stops a given voice. You should never need to call this, it's used internally by noteOff, but is protected @@ -386,7 +386,7 @@ class BKSynthesiser bool sustainPedalAlreadyDown = false; // to avoid re-triggering of pedalDown sounds /** - * midiNoteOffsets is an arrays of tuning offsets, in MidiNoteCents (.01 = 1 cent) + * midiNoteTranspositions is an arrays of tuning offsets, in MidiNoteCents (.01 = 1 cent) * - these offsets are set by transposition controls in Direct, Nostalgic, and Synchronic * * by default, there is only one offset in each subarray, with value 0., for regular un-transposed notes @@ -403,7 +403,7 @@ class BKSynthesiser * * the "un-transposed" midiNoteNumber is the midi note played by the performer, and used for voice tracking */ - juce::Array midiNoteOffsets = { 0.}; // needs to be set via UI + juce::Array midiNoteTranspositions = { 0.}; // needs to be set via UI juce::HashMap> playingVoicesByNote; // Hash of current voices playing for a particular midiNoteNumber template diff --git a/source/synthesis/framework/Synthesiser/Sample.h b/source/synthesis/framework/Synthesiser/Sample.h index a43b7a0..7a15415 100644 --- a/source/synthesis/framework/Synthesiser/Sample.h +++ b/source/synthesis/framework/Synthesiser/Sample.h @@ -626,7 +626,7 @@ class BKSamplerVoice : public BKSynthesiserVoice virtual void startNote (int midiNoteNumber, float velocity, - float tuningOffset, + float transposition, BKSamplerSound * _sound, int currentPitchWheelPosition) { @@ -640,10 +640,10 @@ class BKSamplerVoice : public BKSynthesiserVoice //DBG("gain from velocity = " + juce::String(velocity) + ":" + juce::String(samplerSound->getGainMultiplierFromVelocity(velocity))); /** - * tuningOffset is from Transposition sliders in Direct/Nostalgic/Synchronic + * transposition is from Transposition sliders in Direct/Nostalgic/Synchronic * NOT from the Tuning preparation */ - frequency.setTargetValue(mtof(midiNoteNumber + tuningOffset)); // need to sort out A440 reference freq as well... + frequency.setTargetValue(mtof(midiNoteNumber + transposition)); // need to sort out A440 reference freq as well... //melatonin::printSparkline(m_Buffer); auto loopPoints = samplerSound->getLoopPointsInSeconds();