| 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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 channelDataArray->setRange(bus->channel(i)->data(), m_length, 0); | 121 channelDataArray->setRange(bus->channel(i)->data(), m_length, 0); |
| 122 m_channels.append(channelDataArray); | 122 m_channels.append(channelDataArray); |
| 123 } | 123 } |
| 124 } | 124 } |
| 125 | 125 |
| 126 void AudioBuffer::releaseMemory() | 126 void AudioBuffer::releaseMemory() |
| 127 { | 127 { |
| 128 m_channels.clear(); | 128 m_channels.clear(); |
| 129 } | 129 } |
| 130 | 130 |
| 131 PassRefPtr<Float32Array> AudioBuffer::getChannelData(unsigned channelIndex, Exce
ptionState& es) | 131 PassRefPtr<Float32Array> AudioBuffer::getChannelData(unsigned channelIndex, Exce
ptionState& exceptionState) |
| 132 { | 132 { |
| 133 if (channelIndex >= m_channels.size()) { | 133 if (channelIndex >= m_channels.size()) { |
| 134 es.throwDOMException( | 134 exceptionState.throwDOMException( |
| 135 IndexSizeError, | 135 IndexSizeError, |
| 136 ExceptionMessages::failedToExecute( | 136 ExceptionMessages::failedToExecute( |
| 137 "getChannelData", | 137 "getChannelData", |
| 138 "AudioBuffer", | 138 "AudioBuffer", |
| 139 "channel index (" + String::number(channelIndex) + ") exceeds nu
mber of channels (" + String::number(m_channels.size()) + ")")); | 139 "channel index (" + String::number(channelIndex) + ") exceeds nu
mber of channels (" + String::number(m_channels.size()) + ")")); |
| 140 return 0; | 140 return 0; |
| 141 } | 141 } |
| 142 | 142 |
| 143 Float32Array* channelData = m_channels[channelIndex].get(); | 143 Float32Array* channelData = m_channels[channelIndex].get(); |
| 144 return Float32Array::create(channelData->buffer(), channelData->byteOffset()
, channelData->length()); | 144 return Float32Array::create(channelData->buffer(), channelData->byteOffset()
, channelData->length()); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 156 { | 156 { |
| 157 for (unsigned i = 0; i < m_channels.size(); ++i) { | 157 for (unsigned i = 0; i < m_channels.size(); ++i) { |
| 158 if (getChannelData(i)) | 158 if (getChannelData(i)) |
| 159 getChannelData(i)->zeroRange(0, length()); | 159 getChannelData(i)->zeroRange(0, length()); |
| 160 } | 160 } |
| 161 } | 161 } |
| 162 | 162 |
| 163 } // namespace WebCore | 163 } // namespace WebCore |
| 164 | 164 |
| 165 #endif // ENABLE(WEB_AUDIO) | 165 #endif // ENABLE(WEB_AUDIO) |
| OLD | NEW |