From 484e53ecca981355300c7ae7fa22770bfdaa39a5 Mon Sep 17 00:00:00 2001 From: Praveen R Jadhav Date: Fri, 22 Mar 2013 21:22:36 +0900 Subject: [PATCH] Exception should be thrown when noteOn and noteOff are not called properly [Title] : Exception should be thrown when noteOn and noteOff are not called properly [Issue] : TWEB-1091 [Problem] : Exception handling mechanism implementation is not available [Solution] : Exception handling mechanism is implemented Change-Id: I92735f97e0df3481f46b06272e2215a7295d4283 --- .../Modules/webaudio/AudioBufferSourceNode.cpp | 28 ++++++++++++++++ .../Modules/webaudio/AudioBufferSourceNode.h | 15 ++++++++- .../Modules/webaudio/AudioBufferSourceNode.idl | 22 +++++++++++++ .../Modules/webaudio/AudioScheduledSourceNode.cpp | 38 ++++++++++++++++++++++ .../Modules/webaudio/AudioScheduledSourceNode.h | 14 ++++++++ Source/WebCore/Modules/webaudio/OscillatorNode.idl | 14 ++++++++ 6 files changed, 130 insertions(+), 1 deletion(-) diff --git a/Source/WebCore/Modules/webaudio/AudioBufferSourceNode.cpp b/Source/WebCore/Modules/webaudio/AudioBufferSourceNode.cpp index 42fdd7e..5903020 100644 --- a/Source/WebCore/Modules/webaudio/AudioBufferSourceNode.cpp +++ b/Source/WebCore/Modules/webaudio/AudioBufferSourceNode.cpp @@ -372,18 +372,37 @@ unsigned AudioBufferSourceNode::numberOfChannels() return output(0)->numberOfChannels(); } +#if ENABLE(TIZEN_WEB_AUDIO) +void AudioBufferSourceNode::startGrain(double when, double grainOffset, ExceptionCode& ec) +{ + // Duration of 0 has special value, meaning calculate based on the entire buffer's duration. + startGrain(when, grainOffset, 0, ec); +} +#else void AudioBufferSourceNode::startGrain(double when, double grainOffset) { // Duration of 0 has special value, meaning calculate based on the entire buffer's duration. startGrain(when, grainOffset, 0); } +#endif +#if ENABLE(TIZEN_WEB_AUDIO) +void AudioBufferSourceNode::startGrain(double when, double grainOffset, double grainDuration, ExceptionCode& ec) +#else void AudioBufferSourceNode::startGrain(double when, double grainOffset, double grainDuration) +#endif { ASSERT(isMainThread()); +#if ENABLE(TIZEN_WEB_AUDIO) + if (m_playbackState != UNSCHEDULED_STATE) { + ec = INVALID_STATE_ERR; + return; + } +#else if (m_playbackState != UNSCHEDULED_STATE) return; +#endif if (!buffer()) return; @@ -416,12 +435,21 @@ void AudioBufferSourceNode::startGrain(double when, double grainOffset, double g m_playbackState = SCHEDULED_STATE; } +#if ENABLE(TIZEN_WEB_AUDIO) +#if ENABLE(LEGACY_WEB_AUDIO) +void AudioBufferSourceNode::noteGrainOn(double when, double grainOffset, double grainDuration, ExceptionCode& ec) +{ + startGrain(when, grainOffset, grainDuration, ec); +} +#endif +#else #if ENABLE(LEGACY_WEB_AUDIO) void AudioBufferSourceNode::noteGrainOn(double when, double grainOffset, double grainDuration) { startGrain(when, grainOffset, grainDuration); } #endif +#endif double AudioBufferSourceNode::totalPitchRate() { diff --git a/Source/WebCore/Modules/webaudio/AudioBufferSourceNode.h b/Source/WebCore/Modules/webaudio/AudioBufferSourceNode.h index fc5699b..186cdee 100644 --- a/Source/WebCore/Modules/webaudio/AudioBufferSourceNode.h +++ b/Source/WebCore/Modules/webaudio/AudioBufferSourceNode.h @@ -29,6 +29,9 @@ #include "AudioBus.h" #include "AudioGain.h" #include "AudioScheduledSourceNode.h" +#if ENABLE(TIZEN_WEB_AUDIO) +#include "ExceptionCode.h" +#endif #include "PannerNode.h" #include #include @@ -60,7 +63,16 @@ public: // numberOfChannels() returns the number of output channels. This value equals the number of channels from the buffer. // If a new buffer is set with a different number of channels, then this value will dynamically change. unsigned numberOfChannels(); - + +#if ENABLE(TIZEN_WEB_AUDIO) + // Play-state + void startGrain(double when, double grainOffset, ExceptionCode&); + void startGrain(double when, double grainOffset, double grainDuration, ExceptionCode&); + +#if ENABLE(LEGACY_WEB_AUDIO) + void noteGrainOn(double when, double grainOffset, double grainDuration, ExceptionCode&); +#endif +#else // Play-state void startGrain(double when, double grainOffset); void startGrain(double when, double grainOffset, double grainDuration); @@ -68,6 +80,7 @@ public: #if ENABLE(LEGACY_WEB_AUDIO) void noteGrainOn(double when, double grainOffset, double grainDuration); #endif +#endif // Note: the attribute was originally exposed as .looping, but to be more consistent in naming with