| 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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 } | 90 } |
| 91 | 91 |
| 92 void AudioBuffer::releaseMemory() | 92 void AudioBuffer::releaseMemory() |
| 93 { | 93 { |
| 94 m_channels.clear(); | 94 m_channels.clear(); |
| 95 } | 95 } |
| 96 | 96 |
| 97 PassRefPtr<Float32Array> AudioBuffer::getChannelData(unsigned channelIndex, Exce
ptionState& es) | 97 PassRefPtr<Float32Array> AudioBuffer::getChannelData(unsigned channelIndex, Exce
ptionState& es) |
| 98 { | 98 { |
| 99 if (channelIndex >= m_channels.size()) { | 99 if (channelIndex >= m_channels.size()) { |
| 100 es.throwDOMException(SyntaxError); | 100 es.throwUninformativeAndGenericDOMException(SyntaxError); |
| 101 return 0; | 101 return 0; |
| 102 } | 102 } |
| 103 | 103 |
| 104 Float32Array* channelData = m_channels[channelIndex].get(); | 104 Float32Array* channelData = m_channels[channelIndex].get(); |
| 105 return Float32Array::create(channelData->buffer(), channelData->byteOffset()
, channelData->length()); | 105 return Float32Array::create(channelData->buffer(), channelData->byteOffset()
, channelData->length()); |
| 106 } | 106 } |
| 107 | 107 |
| 108 Float32Array* AudioBuffer::getChannelData(unsigned channelIndex) | 108 Float32Array* AudioBuffer::getChannelData(unsigned channelIndex) |
| 109 { | 109 { |
| 110 if (channelIndex >= m_channels.size()) | 110 if (channelIndex >= m_channels.size()) |
| 111 return 0; | 111 return 0; |
| 112 | 112 |
| 113 return m_channels[channelIndex].get(); | 113 return m_channels[channelIndex].get(); |
| 114 } | 114 } |
| 115 | 115 |
| 116 void AudioBuffer::zero() | 116 void AudioBuffer::zero() |
| 117 { | 117 { |
| 118 for (unsigned i = 0; i < m_channels.size(); ++i) { | 118 for (unsigned i = 0; i < m_channels.size(); ++i) { |
| 119 if (getChannelData(i)) | 119 if (getChannelData(i)) |
| 120 getChannelData(i)->zeroRange(0, length()); | 120 getChannelData(i)->zeroRange(0, length()); |
| 121 } | 121 } |
| 122 } | 122 } |
| 123 | 123 |
| 124 } // namespace WebCore | 124 } // namespace WebCore |
| 125 | 125 |
| 126 #endif // ENABLE(WEB_AUDIO) | 126 #endif // ENABLE(WEB_AUDIO) |
| OLD | NEW |