1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

DelayLine: Add function to retrieve the maximum possible delay time

This commit is contained in:
reuk 2021-09-28 10:25:02 +01:00
parent 4c95897ad3
commit fad3490946
No known key found for this signature in database
GPG key ID: 9ADCD339CFC98A11
2 changed files with 8 additions and 1 deletions

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);

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();