| 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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 | 120 |
| 121 // Wrap the AudioBuffer by an AudioBus. It's an efficient pointer set and no
t a memcpy(). | 121 // Wrap the AudioBuffer by an AudioBus. It's an efficient pointer set and no
t a memcpy(). |
| 122 // This memory is simply used in the Reverb constructor and no reference to
it is kept for later use in that class. | 122 // This memory is simply used in the Reverb constructor and no reference to
it is kept for later use in that class. |
| 123 RefPtr<AudioBus> bufferBus = AudioBus::create(numberOfChannels, bufferLength
, false); | 123 RefPtr<AudioBus> bufferBus = AudioBus::create(numberOfChannels, bufferLength
, false); |
| 124 for (unsigned i = 0; i < numberOfChannels; ++i) | 124 for (unsigned i = 0; i < numberOfChannels; ++i) |
| 125 bufferBus->setChannelMemory(i, buffer->getChannelData(i)->data(), buffer
Length); | 125 bufferBus->setChannelMemory(i, buffer->getChannelData(i)->data(), buffer
Length); |
| 126 | 126 |
| 127 bufferBus->setSampleRate(buffer->sampleRate()); | 127 bufferBus->setSampleRate(buffer->sampleRate()); |
| 128 | 128 |
| 129 // Create the reverb with the given impulse response. | 129 // Create the reverb with the given impulse response. |
| 130 bool useBackgroundThreads = !context()->isOfflineContext(); | 130 OwnPtr<Reverb> reverb = adoptPtr(new Reverb(bufferBus.get(), ProcessingSizeI
nFrames, MaxFFTSize, 2, context() && context()->hasRealtimeConstraint(), m_norma
lize)); |
| 131 OwnPtr<Reverb> reverb = adoptPtr(new Reverb(bufferBus.get(), ProcessingSizeI
nFrames, MaxFFTSize, 2, useBackgroundThreads, m_normalize)); | |
| 132 | 131 |
| 133 { | 132 { |
| 134 // Synchronize with process(). | 133 // Synchronize with process(). |
| 135 MutexLocker locker(m_processLock); | 134 MutexLocker locker(m_processLock); |
| 136 m_reverb = reverb.release(); | 135 m_reverb = reverb.release(); |
| 137 m_buffer = buffer; | 136 m_buffer = buffer; |
| 138 } | 137 } |
| 139 } | 138 } |
| 140 | 139 |
| 141 AudioBuffer* ConvolverHandler::buffer() | 140 AudioBuffer* ConvolverHandler::buffer() |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 } | 197 } |
| 199 | 198 |
| 200 void ConvolverNode::setNormalize(bool normalize) | 199 void ConvolverNode::setNormalize(bool normalize) |
| 201 { | 200 { |
| 202 convolverHandler().setNormalize(normalize); | 201 convolverHandler().setNormalize(normalize); |
| 203 } | 202 } |
| 204 | 203 |
| 205 } // namespace blink | 204 } // namespace blink |
| 206 | 205 |
| 207 #endif // ENABLE(WEB_AUDIO) | 206 #endif // ENABLE(WEB_AUDIO) |
| OLD | NEW |