| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010, Google Inc. All rights reserved. | 2 * Copyright (C) 2010, Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 #include "modules/webaudio/DelayDSPKernel.h" | 26 #include "modules/webaudio/DelayDSPKernel.h" |
| 27 #include "platform/audio/AudioUtilities.h" | 27 #include "platform/audio/AudioUtilities.h" |
| 28 #include "wtf/MathExtras.h" | 28 #include "wtf/MathExtras.h" |
| 29 #include <algorithm> | 29 #include <algorithm> |
| 30 | 30 |
| 31 namespace blink { | 31 namespace blink { |
| 32 | 32 |
| 33 const float SmoothingTimeConstant = 0.020f; // 20ms | 33 const float SmoothingTimeConstant = 0.020f; // 20ms |
| 34 | 34 |
| 35 DelayDSPKernel::DelayDSPKernel(DelayProcessor* processor) | 35 DelayDSPKernel::DelayDSPKernel(DelayProcessor* processor) |
| 36 : AudioDelayDSPKernel(processor, AudioHandler::ProcessingSizeInFrames) { | 36 : AudioDelayDSPKernel(processor, AudioUtilities::kRenderQuantumFrames) { |
| 37 DCHECK(processor); | 37 DCHECK(processor); |
| 38 DCHECK_GT(processor->sampleRate(), 0); | 38 DCHECK_GT(processor->sampleRate(), 0); |
| 39 if (!(processor && processor->sampleRate() > 0)) | 39 if (!(processor && processor->sampleRate() > 0)) |
| 40 return; | 40 return; |
| 41 | 41 |
| 42 m_maxDelayTime = processor->maxDelayTime(); | 42 m_maxDelayTime = processor->maxDelayTime(); |
| 43 DCHECK_GE(m_maxDelayTime, 0); | 43 DCHECK_GE(m_maxDelayTime, 0); |
| 44 DCHECK(!std::isnan(m_maxDelayTime)); | 44 DCHECK(!std::isnan(m_maxDelayTime)); |
| 45 if (m_maxDelayTime < 0 || std::isnan(m_maxDelayTime)) | 45 if (m_maxDelayTime < 0 || std::isnan(m_maxDelayTime)) |
| 46 return; | 46 return; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 61 size_t framesToProcess) { | 61 size_t framesToProcess) { |
| 62 getDelayProcessor()->delayTime().calculateSampleAccurateValues( | 62 getDelayProcessor()->delayTime().calculateSampleAccurateValues( |
| 63 delayTimes, framesToProcess); | 63 delayTimes, framesToProcess); |
| 64 } | 64 } |
| 65 | 65 |
| 66 double DelayDSPKernel::delayTime(float) { | 66 double DelayDSPKernel::delayTime(float) { |
| 67 return getDelayProcessor()->delayTime().finalValue(); | 67 return getDelayProcessor()->delayTime().finalValue(); |
| 68 } | 68 } |
| 69 | 69 |
| 70 } // namespace blink | 70 } // namespace blink |
| OLD | NEW |