This source file includes following definitions.
- hasSampleAccurateValues
- calculateSampleAccurateValues
- delayTime
#include "config.h"
#if ENABLE(WEB_AUDIO)
#include "modules/webaudio/DelayDSPKernel.h"
#include "platform/audio/AudioUtilities.h"
#include "wtf/MathExtras.h"
#include <algorithm>
using namespace std;
namespace WebCore {
const float SmoothingTimeConstant = 0.020f;
DelayDSPKernel::DelayDSPKernel(DelayProcessor* processor)
: AudioDelayDSPKernel(processor, AudioNode::ProcessingSizeInFrames)
{
ASSERT(processor && processor->sampleRate() > 0);
if (!(processor && processor->sampleRate() > 0))
return;
m_maxDelayTime = processor->maxDelayTime();
ASSERT(m_maxDelayTime >= 0 && !std::isnan(m_maxDelayTime));
if (m_maxDelayTime < 0 || std::isnan(m_maxDelayTime))
return;
m_buffer.allocate(bufferLengthForDelay(m_maxDelayTime, processor->sampleRate()));
m_buffer.zero();
m_smoothingRate = AudioUtilities::discreteTimeConstantForSampleRate(SmoothingTimeConstant, processor->sampleRate());
}
bool DelayDSPKernel::hasSampleAccurateValues()
{
return delayProcessor()->delayTime()->hasSampleAccurateValues();
}
void DelayDSPKernel::calculateSampleAccurateValues(float* delayTimes, size_t framesToProcess)
{
delayProcessor()->delayTime()->calculateSampleAccurateValues(delayTimes, framesToProcess);
}
double DelayDSPKernel::delayTime(float)
{
return delayProcessor()->delayTime()->finalValue();
}
}
#endif