Browse Source

DelayLine: Add function to retrieve the maximum possible delay time

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

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

@@ -49,7 +49,7 @@ DelayLine<SampleType, InterpolationType>::DelayLine (int maximumDelayInSamples)
template <typename SampleType, typename InterpolationType>
void DelayLine<SampleType, InterpolationType>::setDelay (SampleType newDelayInSamples)
{
auto upperLimit = (SampleType) (totalSize - 1);
auto upperLimit = (SampleType) getMaximumDelayInSamples();
jassert (isPositiveAndNotGreaterThan (newDelayInSamples, upperLimit));
delay = jlimit ((SampleType) 0, upperLimit, newDelayInSamples);


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

@@ -120,6 +120,13 @@ public:
*/
void setMaximumDelayInSamples (int maxDelayInSamples);
/** Gets the maximum possible delay in samples.
For very short delay times, the result of getMaximumDelayInSamples() may
differ from the last value passed to setMaximumDelayInSamples().
*/
int getMaximumDelayInSamples() const noexcept { return totalSize - 1; }
/** Resets the internal state variables of the processor. */
void reset();


Loading…
Cancel
Save