| 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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 { | 97 { |
| 98 // The channelCount for the input to this node controls the actual number of
channels we | 98 // The channelCount for the input to this node controls the actual number of
channels we |
| 99 // send to the audio hardware. It can only be set depending on the maximum n
umber of | 99 // send to the audio hardware. It can only be set depending on the maximum n
umber of |
| 100 // channels supported by the hardware. | 100 // channels supported by the hardware. |
| 101 | 101 |
| 102 ASSERT(isMainThread()); | 102 ASSERT(isMainThread()); |
| 103 | 103 |
| 104 if (!maxChannelCount() || channelCount > maxChannelCount()) { | 104 if (!maxChannelCount() || channelCount > maxChannelCount()) { |
| 105 exceptionState.throwDOMException( | 105 exceptionState.throwDOMException( |
| 106 IndexSizeError, | 106 IndexSizeError, |
| 107 ExceptionMessages::failedToSet( | 107 ExceptionMessages::indexOutsideRange<unsigned>("channel count", chan
nelCount, 1, ExceptionMessages::InclusiveBound, maxChannelCount(), ExceptionMess
ages::InclusiveBound)); |
| 108 "channelCount", | |
| 109 "AudioDestinationNode", | |
| 110 "channel count (" + String::number(channelCount) | |
| 111 + ") must be between 1 and " | |
| 112 + String::number(maxChannelCount()) + ".")); | |
| 113 return; | 108 return; |
| 114 } | 109 } |
| 115 | 110 |
| 116 unsigned long oldChannelCount = this->channelCount(); | 111 unsigned long oldChannelCount = this->channelCount(); |
| 117 AudioNode::setChannelCount(channelCount, exceptionState); | 112 AudioNode::setChannelCount(channelCount, exceptionState); |
| 118 | 113 |
| 119 if (!exceptionState.hadException() && this->channelCount() != oldChannelCoun
t && isInitialized()) { | 114 if (!exceptionState.hadException() && this->channelCount() != oldChannelCoun
t && isInitialized()) { |
| 120 // Re-create destination. | 115 // Re-create destination. |
| 121 m_destination->stop(); | 116 m_destination->stop(); |
| 122 createDestination(); | 117 createDestination(); |
| 123 m_destination->start(); | 118 m_destination->start(); |
| 124 } | 119 } |
| 125 } | 120 } |
| 126 | 121 |
| 127 } // namespace WebCore | 122 } // namespace WebCore |
| 128 | 123 |
| 129 #endif // ENABLE(WEB_AUDIO) | 124 #endif // ENABLE(WEB_AUDIO) |
| OLD | NEW |