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