Try and make delay less zippery

This commit is contained in:
Roland Rabien 2023-09-29 20:07:45 -07:00
commit c6f9f7d1a5
4 changed files with 23 additions and 8 deletions

@ -1 +1 @@
Subproject commit 98c1f54cb9b17090522327064bd2d76090f21af3 Subproject commit ab67106ad750ede2daceb56908735ccd9c22fb2c

View file

@ -15,7 +15,10 @@ WavetableAudioProcessorEditor::WavetableAudioProcessorEditor (WavetableAudioProc
addAndMakeVisible (editor); addAndMakeVisible (editor);
addAndMakeVisible (scope); addAndMakeVisible (scope);
usage.panic.onClick = [this] { wtProc.presetLoaded = true; }; usage.panic.onClick = [this]
{
wtProc.presetLoaded = true;
};
addAndMakeVisible (usage); addAndMakeVisible (usage);
usage.setBounds (45, 12, 150, 16); usage.setBounds (45, 12, 150, 16);

View file

@ -678,12 +678,22 @@ void WavetableAudioProcessor::setupModMatrix()
polyParam = false; polyParam = false;
if (! pp->isInternal() || pp == delayParams.delay) if (! pp->isInternal() || pp == delayParams.delay)
modMatrix.addParameter (pp, polyParam); modMatrix.addParameter (pp, polyParam, getSmoothingTime (pp));
} }
modMatrix.build(); modMatrix.build();
} }
float WavetableAudioProcessor::getSmoothingTime (gin::Parameter* p)
{
if (p == delayParams.delay) return 0.0f;
if (p == delayParams.cf) return 0.0f;
if (p == delayParams.fb) return 0.0f;
if (p == delayParams.mix) return 0.0f;
return 0.02f;
}
void WavetableAudioProcessor::reset() void WavetableAudioProcessor::reset()
{ {
Processor::reset(); Processor::reset();
@ -739,7 +749,7 @@ void WavetableAudioProcessor::processBlock (juce::AudioBuffer<float>& buffer, ju
if (blockMissed || presetLoaded || lastMono != globalParams.mono->isOn()) if (blockMissed || presetLoaded || lastMono != globalParams.mono->isOn())
{ {
blockMissed = presetLoaded = false; blockMissed = presetLoaded = false;
lastMono = ! lastMono; lastMono = globalParams.mono->isOn();
stereoDelay.reset(); stereoDelay.reset();
reverb.reset(); reverb.reset();
turnOffAllVoices (false); turnOffAllVoices (false);
@ -838,7 +848,7 @@ void WavetableAudioProcessor::applyEffects (juce::AudioSampleBuffer& buffer)
// Apply Delay // Apply Delay
if (delayParams.enable->isOn()) if (delayParams.enable->isOn())
stereoDelay.process (buffer); stereoDelay.processSmoothed (buffer);
// Apply Reverb // Apply Reverb
if (reverbParams.enable->isOn()) if (reverbParams.enable->isOn())
@ -939,13 +949,12 @@ void WavetableAudioProcessor::updateParams (int newBlockSize)
{ {
if (delayParams.sync->isOn()) if (delayParams.sync->isOn())
{ {
auto& duration = gin::NoteDuration::getNoteDurations()[(size_t)delayParams.beat->getUserValueInt()]; auto& duration = gin::NoteDuration::getNoteDurations()[(size_t)modMatrix.getValue (delayParams.beat)];
delayParams.delay->setUserValue (duration.toSeconds (getPlayHead())); delayParams.delay->setUserValue (duration.toSeconds (getPlayHead()));
} }
else else
{ {
auto z = delayParams.time->getUserValue(); delayParams.delay->setUserValue (modMatrix.getValue (delayParams.time));
delayParams.delay->setUserValue (z);
} }
stereoDelay.setParams (modMatrix.getValue (delayParams.delay), stereoDelay.setParams (modMatrix.getValue (delayParams.delay),

View file

@ -283,6 +283,9 @@ public:
juce::CriticalSection dspLock; juce::CriticalSection dspLock;
private:
float getSmoothingTime (gin::Parameter*);
//============================================================================== //==============================================================================
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (WavetableAudioProcessor) JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (WavetableAudioProcessor)
}; };