예제 #1
0
DelayDSPKernel::DelayDSPKernel(DelayProcessor* processor)
    : AudioDelayDSPKernel(processor, AudioHandler::ProcessingSizeInFrames)
{
    ASSERT(processor);
    ASSERT(processor->sampleRate() > 0);
    if (!(processor && processor->sampleRate() > 0))
        return;

    m_maxDelayTime = processor->maxDelayTime();
    ASSERT(m_maxDelayTime >= 0);
    ASSERT(!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());
}
예제 #2
0
DelayDSPKernel::DelayDSPKernel(DelayProcessor* processor)
    : AudioDSPKernel(processor)
    , m_writeIndex(0)
    , m_firstTime(true)
{
    ASSERT(processor && processor->sampleRate() > 0);
    if (!(processor && processor->sampleRate() > 0))
        return;

    m_maxDelayTime = processor->maxDelayTime();
    ASSERT(m_maxDelayTime >= 0);
    if (m_maxDelayTime < 0)
        return;
    
    m_buffer.allocate(bufferLengthForDelay(m_maxDelayTime, processor->sampleRate()));
    m_buffer.zero();

    m_smoothingRate = AudioUtilities::discreteTimeConstantForSampleRate(SmoothingTimeConstant, processor->sampleRate());
}
DelayDSPKernel::DelayDSPKernel(double maxDelayTime, float sampleRate)
    : AudioDSPKernel(sampleRate)
    , m_maxDelayTime(maxDelayTime)
    , m_writeIndex(0)
    , m_firstTime(true)
{
    ASSERT(maxDelayTime > 0.0);
    if (maxDelayTime <= 0.0)
        return;
        
    size_t bufferLength = bufferLengthForDelay(maxDelayTime, sampleRate);
    ASSERT(bufferLength);
    if (!bufferLength)
        return;
    
    m_buffer.allocate(bufferLength);
    m_buffer.zero();

    m_smoothingRate = AudioUtilities::discreteTimeConstantForSampleRate(SmoothingTimeConstant, sampleRate);
}
예제 #4
0
DelayDSPKernel::DelayDSPKernel(DelayProcessor* processor)
    : AudioDelayDSPKernel(processor, AudioUtilities::kRenderQuantumFrames) {
  DCHECK(processor);
  DCHECK_GT(processor->sampleRate(), 0);
  if (!(processor && processor->sampleRate() > 0))
    return;

  m_maxDelayTime = processor->maxDelayTime();
  DCHECK_GE(m_maxDelayTime, 0);
  DCHECK(!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());
}