Add custom pitch bend range

This commit is contained in:
Roland Rabien 2023-09-29 09:01:29 -07:00
commit c53eb68a0a
7 changed files with 46 additions and 36 deletions

View file

@ -36,9 +36,9 @@
{ "id": "adsr", "x": "getX('A')", "y": "getY('Res')", "r": "getR('R')", "b": "getY('A')" }
]
},
{ "id": "adsr", "x": "prevR()+1", "y": "prevY()", "w": "210 + 118", "h": 163, "children":
{ "id": "adsr", "x": "prevR()+1", "y": "prevY()", "w": "210 + 160", "h": 163, "children":
[
{ "id": "A", "x": "118/2", "y": 106, "w": 42, "h": 57 },
{ "id": "A", "x": "160/2", "y": 106, "w": 42, "h": 57 },
{ "id": "D", "x": "prevR()", "y": "prevY()", "w": 42, "h": 57 },
{ "id": "S", "x": "prevR()", "y": "prevY()", "w": 42, "h": 57 },
{ "id": "R", "x": "prevR()", "y": "prevY()", "w": 42, "h": 57 },
@ -125,14 +125,15 @@
{ "id": "Predelay", "x": "prevR()", "y": "prevY()", "w": 42, "h": 57 },
{ "id": "Mix", "x": "prevR()", "y": "prevY()", "w": 42, "h": 57 }
] },
{ "id": "global", "x": "prevR()+1", "y": "prevY()", "w": 126, "h": 137, "children":
{ "id": "global", "x": "prevR()+1", "y": "prevY()", "w": 168, "h": 137, "children":
[
{ "id": "Legato", "x": 0, "y": 23, "w": 42, "h": 57 },
{ "id": "Mono", "x": 0, "y": 23, "w": 42, "h": 57 },
{ "id": "Legato", "x": "prevR()", "y": "prevY()", "w": 42, "h": 57 },
{ "id": "Glide", "x": "prevR()", "y": "prevY()", "w": 42, "h": 57 },
{ "id": "Time", "x": "prevR()", "y": "prevY()", "w": 42, "h": 57 },
{ "id": "Mono", "x": 0, "y": "prevB()", "w": 42, "h": 57 },
{ "id": "PB Range", "x": 0, "y": "prevB()", "w": 42, "h": 57 },
{ "id": "Voices", "x": "prevR()", "y": "prevY()", "w": 42, "h": 57 },
{ "id": "Level", "x": "prevR()", "y": "prevY()", "w": 42, "h": 57 }
{ "id": "Level", "x": "prevR() + 42", "y": "prevY()", "w": 42, "h": 57 }
] }
]
}

View file

@ -458,15 +458,13 @@ public:
{
setName ("global");
addControl (new gin::Knob (proc.globalParams.level), 0, 0);
addControl (new gin::Select (proc.globalParams.glideMode), 1, 0);
addControl (new gin::Knob (proc.globalParams.glideRate), 2, 0);
addControl (new gin::Knob (proc.globalParams.voices), 0, 1);
addControl (new gin::Switch (proc.globalParams.legato), 1, 1);
addControl (new gin::Switch (proc.globalParams.mono), 2, 1);
setSize (168, 163);
addControl (new gin::Knob (proc.globalParams.level));
addControl (new gin::Select (proc.globalParams.glideMode));
addControl (new gin::Knob (proc.globalParams.glideRate));
addControl (new gin::Knob (proc.globalParams.voices));
addControl (new gin::Switch (proc.globalParams.legato));
addControl (new gin::Switch (proc.globalParams.mono));
addControl (new gin::Knob (proc.globalParams.pitchBend));
}
WavetableAudioProcessor& proc;

View file

@ -21,7 +21,7 @@ WavetableAudioProcessorEditor::WavetableAudioProcessorEditor (WavetableAudioProc
usage.setBounds (45, 12, 150, 16);
scope.setBounds (674, 5, 177, 30);
setSize (901, 671);
setSize (943, 671);
}
WavetableAudioProcessorEditor::~WavetableAudioProcessorEditor()

