| 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 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 AudioBuffer* ConvolverHandler::buffer() { | 151 AudioBuffer* ConvolverHandler::buffer() { |
| 152 DCHECK(isMainThread()); | 152 DCHECK(isMainThread()); |
| 153 return m_buffer.get(); | 153 return m_buffer.get(); |
| 154 } | 154 } |
| 155 | 155 |
| 156 double ConvolverHandler::tailTime() const { | 156 double ConvolverHandler::tailTime() const { |
| 157 MutexTryLocker tryLocker(m_processLock); | 157 MutexTryLocker tryLocker(m_processLock); |
| 158 if (tryLocker.locked()) | 158 if (tryLocker.locked()) |
| 159 return m_reverb | 159 return m_reverb |
| 160 ? m_reverb->impulseResponseLength() / | 160 ? m_reverb->impulseResponseLength() / |
| 161 static_cast<double>(sampleRate()) | 161 static_cast<double>(context()->sampleRate()) |
| 162 : 0; | 162 : 0; |
| 163 // Since we don't want to block the Audio Device thread, we return a large | 163 // Since we don't want to block the Audio Device thread, we return a large |
| 164 // value instead of trying to acquire the lock. | 164 // value instead of trying to acquire the lock. |
| 165 return std::numeric_limits<double>::infinity(); | 165 return std::numeric_limits<double>::infinity(); |
| 166 } | 166 } |
| 167 | 167 |
| 168 double ConvolverHandler::latencyTime() const { | 168 double ConvolverHandler::latencyTime() const { |
| 169 MutexTryLocker tryLocker(m_processLock); | 169 MutexTryLocker tryLocker(m_processLock); |
| 170 if (tryLocker.locked()) | 170 if (tryLocker.locked()) |
| 171 return m_reverb | 171 return m_reverb |
| 172 ? m_reverb->latencyFrames() / static_cast<double>(sampleRate()) | 172 ? m_reverb->latencyFrames() / |
| 173 static_cast<double>(context()->sampleRate()) |
| 173 : 0; | 174 : 0; |
| 174 // Since we don't want to block the Audio Device thread, we return a large | 175 // Since we don't want to block the Audio Device thread, we return a large |
| 175 // value instead of trying to acquire the lock. | 176 // value instead of trying to acquire the lock. |
| 176 return std::numeric_limits<double>::infinity(); | 177 return std::numeric_limits<double>::infinity(); |
| 177 } | 178 } |
| 178 | 179 |
| 179 // ---------------------------------------------------------------- | 180 // ---------------------------------------------------------------- |
| 180 | 181 |
| 181 ConvolverNode::ConvolverNode(BaseAudioContext& context) : AudioNode(context) { | 182 ConvolverNode::ConvolverNode(BaseAudioContext& context) : AudioNode(context) { |
| 182 setHandler(ConvolverHandler::create(*this, context.sampleRate())); | 183 setHandler(ConvolverHandler::create(*this, context.sampleRate())); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 | 228 |
| 228 bool ConvolverNode::normalize() const { | 229 bool ConvolverNode::normalize() const { |
| 229 return convolverHandler().normalize(); | 230 return convolverHandler().normalize(); |
| 230 } | 231 } |
| 231 | 232 |
| 232 void ConvolverNode::setNormalize(bool normalize) { | 233 void ConvolverNode::setNormalize(bool normalize) { |
| 233 convolverHandler().setNormalize(normalize); | 234 convolverHandler().setNormalize(normalize); |
| 234 } | 235 } |
| 235 | 236 |
| 236 } // namespace blink | 237 } // namespace blink |
| OLD | NEW |