| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011, Google Inc. All rights reserved. | 2 * Copyright (C) 2011, 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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 ASSERT(isInitialized()); | 104 ASSERT(isInitialized()); |
| 105 if (isInitialized()) | 105 if (isInitialized()) |
| 106 m_destination->start(); | 106 m_destination->start(); |
| 107 } | 107 } |
| 108 | 108 |
| 109 unsigned long DefaultAudioDestinationNode::maxChannelCount() const | 109 unsigned long DefaultAudioDestinationNode::maxChannelCount() const |
| 110 { | 110 { |
| 111 return AudioDestination::maxChannelCount(); | 111 return AudioDestination::maxChannelCount(); |
| 112 } | 112 } |
| 113 | 113 |
| 114 void DefaultAudioDestinationNode::setChannelCount(unsigned long channelCount, Ex
ceptionState& es) | 114 void DefaultAudioDestinationNode::setChannelCount(unsigned long channelCount, Ex
ceptionState& exceptionState) |
| 115 { | 115 { |
| 116 // The channelCount for the input to this node controls the actual number of
channels we | 116 // The channelCount for the input to this node controls the actual number of
channels we |
| 117 // send to the audio hardware. It can only be set depending on the maximum n
umber of | 117 // send to the audio hardware. It can only be set depending on the maximum n
umber of |
| 118 // channels supported by the hardware. | 118 // channels supported by the hardware. |
| 119 | 119 |
| 120 ASSERT(isMainThread()); | 120 ASSERT(isMainThread()); |
| 121 | 121 |
| 122 if (!maxChannelCount() || channelCount > maxChannelCount()) { | 122 if (!maxChannelCount() || channelCount > maxChannelCount()) { |
| 123 es.throwDOMException( | 123 exceptionState.throwDOMException( |
| 124 IndexSizeError, | 124 IndexSizeError, |
| 125 ExceptionMessages::failedToSet( | 125 ExceptionMessages::failedToSet( |
| 126 "channelCount", | 126 "channelCount", |
| 127 "AudioDestinationNode", | 127 "AudioDestinationNode", |
| 128 "channel count (" + String::number(channelCount) | 128 "channel count (" + String::number(channelCount) |
| 129 + ") must be between 1 and " | 129 + ") must be between 1 and " |
| 130 + String::number(maxChannelCount()) + ".")); | 130 + String::number(maxChannelCount()) + ".")); |
| 131 return; | 131 return; |
| 132 } | 132 } |
| 133 | 133 |
| 134 unsigned long oldChannelCount = this->channelCount(); | 134 unsigned long oldChannelCount = this->channelCount(); |
| 135 AudioNode::setChannelCount(channelCount, es); | 135 AudioNode::setChannelCount(channelCount, exceptionState); |
| 136 | 136 |
| 137 if (!es.hadException() && this->channelCount() != oldChannelCount && isIniti
alized()) { | 137 if (!exceptionState.hadException() && this->channelCount() != oldChannelCoun
t && isInitialized()) { |
| 138 // Re-create destination. | 138 // Re-create destination. |
| 139 m_destination->stop(); | 139 m_destination->stop(); |
| 140 createDestination(); | 140 createDestination(); |
| 141 m_destination->start(); | 141 m_destination->start(); |
| 142 } | 142 } |
| 143 } | 143 } |
| 144 | 144 |
| 145 } // namespace WebCore | 145 } // namespace WebCore |
| 146 | 146 |
| 147 #endif // ENABLE(WEB_AUDIO) | 147 #endif // ENABLE(WEB_AUDIO) |
| OLD | NEW |