View file

@ -287,6 +287,7 @@ void WavetableAudioProcessor::GlobalParams::setup (WavetableAudioProcessor& p)
level = p.addExtParam ("level", "Level", "", "db", { -100.0, 0.0, 1.0, 4.0f }, 0.0, 0.0f);
voices = p.addIntParam ("voices", "Voices", "", "", { 2.0, 40.0, 1.0, 1.0 }, 40.0f, 0.0f);
mpe = p.addIntParam ("mpe", "MPE", "", "", { 0.0, 1.0, 1.0, 1.0 }, 0.0f, 0.0f, enableTextFunction);
pitchBend = p.addIntParam ("pitchbend", "Pitch Bend", "PB Range", "", { 0.0, 48.0, 1.0, 1.0 }, 2.0f, 0.0f);
level->conversionFunction = [] (float in) { return juce::Decibels::decibelsToGain (in); };
}
@ -330,11 +331,11 @@ void WavetableAudioProcessor::DelayParams::setup (WavetableAudioProcessor& p)
sync = p.addExtParam ("dlSync", "Sync", "", "", { 0.0f, 1.0f, 1.0f, 1.0f}, 0.0f, 0.0f, enableTextFunction);
time = p.addExtParam ("dlTime", "Delay", "", "", { 0.0f, 120.0f, 0.0f, 0.3f}, 1.0f, 0.0f);
beat = p.addExtParam ("dlBeat", "Delay", "", "", { 0.0f, mxd, 1.0f, 1.0f}, 13.0f, 0.0f, durationTextFunction);
fb = p.addExtParam ("dlFb", "FB", "", "dB", {-100.0f, 0.0f, 0.0f, 5.0f}, -10.0f, 0.1f);
cf = p.addExtParam ("dlCf", "CF", "", "dB", {-100.0f, 0.0f, 0.0f, 5.0f}, -100.0f, 0.1f);
mix = p.addExtParam ("dlMix", "Mix", "", "%", { 0.0f, 100.0f, 0.0f, 1.0f}, 0.5f, 0.1f);
fb = p.addExtParam ("dlFb", "FB", "", "dB", {-100.0f, 0.0f, 0.0f, 5.0f}, -10.0f, 0.0f);
cf = p.addExtParam ("dlCf", "CF", "", "dB", {-100.0f, 0.0f, 0.0f, 5.0f}, -100.0f, 0.0f);
mix = p.addExtParam ("dlMix", "Mix", "", "%", { 0.0f, 100.0f, 0.0f, 1.0f}, 0.5f, 0.0f);
delay = p.addIntParam ("dlDelay", "Delay", "", "", { 0.0f, 120.0f, 0.0f, 1.0f}, 1.0f, {0.1f, gin::SmoothingType::eased});
delay = p.addIntParam ("dlDelay", "Delay", "", "", { 0.0f, 120.0f, 0.0f, 1.0f}, 1.0f, 0.0f);
fb->conversionFunction = [] (float in) { return juce::Decibels::decibelsToGain (in); };
cf->conversionFunction = [] (float in) { return juce::Decibels::decibelsToGain (in); };
@ -640,6 +641,7 @@ void WavetableAudioProcessor::setupModMatrix()
{
modSrcPressure = modMatrix.addPolyModSource ("mpep", "MPE Pressure", false);
modSrcTimbre = modMatrix.addPolyModSource ("mpet", "MPE Timbre", false);
modSrcPitchbend = modMatrix.addPolyModSource ("mpebp", "MPE Pitch Bend", true);
modScrPitchBend = modMatrix.addMonoModSource ("pb", "Pitch Bend", true);
@ -744,6 +746,7 @@ void WavetableAudioProcessor::processBlock (juce::AudioBuffer<float>& buffer, ju
startBlock();
setMPE (globalParams.mpe->isOn());
setPitchBendRange (globalParams.pitchBend->getUserValueInt());
playhead = getPlayHead();
@ -940,7 +943,8 @@ void WavetableAudioProcessor::updateParams (int newBlockSize)
}
else
{
delayParams.delay->setUserValue (delayParams.time->getUserValue());
auto z = delayParams.time->getUserValue();
delayParams.delay->setUserValue (z);
}
stereoDelay.setParams (modMatrix.getValue (delayParams.delay),
@ -949,7 +953,6 @@ void WavetableAudioProcessor::updateParams (int newBlockSize)
modMatrix.getValue (delayParams.cf));
}
// Update Reverb
if (reverbParams.enable->isOn())
{

View file

@ -143,7 +143,7 @@ public:
{
GlobalParams() = default;
gin::Parameter::Ptr mono, glideMode, glideRate, legato, level, voices, mpe;
gin::Parameter::Ptr mono, glideMode, glideRate, legato, level, voices, mpe, pitchBend;
void setup (WavetableAudioProcessor& p);
@ -220,8 +220,8 @@ public:
};
//==============================================================================
gin::ModSrcId modSrcPressure, modSrcTimbre, modScrPitchBend, modSrcFilter,
modSrcNote, modSrcVelocity, modSrcStep, modSrcMonoStep;
gin::ModSrcId modSrcPressure, modSrcTimbre, modSrcPitchbend, modScrPitchBend,
modSrcFilter, modSrcNote, modSrcVelocity, modSrcStep, modSrcMonoStep;
juce::Array<gin::ModSrcId> modSrcCC, modSrcMonoLFO, modSrcLFO, modSrcEnv;

View file

@ -31,7 +31,8 @@ void WavetableVoice::noteStarted()
}
proc.modMatrix.setPolyValue (*this, proc.modSrcVelocity, note.noteOnVelocity.asUnsignedFloat());
proc.modMatrix.setPolyValue (*this, proc.modSrcTimbre, note.initialTimbre.asUnsignedFloat());
proc.modMatrix.setPolyValue (*this, proc.modSrcTimbre, note.timbre.asUnsignedFloat());
proc.modMatrix.setPolyValue (*this, proc.modSrcPitchbend, note.pitchbend.asUnsignedFloat());
proc.modMatrix.setPolyValue (*this, proc.modSrcPressure, note.pressure.asUnsignedFloat());
juce::ScopedValueSetter<bool> svs (disableSmoothing, true);
@ -86,8 +87,9 @@ void WavetableVoice::noteRetriggered()
}
proc.modMatrix.setPolyValue (*this, proc.modSrcVelocity, note.noteOnVelocity.asUnsignedFloat());
proc.modMatrix.setPolyValue (*this, proc.modSrcTimbre, note.initialTimbre.asUnsignedFloat());
proc.modMatrix.setPolyValue (*this, proc.modSrcTimbre, note.timbre.asUnsignedFloat());
proc.modMatrix.setPolyValue (*this, proc.modSrcPressure, note.pressure.asUnsignedFloat());
proc.modMatrix.setPolyValue (*this, proc.modSrcPitchbend, note.pitchbend.asUnsignedFloat());
updateParams (0);
@ -123,7 +125,13 @@ void WavetableVoice::notePressureChanged()
void WavetableVoice::noteTimbreChanged()
{
auto note = getCurrentlyPlayingNote();
proc.modMatrix.setPolyValue (*this, proc.modSrcTimbre, note.initialTimbre.asUnsignedFloat());
proc.modMatrix.setPolyValue (*this, proc.modSrcTimbre, note.timbre.asUnsignedFloat());
}
void WavetableVoice::notePitchbendChanged()
{
auto note = getCurrentlyPlayingNote();
proc.modMatrix.setPolyValue (*this, proc.modSrcPitchbend, note.pitchbend.asUnsignedFloat());
}
void WavetableVoice::setCurrentSampleRate (double newRate)

View file

@ -18,7 +18,7 @@ public:
void notePressureChanged() override;
void noteTimbreChanged() override;
void notePitchbendChanged() override {}
void notePitchbendChanged() override;
void noteKeyStateChanged() override {}
void setCurrentSampleRate (double newRate) override;