93template <
typename SampleType,
typename InterpolationType = DelayLineInterpolationTypes::Linear>
102 explicit DelayLine (
int maximumDelayInSamples);
106 void setDelay (SampleType newDelayInSamples);
142 void pushSample (
int channel, SampleType
sample);
161 SampleType popSample (
int channel, SampleType delayInSamples = -1,
bool updateReadPointer =
true);
171 template <
typename ProcessContext>
172 void process (
const ProcessContext& context)
noexcept
174 const auto& inputBlock = context.getInputBlock();
175 auto& outputBlock = context.getOutputBlock();
176 const auto numChannels = outputBlock.getNumChannels();
177 const auto numSamples = outputBlock.getNumSamples();
179 jassert (inputBlock.getNumChannels() == numChannels);
181 jassert (inputBlock.getNumSamples() == numSamples);
183 if (context.isBypassed)
185 outputBlock.copyFrom (inputBlock);
189 for (
size_t channel = 0; channel < numChannels; ++channel)
191 auto* inputSamples = inputBlock.getChannelPointer (channel);
192 auto* outputSamples = outputBlock.getChannelPointer (channel);
194 for (
size_t i = 0;
i < numSamples; ++
i)
204 template <
typename T = InterpolationType>
205 typename std::enable_if <std::is_same <T, DelayLineInterpolationTypes::None>::value, SampleType>
::type
212 template <
typename T = InterpolationType>
213 typename std::enable_if <std::is_same <T, DelayLineInterpolationTypes::Linear>::value, SampleType>
::type
217 auto index2 = index1 + 1;
225 auto value1 =
bufferData.getSample (channel, index1);
226 auto value2 =
bufferData.getSample (channel, index2);
228 return value1 +
delayFrac * (value2 - value1);
231 template <
typename T = InterpolationType>
232 typename std::enable_if <std::is_same <T, DelayLineInterpolationTypes::Lagrange3rd>::value, SampleType>
::type
236 auto index2 = index1 + 1;
237 auto index3 = index2 + 1;
238 auto index4 = index3 + 1;
248 auto* samples =
bufferData.getReadPointer (channel);
250 auto value1 = samples[index1];
251 auto value2 = samples[index2];
252 auto value3 = samples[index3];
253 auto value4 = samples[index4];
259 auto c1 = -d1 * d2 * d3 / 6.f;
260 auto c2 = d2 * d3 * 0.5f;
261 auto c3 = -d1 * d3 * 0.5f;
262 auto c4 = d1 * d2 / 6.f;
264 return value1 * c1 +
delayFrac * (value2 *
c2 + value3 * c3 + value4 *
c4);
267 template <
typename T = InterpolationType>
268 typename std::enable_if <std::is_same <T, DelayLineInterpolationTypes::Thiran>::value, SampleType>
::type
272 auto index2 = index1 + 1;
280 auto value1 =
bufferData.getSample (channel, index1);
281 auto value2 =
bufferData.getSample (channel, index2);
283 auto output =
delayFrac == 0 ? value1 : value2 +
alpha * (value1 -
v[(size_t) channel]);
284 v[(size_t) channel] = output;
290 template <
typename T = InterpolationType>
291 typename std::enable_if <std::is_same <T, DelayLineInterpolationTypes::None>::value,
void>
::type
296 template <
typename T = InterpolationType>
297 typename std::enable_if <std::is_same <T, DelayLineInterpolationTypes::Linear>::value,
void>
::type
302 template <
typename T = InterpolationType>
303 typename std::enable_if <std::is_same <T, DelayLineInterpolationTypes::Lagrange3rd>::value,
void>
::type
313 template <
typename T = InterpolationType>
314 typename std::enable_if <std::is_same <T, DelayLineInterpolationTypes::Thiran>::value,
void>
::type
331 std::vector<SampleType>
v;
#define noexcept
Definition DistrhoDefines.h:72
CAdPlugDatabase::CRecord::RecordType type
Definition adplugdb.cpp:93
Definition juce_AudioSampleBuffer.h:34
std::enable_if< std::is_same< T, DelayLineInterpolationTypes::None >::value, void >::type updateInternalVariables()
Definition juce_DelayLine.h:292
int getMaximumDelayInSamples() const noexcept
Definition juce_DelayLine.h:128
void pushSample(int channel, SampleType sample)
Definition juce_DelayLine.cpp:107
std::vector< SampleType > v
Definition juce_DelayLine.h:331
SampleType alpha
Definition juce_DelayLine.h:335
std::enable_if< std::is_same< T, DelayLineInterpolationTypes::Lagrange3rd >::value, void >::type updateInternalVariables()
Definition juce_DelayLine.h:304
AudioBuffer< SampleType > bufferData
Definition juce_DelayLine.h:330
DelayLine()
Definition juce_DelayLine.cpp:33
std::enable_if< std::is_same< T, DelayLineInterpolationTypes::Linear >::value, SampleType >::type interpolateSample(int channel) const
Definition juce_DelayLine.h:214
SampleType delayFrac
Definition juce_DelayLine.h:333
void setDelay(SampleType newDelayInSamples)
Definition juce_DelayLine.cpp:50
std::enable_if< std::is_same< T, DelayLineInterpolationTypes::Linear >::value, void >::type updateInternalVariables()
Definition juce_DelayLine.h:298
std::enable_if< std::is_same< T, DelayLineInterpolationTypes::Thiran >::value, SampleType >::type interpolateSample(int channel)
Definition juce_DelayLine.h:269
std::vector< int > readPos
Definition juce_DelayLine.h:332
std::vector< int > writePos
Definition juce_DelayLine.h:332
double sampleRate
Definition juce_DelayLine.h:327
void setMaximumDelayInSamples(int maxDelayInSamples)
Definition juce_DelayLine.cpp:86
std::enable_if< std::is_same< T, DelayLineInterpolationTypes::None >::value, SampleType >::type interpolateSample(int channel) const
Definition juce_DelayLine.h:206
int delayInt
Definition juce_DelayLine.h:334
std::enable_if< std::is_same< T, DelayLineInterpolationTypes::Lagrange3rd >::value, SampleType >::type interpolateSample(int channel) const
Definition juce_DelayLine.h:233
void process(const ProcessContext &context) noexcept
Definition juce_DelayLine.h:172
int totalSize
Definition juce_DelayLine.h:334
SampleType getDelay() const
Definition juce_DelayLine.cpp:63
void prepare(const ProcessSpec &spec)
Definition juce_DelayLine.cpp:70
SampleType delay
Definition juce_DelayLine.h:333
SampleType popSample(int channel, SampleType delayInSamples=-1, bool updateReadPointer=true)
Definition juce_DelayLine.cpp:114
std::enable_if< std::is_same< T, DelayLineInterpolationTypes::Thiran >::value, void >::type updateInternalVariables()
Definition juce_DelayLine.h:315
register unsigned i
Definition inflate.c:1575
static void c2(register WDL_FFT_COMPLEX *a)
Definition fft.c:270
static void c4(register WDL_FFT_COMPLEX *a)
Definition fft.c:283
Definition juce_DelayLine.h:37
Definition juce_AudioBlock.h:29
Definition carla_juce.cpp:31
Definition juce_DelayLine.h:65
Definition juce_DelayLine.h:55
Definition juce_DelayLine.h:45
Definition juce_DelayLine.h:76
Definition juce_ProcessContext.h:38
signed int sample
Definition tap_dynamics_m.c:41
#define const
Definition zconf.h:137