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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 { | 94 { |
95 MutexLocker locker(m_processLock); | 95 MutexLocker locker(m_processLock); |
96 if (m_reverb.get()) | 96 if (m_reverb.get()) |
97 m_reverb->reset(); | 97 m_reverb->reset(); |
98 } | 98 } |
99 | 99 |
100 void ConvolverNode::initialize() | 100 void ConvolverNode::initialize() |
101 { | 101 { |
102 if (isInitialized()) | 102 if (isInitialized()) |
103 return; | 103 return; |
104 | 104 |
105 AudioNode::initialize(); | 105 AudioNode::initialize(); |
106 } | 106 } |
107 | 107 |
108 void ConvolverNode::uninitialize() | 108 void ConvolverNode::uninitialize() |
109 { | 109 { |
110 if (!isInitialized()) | 110 if (!isInitialized()) |
111 return; | 111 return; |
112 | 112 |
113 m_reverb.clear(); | 113 m_reverb.clear(); |
114 AudioNode::uninitialize(); | 114 AudioNode::uninitialize(); |
115 } | 115 } |
116 | 116 |
117 void ConvolverNode::setBuffer(AudioBuffer* buffer) | 117 void ConvolverNode::setBuffer(AudioBuffer* buffer) |
118 { | 118 { |
119 ASSERT(isMainThread()); | 119 ASSERT(isMainThread()); |
120 | 120 |
121 if (!buffer) | 121 if (!buffer) |
122 return; | 122 return; |
123 | 123 |
124 unsigned numberOfChannels = buffer->numberOfChannels(); | 124 unsigned numberOfChannels = buffer->numberOfChannels(); |
125 size_t bufferLength = buffer->length(); | 125 size_t bufferLength = buffer->length(); |
126 | 126 |
127 // The current implementation supports up to four channel impulse responses,
which are interpreted as true-stereo (see Reverb class). | 127 // The current implementation supports up to four channel impulse responses,
which are interpreted as true-stereo (see Reverb class). |
128 bool isBufferGood = numberOfChannels > 0 && numberOfChannels <= 4 && bufferL
ength; | 128 bool isBufferGood = numberOfChannels > 0 && numberOfChannels <= 4 && bufferL
ength; |
129 ASSERT(isBufferGood); | 129 ASSERT(isBufferGood); |
130 if (!isBufferGood) | 130 if (!isBufferGood) |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 } | 162 } |
163 | 163 |
164 double ConvolverNode::latencyTime() const | 164 double ConvolverNode::latencyTime() const |
165 { | 165 { |
166 return m_reverb ? m_reverb->latencyFrames() / static_cast<double>(sampleRate
()) : 0; | 166 return m_reverb ? m_reverb->latencyFrames() / static_cast<double>(sampleRate
()) : 0; |
167 } | 167 } |
168 | 168 |
169 } // namespace WebCore | 169 } // namespace WebCore |
170 | 170 |
171 #endif // ENABLE(WEB_AUDIO) | 171 #endif // ENABLE(WEB_AUDIO) |
OLD | NEW |