| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011, Google Inc. All rights reserved. | 2 * Copyright (C) 2011, 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 22 matching lines...) Expand all Loading... |
| 33 namespace blink { | 33 namespace blink { |
| 34 | 34 |
| 35 WaveShaperDSPKernel::WaveShaperDSPKernel(WaveShaperProcessor* processor) | 35 WaveShaperDSPKernel::WaveShaperDSPKernel(WaveShaperProcessor* processor) |
| 36 : AudioDSPKernel(processor) { | 36 : AudioDSPKernel(processor) { |
| 37 if (processor->oversample() != WaveShaperProcessor::OverSampleNone) | 37 if (processor->oversample() != WaveShaperProcessor::OverSampleNone) |
| 38 lazyInitializeOversampling(); | 38 lazyInitializeOversampling(); |
| 39 } | 39 } |
| 40 | 40 |
| 41 void WaveShaperDSPKernel::lazyInitializeOversampling() { | 41 void WaveShaperDSPKernel::lazyInitializeOversampling() { |
| 42 if (!m_tempBuffer) { | 42 if (!m_tempBuffer) { |
| 43 m_tempBuffer = wrapUnique( | 43 m_tempBuffer = WTF::wrapUnique( |
| 44 new AudioFloatArray(AudioUtilities::kRenderQuantumFrames * 2)); | 44 new AudioFloatArray(AudioUtilities::kRenderQuantumFrames * 2)); |
| 45 m_tempBuffer2 = wrapUnique( | 45 m_tempBuffer2 = WTF::wrapUnique( |
| 46 new AudioFloatArray(AudioUtilities::kRenderQuantumFrames * 4)); | 46 new AudioFloatArray(AudioUtilities::kRenderQuantumFrames * 4)); |
| 47 m_upSampler = | 47 m_upSampler = |
| 48 wrapUnique(new UpSampler(AudioUtilities::kRenderQuantumFrames)); | 48 WTF::wrapUnique(new UpSampler(AudioUtilities::kRenderQuantumFrames)); |
| 49 m_downSampler = | 49 m_downSampler = WTF::wrapUnique( |
| 50 wrapUnique(new DownSampler(AudioUtilities::kRenderQuantumFrames * 2)); | 50 new DownSampler(AudioUtilities::kRenderQuantumFrames * 2)); |
| 51 m_upSampler2 = | 51 m_upSampler2 = WTF::wrapUnique( |
| 52 wrapUnique(new UpSampler(AudioUtilities::kRenderQuantumFrames * 2)); | 52 new UpSampler(AudioUtilities::kRenderQuantumFrames * 2)); |
| 53 m_downSampler2 = | 53 m_downSampler2 = WTF::wrapUnique( |
| 54 wrapUnique(new DownSampler(AudioUtilities::kRenderQuantumFrames * 4)); | 54 new DownSampler(AudioUtilities::kRenderQuantumFrames * 4)); |
| 55 } | 55 } |
| 56 } | 56 } |
| 57 | 57 |
| 58 void WaveShaperDSPKernel::process(const float* source, | 58 void WaveShaperDSPKernel::process(const float* source, |
| 59 float* destination, | 59 float* destination, |
| 60 size_t framesToProcess) { | 60 size_t framesToProcess) { |
| 61 switch (getWaveShaperProcessor()->oversample()) { | 61 switch (getWaveShaperProcessor()->oversample()) { |
| 62 case WaveShaperProcessor::OverSampleNone: | 62 case WaveShaperProcessor::OverSampleNone: |
| 63 processCurve(source, destination, framesToProcess); | 63 processCurve(source, destination, framesToProcess); |
| 64 break; | 64 break; |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 break; | 204 break; |
| 205 } | 205 } |
| 206 default: | 206 default: |
| 207 ASSERT_NOT_REACHED(); | 207 ASSERT_NOT_REACHED(); |
| 208 } | 208 } |
| 209 | 209 |
| 210 return static_cast<double>(latencyFrames) / sampleRate(); | 210 return static_cast<double>(latencyFrames) / sampleRate(); |
| 211 } | 211 } |
| 212 | 212 |
| 213 } // namespace blink | 213 } // namespace blink |
| OLD | NEW |