[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
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;
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()
{
#include "AudioBus.h"
#include "AudioGain.h"
#include "AudioScheduledSourceNode.h"
+#if ENABLE(TIZEN_WEB_AUDIO)
+#include "ExceptionCode.h"
+#endif
#include "PannerNode.h"
#include <wtf/OwnArrayPtr.h>
#include <wtf/PassRefPtr.h>
// 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);
#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 <audio>
// and with how it's described in the specification, the proper attribute name is .loop
attribute double loopStart;
attribute double loopEnd;
+#if defined(ENABLE_TIZEN_WEB_AUDIO)
+ [V8MeasureAs=WebAudioStart] void start(in double when)
+ raises (DOMException);
+ [V8MeasureAs=WebAudioStart, ImplementedAs=startGrain] void start(in double when, in double grainOffset)
+ raises (DOMException);
+ [V8MeasureAs=WebAudioStart, ImplementedAs=startGrain] void start(in double when, in double grainOffset, in double grainDuration)
+ raises (DOMException);
+ void stop(in double when)
+ raises (DOMException);
+
+#if defined(ENABLE_LEGACY_WEB_AUDIO) && ENABLE_LEGACY_WEB_AUDIO
+ attribute boolean looping; // This is an alias for the .loop attribute for backwards compatibility.
+
+ [V8MeasureAs=LegacyWebAudio] void noteOn(in double when)
+ raises (DOMException);
+ [V8MeasureAs=LegacyWebAudio] void noteGrainOn(in double when, in double grainOffset, in double grainDuration)
+ raises (DOMException);
+ void noteOff(in double when)
+ raises (DOMException);
+#endif
+#else
[V8MeasureAs=WebAudioStart] void start(in double when);
[V8MeasureAs=WebAudioStart, ImplementedAs=startGrain] void start(in double when, in double grainOffset);
[V8MeasureAs=WebAudioStart, ImplementedAs=startGrain] void start(in double when, in double grainOffset, in double grainDuration);
[V8MeasureAs=LegacyWebAudio] void noteGrainOn(in double when, in double grainOffset, in double grainDuration);
void noteOff(in double when);
#endif
+#endif
};
}
return;
}
+#if ENABLE(TIZEN_WEB_AUDIO)
+void AudioScheduledSourceNode::start(double when, ExceptionCode& ec)
+{
+ ASSERT(isMainThread());
+ if (m_playbackState != UNSCHEDULED_STATE) {
+ ec = INVALID_STATE_ERR;
+ return;
+ }
+
+ m_startTime = when;
+ m_playbackState = SCHEDULED_STATE;
+}
+
+void AudioScheduledSourceNode::stop(double when, ExceptionCode& ec)
+{
+ ASSERT(isMainThread());
+ if (!(m_playbackState == SCHEDULED_STATE || m_playbackState == PLAYING_STATE) || (m_endTime != UnknownTime)) {
+ ec = INVALID_STATE_ERR;
+ return;
+ }
+
+ when = max(0.0, when);
+ m_endTime = when;
+}
+
+#if ENABLE(LEGACY_WEB_AUDIO)
+void AudioScheduledSourceNode::noteOn(double when, ExceptionCode& ec)
+{
+ start(when, ec);
+}
+
+void AudioScheduledSourceNode::noteOff(double when, ExceptionCode& ec)
+{
+ stop(when, ec);
+}
+#endif
+#else
void AudioScheduledSourceNode::start(double when)
{
ASSERT(isMainThread());
stop(when);
}
#endif
+#endif
void AudioScheduledSourceNode::finish()
{
#define AudioScheduledSourceNode_h
#include "AudioSourceNode.h"
+#if ENABLE(TIZEN_WEB_AUDIO)
+#include "ExceptionCode.h"
+#endif
namespace WebCore {
AudioScheduledSourceNode(AudioContext*, float sampleRate);
+#if ENABLE(TIZEN_WEB_AUDIO)
+ // Scheduling.
+ void start(double when, ExceptionCode&);
+ void stop(double when, ExceptionCode&);
+
+#if ENABLE(LEGACY_WEB_AUDIO)
+ void noteOn(double when, ExceptionCode&);
+ void noteOff(double when, ExceptionCode&);
+#endif
+#else
// Scheduling.
void start(double when);
void stop(double when);
void noteOn(double when);
void noteOff(double when);
#endif
+#endif
unsigned short playbackState() const { return static_cast<unsigned short>(m_playbackState); }
bool isPlayingOrScheduled() const { return m_playbackState == PLAYING_STATE || m_playbackState == SCHEDULED_STATE; }
readonly attribute AudioParam frequency; // in Hertz
readonly attribute AudioParam detune; // in Cents
+#if defined(ENABLE_TIZEN_WEB_AUDIO)
+ void start(in double when)
+ raises (DOMException);
+ void stop(in double when)
+ raises (DOMException);
+
+#if defined(ENABLE_LEGACY_WEB_AUDIO) && ENABLE_LEGACY_WEB_AUDIO
+ void noteOn(in double when)
+ raises (DOMException);
+ void noteOff(in double when)
+ raises (DOMException);
+#endif
+#else
void start(in double when);
void stop(in double when);
void noteOn(in double when);
void noteOff(in double when);
#endif
+#endif
void setWaveTable(in WaveTable waveTable);