Skip to content

Commit

Permalink
Try and make delay less zippery
Browse files Browse the repository at this point in the history
  • Loading branch information
FigBug committed Sep 30, 2023
1 parent a2f1eb8 commit c6f9f7d
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 8 deletions.
5 changes: 4 additions & 1 deletion plugin/Source/PluginEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@ WavetableAudioProcessorEditor::WavetableAudioProcessorEditor (WavetableAudioProc
addAndMakeVisible (editor);
addAndMakeVisible (scope);

usage.panic.onClick = [this] { wtProc.presetLoaded = true; };
usage.panic.onClick = [this]
{
wtProc.presetLoaded = true;
};
addAndMakeVisible (usage);

usage.setBounds (45, 12, 150, 16);
Expand Down
21 changes: 15 additions & 6 deletions plugin/Source/PluginProcessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -678,12 +678,22 @@ void WavetableAudioProcessor::setupModMatrix()
polyParam = false;

if (! pp->isInternal() || pp == delayParams.delay)
modMatrix.addParameter (pp, polyParam);
modMatrix.addParameter (pp, polyParam, getSmoothingTime (pp));
}

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()
{
Processor::reset();
Expand Down Expand Up @@ -739,7 +749,7 @@ void WavetableAudioProcessor::processBlock (juce::AudioBuffer<float>& buffer, ju
if (blockMissed || presetLoaded || lastMono != globalParams.mono->isOn())
{
blockMissed = presetLoaded = false;
lastMono = ! lastMono;
lastMono = globalParams.mono->isOn();
stereoDelay.reset();
reverb.reset();
turnOffAllVoices (false);
Expand Down Expand Up @@ -838,7 +848,7 @@ void WavetableAudioProcessor::applyEffects (juce::AudioSampleBuffer& buffer)

// Apply Delay
if (delayParams.enable->isOn())
stereoDelay.process (buffer);
stereoDelay.processSmoothed (buffer);

// Apply Reverb
if (reverbParams.enable->isOn())
Expand Down Expand Up @@ -939,13 +949,12 @@ void WavetableAudioProcessor::updateParams (int newBlockSize)
{
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()));
}
else
{
auto z = delayParams.time->getUserValue();
delayParams.delay->setUserValue (z);
delayParams.delay->setUserValue (modMatrix.getValue (delayParams.time));
}

stereoDelay.setParams (modMatrix.getValue (delayParams.delay),
Expand Down
3 changes: 3 additions & 0 deletions plugin/Source/PluginProcessor.h
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,9 @@ class WavetableAudioProcessor : public gin::Processor,

juce::CriticalSection dspLock;

private:
float getSmoothingTime (gin::Parameter*);

//==============================================================================
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (WavetableAudioProcessor)
};

0 comments on commit c6f9f7d

Please sign in to comment.