| 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 * 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 10 matching lines...) Expand all Loading... |
| 21 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | 21 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
| 22 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 22 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 23 */ | 23 */ |
| 24 | 24 |
| 25 #include "config.h" | 25 #include "config.h" |
| 26 | 26 |
| 27 #if ENABLE(WEB_AUDIO) | 27 #if ENABLE(WEB_AUDIO) |
| 28 | 28 |
| 29 #include "modules/webaudio/AudioBufferSourceNode.h" | 29 #include "modules/webaudio/AudioBufferSourceNode.h" |
| 30 | 30 |
| 31 #include "bindings/v8/ExceptionMessages.h" | |
| 32 #include "bindings/v8/ExceptionState.h" | 31 #include "bindings/v8/ExceptionState.h" |
| 33 #include "core/dom/ExceptionCode.h" | 32 #include "core/dom/ExceptionCode.h" |
| 34 #include "core/page/PageConsole.h" | 33 #include "core/page/PageConsole.h" |
| 35 #include "platform/audio/AudioUtilities.h" | 34 #include "platform/audio/AudioUtilities.h" |
| 36 #include "modules/webaudio/AudioContext.h" | 35 #include "modules/webaudio/AudioContext.h" |
| 37 #include "modules/webaudio/AudioNodeOutput.h" | 36 #include "modules/webaudio/AudioNodeOutput.h" |
| 38 #include "platform/FloatConversion.h" | 37 #include "platform/FloatConversion.h" |
| 39 #include "wtf/MainThread.h" | 38 #include "wtf/MainThread.h" |
| 40 #include "wtf/MathExtras.h" | 39 #include "wtf/MathExtras.h" |
| 41 #include <algorithm> | 40 #include <algorithm> |
| (...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 403 startPlaying(true, when, grainOffset, grainDuration, exceptionState); | 402 startPlaying(true, when, grainOffset, grainDuration, exceptionState); |
| 404 } | 403 } |
| 405 | 404 |
| 406 void AudioBufferSourceNode::startPlaying(bool isGrain, double when, double grain
Offset, double grainDuration, ExceptionState& exceptionState) | 405 void AudioBufferSourceNode::startPlaying(bool isGrain, double when, double grain
Offset, double grainDuration, ExceptionState& exceptionState) |
| 407 { | 406 { |
| 408 ASSERT(isMainThread()); | 407 ASSERT(isMainThread()); |
| 409 | 408 |
| 410 if (m_playbackState != UNSCHEDULED_STATE) { | 409 if (m_playbackState != UNSCHEDULED_STATE) { |
| 411 exceptionState.throwDOMException( | 410 exceptionState.throwDOMException( |
| 412 InvalidStateError, | 411 InvalidStateError, |
| 413 ExceptionMessages::failedToExecute( | 412 "cannot call start more than once."); |
| 414 "start", | |
| 415 nodeTypeName(), | |
| 416 "cannot call start more than once.")); | |
| 417 return; | 413 return; |
| 418 } | 414 } |
| 419 | 415 |
| 420 if (!buffer()) | 416 if (!buffer()) |
| 421 return; | 417 return; |
| 422 | 418 |
| 423 if (isGrain) { | 419 if (isGrain) { |
| 424 // Do sanity checking of grain parameters versus buffer size. | 420 // Do sanity checking of grain parameters versus buffer size. |
| 425 double bufferDuration = buffer()->duration(); | 421 double bufferDuration = buffer()->duration(); |
| 426 | 422 |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 513 void AudioBufferSourceNode::finish() | 509 void AudioBufferSourceNode::finish() |
| 514 { | 510 { |
| 515 clearPannerNode(); | 511 clearPannerNode(); |
| 516 ASSERT(!m_pannerNode); | 512 ASSERT(!m_pannerNode); |
| 517 AudioScheduledSourceNode::finish(); | 513 AudioScheduledSourceNode::finish(); |
| 518 } | 514 } |
| 519 | 515 |
| 520 } // namespace WebCore | 516 } // namespace WebCore |
| 521 | 517 |
| 522 #endif // ENABLE(WEB_AUDIO) | 518 #endif // ENABLE(WEB_AUDIO) |
| OLD | NEW |