| 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 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 | 110 |
| 111 // The reverb can handle a mono impulse response and still do stereo process
ing | 111 // The reverb can handle a mono impulse response and still do stereo process
ing |
| 112 size_t numResponseChannels = impulseResponseBuffer->numberOfChannels(); | 112 size_t numResponseChannels = impulseResponseBuffer->numberOfChannels(); |
| 113 m_convolvers.reserveCapacity(numberOfChannels); | 113 m_convolvers.reserveCapacity(numberOfChannels); |
| 114 | 114 |
| 115 int convolverRenderPhase = 0; | 115 int convolverRenderPhase = 0; |
| 116 for (size_t i = 0; i < numResponseChannels; ++i) { | 116 for (size_t i = 0; i < numResponseChannels; ++i) { |
| 117 AudioChannel* channel = impulseResponseBuffer->channel(i); | 117 AudioChannel* channel = impulseResponseBuffer->channel(i); |
| 118 | 118 |
| 119 OwnPtr<ReverbConvolver> convolver = adoptPtr(new ReverbConvolver(channel
, renderSliceSize, maxFFTSize, convolverRenderPhase, useBackgroundThreads)); | 119 OwnPtr<ReverbConvolver> convolver = adoptPtr(new ReverbConvolver(channel
, renderSliceSize, maxFFTSize, convolverRenderPhase, useBackgroundThreads)); |
| 120 m_convolvers.append(convolver.release()); | 120 m_convolvers.append(std::move(convolver)); |
| 121 | 121 |
| 122 convolverRenderPhase += renderSliceSize; | 122 convolverRenderPhase += renderSliceSize; |
| 123 } | 123 } |
| 124 | 124 |
| 125 // For "True" stereo processing we allocate a temporary buffer to avoid repe
atedly allocating it in the process() method. | 125 // For "True" stereo processing we allocate a temporary buffer to avoid repe
atedly allocating it in the process() method. |
| 126 // It can be bad to allocate memory in a real-time thread. | 126 // It can be bad to allocate memory in a real-time thread. |
| 127 if (numResponseChannels == 4) | 127 if (numResponseChannels == 4) |
| 128 m_tempBuffer = AudioBus::create(2, MaxFrameSize); | 128 m_tempBuffer = AudioBus::create(2, MaxFrameSize); |
| 129 } | 129 } |
| 130 | 130 |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 m_convolvers[i]->reset(); | 226 m_convolvers[i]->reset(); |
| 227 } | 227 } |
| 228 | 228 |
| 229 size_t Reverb::latencyFrames() const | 229 size_t Reverb::latencyFrames() const |
| 230 { | 230 { |
| 231 return !m_convolvers.isEmpty() ? m_convolvers.first()->latencyFrames() : 0; | 231 return !m_convolvers.isEmpty() ? m_convolvers.first()->latencyFrames() : 0; |
| 232 } | 232 } |
| 233 | 233 |
| 234 } // namespace blink | 234 } // namespace blink |
| 235 | 235 |
| OLD | NEW |