Browse Source

DelayLine: Allow setting a new maximum delay time after construction

v6.1.6
reuk 3 years ago
parent
commit
7b64bd7406
No known key found for this signature in database GPG Key ID: 9ADCD339CFC98A11
2 changed files with 19 additions and 1 deletions
  1. +11
    -1
      modules/juce_dsp/processors/juce_DelayLine.cpp
  2. +8
    -0
      modules/juce_dsp/processors/juce_DelayLine.h

+ 11
- 1
modules/juce_dsp/processors/juce_DelayLine.cpp View File

@@ -40,8 +40,9 @@ DelayLine<SampleType, InterpolationType>::DelayLine (int maximumDelayInSamples)
{
jassert (maximumDelayInSamples >= 0);
totalSize = jmax (4, maximumDelayInSamples + 1);
sampleRate = 44100.0;
setMaximumDelayInSamples (maximumDelayInSamples);
}
//==============================================================================
@@ -81,6 +82,15 @@ void DelayLine<SampleType, InterpolationType>::prepare (const ProcessSpec& spec)
reset();
}
template <typename SampleType, typename InterpolationType>
void DelayLine<SampleType, InterpolationType>::setMaximumDelayInSamples (int maxDelayInSamples)
{
jassert (maxDelayInSamples >= 0);
totalSize = jmax (4, maxDelayInSamples + 1);
bufferData.setSize ((int) bufferData.getNumChannels(), totalSize, false, false, true);
reset();
}
template <typename SampleType, typename InterpolationType>
void DelayLine<SampleType, InterpolationType>::reset()
{


+ 8
- 0
modules/juce_dsp/processors/juce_DelayLine.h View File

@@ -112,6 +112,14 @@ public:
/** Initialises the processor. */
void prepare (const ProcessSpec& spec);
/** Sets a new maximum delay in samples.
Also clears the delay line.
This may allocate internally, so you should never call it from the audio thread.
*/
void setMaximumDelayInSamples (int maxDelayInSamples);
/** Resets the internal state variables of the processor. */
void reset();


Loading…
Cancel
Save