30template <
typename SampleType,
typename InterpolationType>
36template <
typename SampleType,
typename InterpolationType>
47template <
typename SampleType,
typename InterpolationType>
50 auto upperLimit = (SampleType) getMaximumDelayInSamples();
54 delayInt =
static_cast<int> (
std::floor (delay));
55 delayFrac = delay - (SampleType) delayInt;
57 updateInternalVariables();
60template <
typename SampleType,
typename InterpolationType>
67template <
typename SampleType,
typename InterpolationType>
72 bufferData.setSize ((
int)
spec.numChannels, totalSize,
false,
false,
true);
74 writePos.resize (
spec.numChannels);
75 readPos.resize (
spec.numChannels);
77 v.resize (
spec.numChannels);
78 sampleRate =
spec.sampleRate;
83template <
typename SampleType,
typename InterpolationType>
88 bufferData.setSize ((
int) bufferData.getNumChannels(), totalSize,
false,
false,
true);
92template <
typename SampleType,
typename InterpolationType>
95 for (
auto vec : { &writePos, &readPos })
98 std::fill (v.begin(), v.end(),
static_cast<SampleType
> (0));
104template <
typename SampleType,
typename InterpolationType>
107 bufferData.setSample (channel, writePos[(
size_t) channel], sample);
108 writePos[(
size_t) channel] = (writePos[(
size_t) channel] + totalSize - 1) % totalSize;
111template <
typename SampleType,
typename InterpolationType>
117 auto result = interpolateSample (channel);
120 readPos[(
size_t) channel] = (readPos[(
size_t) channel] + totalSize - 1) % totalSize;
A delay line processor featuring several algorithms for the fractional delay calculation,...
void prepare(const ProcessSpec &spec)
Initialises the processor.
void setDelay(SampleType newDelayInSamples)
Sets the delay in samples.
SampleType popSample(int channel, SampleType delayInSamples=-1, bool updateReadPointer=true)
Pops a single sample from one channel of the delay line.
DelayLine()
Default constructor.
void setMaximumDelayInSamples(int maxDelayInSamples)
Sets a new maximum delay in samples.
SampleType getDelay() const
Returns the current delay in samples.
void reset()
Resets the internal state variables of the processor.
void pushSample(int channel, SampleType sample)
Pushes a single sample into one channel of the delay line.
constexpr Type jmax(Type a, Type b)
Returns the larger of two values.
Type jlimit(Type lowerLimit, Type upperLimit, Type valueToConstrain) noexcept
Constrains a value to keep it within a given range.
Type unalignedPointerCast(void *ptr) noexcept
Casts a pointer to another type via void*, which suppresses the cast-align warning which sometimes ar...
bool isPositiveAndNotGreaterThan(Type1 valueToTest, Type2 upperLimit) noexcept
Returns true if a value is at least zero, and also less than or equal to a specified upper limit.
This structure is passed into a DSP algorithm's prepare() method, and contains information about vari...