| 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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 | 112 |
| 113 void DefaultAudioDestinationNode::setChannelCount(unsigned long channelCount, Ex
ceptionState& es) | 113 void DefaultAudioDestinationNode::setChannelCount(unsigned long channelCount, Ex
ceptionState& es) |
| 114 { | 114 { |
| 115 // The channelCount for the input to this node controls the actual number of
channels we | 115 // The channelCount for the input to this node controls the actual number of
channels we |
| 116 // send to the audio hardware. It can only be set depending on the maximum n
umber of | 116 // send to the audio hardware. It can only be set depending on the maximum n
umber of |
| 117 // channels supported by the hardware. | 117 // channels supported by the hardware. |
| 118 | 118 |
| 119 ASSERT(isMainThread()); | 119 ASSERT(isMainThread()); |
| 120 | 120 |
| 121 if (!maxChannelCount() || channelCount > maxChannelCount()) { | 121 if (!maxChannelCount() || channelCount > maxChannelCount()) { |
| 122 es.throwDOMException(InvalidStateError); | 122 es.throwUninformativeAndGenericDOMException(InvalidStateError); |
| 123 return; | 123 return; |
| 124 } | 124 } |
| 125 | 125 |
| 126 unsigned long oldChannelCount = this->channelCount(); | 126 unsigned long oldChannelCount = this->channelCount(); |
| 127 AudioNode::setChannelCount(channelCount, es); | 127 AudioNode::setChannelCount(channelCount, es); |
| 128 | 128 |
| 129 if (!es.hadException() && this->channelCount() != oldChannelCount && isIniti
alized()) { | 129 if (!es.hadException() && this->channelCount() != oldChannelCount && isIniti
alized()) { |
| 130 // Re-create destination. | 130 // Re-create destination. |
| 131 m_destination->stop(); | 131 m_destination->stop(); |
| 132 createDestination(); | 132 createDestination(); |
| 133 m_destination->start(); | 133 m_destination->start(); |
| 134 } | 134 } |
| 135 } | 135 } |
| 136 | 136 |
| 137 } // namespace WebCore | 137 } // namespace WebCore |
| 138 | 138 |
| 139 #endif // ENABLE(WEB_AUDIO) | 139 #endif // ENABLE(WEB_AUDIO) |
| OLD | NEW |