diff options
Diffstat (limited to 'Source/WebCore/Modules/webaudio/AudioContext.idl')
-rw-r--r-- | Source/WebCore/Modules/webaudio/AudioContext.idl | 66 |
1 files changed, 36 insertions, 30 deletions
diff --git a/Source/WebCore/Modules/webaudio/AudioContext.idl b/Source/WebCore/Modules/webaudio/AudioContext.idl index 8d684299f..e5226a3f1 100644 --- a/Source/WebCore/Modules/webaudio/AudioContext.idl +++ b/Source/WebCore/Modules/webaudio/AudioContext.idl @@ -23,72 +23,78 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +enum AudioContextState { + "suspended", + "running", + "interrupted", + "closed" +}; + [ - EnabledBySetting=WebAudio, - Conditional=WEB_AUDIO, ActiveDOMObject, - CustomConstructor, - EventTarget, + Conditional=WEB_AUDIO, + Constructor, + ConstructorCallWith=Document, + EnabledBySetting=WebAudio, + ExportMacro=WEBCORE_EXPORT, InterfaceName=webkitAudioContext, -] interface AudioContext { +] interface AudioContext : EventTarget { // All rendered audio ultimately connects to destination, which represents the audio hardware. readonly attribute AudioDestinationNode destination; // All scheduled times are relative to this time in seconds. - readonly attribute double currentTime; + readonly attribute unrestricted double currentTime; // All AudioNodes in the context run at this sample-rate (sample-frames per second). - readonly attribute float sampleRate; + readonly attribute unrestricted float sampleRate; // All panning is relative to this listener. readonly attribute AudioListener listener; + Promise<void> suspend(); + Promise<void> resume(); + Promise<void> close(); + + readonly attribute AudioContextState state; + attribute EventHandler onstatechange; + // Number of AudioBufferSourceNodes that are currently playing. readonly attribute unsigned long activeSourceCount; - [RaisesException] AudioBuffer createBuffer(unsigned long numberOfChannels, unsigned long numberOfFrames, float sampleRate); - [RaisesException] AudioBuffer createBuffer(ArrayBuffer? buffer, boolean mixToMono); + [MayThrowException] AudioBuffer createBuffer(unsigned long numberOfChannels, unsigned long numberOfFrames, unrestricted float sampleRate); + [MayThrowException] AudioBuffer createBuffer(ArrayBuffer buffer, boolean mixToMono); // Asynchronous audio file data decoding. - [RaisesException] void decodeAudioData(ArrayBuffer audioData, AudioBufferCallback successCallback, optional AudioBufferCallback errorCallback); + // FIXME: successCallback should be optional and the callbacks should not be nullable. This should also return a Promise. + void decodeAudioData(ArrayBuffer audioData, AudioBufferCallback? successCallback, optional AudioBufferCallback? errorCallback); // Sources AudioBufferSourceNode createBufferSource(); -#if defined(ENABLE_VIDEO) && ENABLE_VIDEO - [RaisesException] MediaElementAudioSourceNode createMediaElementSource(HTMLMediaElement mediaElement); -#endif + [Conditional=VIDEO, MayThrowException] MediaElementAudioSourceNode createMediaElementSource(HTMLMediaElement mediaElement); -#if defined(ENABLE_MEDIA_STREAM) && ENABLE_MEDIA_STREAM - [RaisesException] MediaStreamAudioSourceNode createMediaStreamSource(MediaStream mediaStream); - MediaStreamAudioDestinationNode createMediaStreamDestination(); -#endif + [Conditional=MEDIA_STREAM, MayThrowException] MediaStreamAudioSourceNode createMediaStreamSource(MediaStream mediaStream); + [Conditional=MEDIA_STREAM] MediaStreamAudioDestinationNode createMediaStreamDestination(); // Processing nodes GainNode createGain(); - [RaisesException] DelayNode createDelay(optional double maxDelayTime); + [MayThrowException] DelayNode createDelay(optional unrestricted double maxDelayTime = 1); BiquadFilterNode createBiquadFilter(); WaveShaperNode createWaveShaper(); PannerNode createPanner(); ConvolverNode createConvolver(); DynamicsCompressorNode createDynamicsCompressor(); AnalyserNode createAnalyser(); - [RaisesException] ScriptProcessorNode createScriptProcessor(unsigned long bufferSize, optional unsigned long numberOfInputChannels, optional unsigned long numberOfOutputChannels); + [MayThrowException] ScriptProcessorNode createScriptProcessor(unsigned long bufferSize, optional unsigned long numberOfInputChannels = 2, optional unsigned long numberOfOutputChannels = 2); OscillatorNode createOscillator(); - [RaisesException] PeriodicWave createPeriodicWave(Float32Array real, Float32Array imag); + [MayThrowException] PeriodicWave createPeriodicWave(Float32Array real, Float32Array imag); // Channel splitting and merging - [RaisesException] ChannelSplitterNode createChannelSplitter(optional unsigned long numberOfOutputs); - [RaisesException] ChannelMergerNode createChannelMerger(optional unsigned long numberOfInputs); + [MayThrowException] ChannelSplitterNode createChannelSplitter(optional unsigned long numberOfOutputs = 6); + [MayThrowException] ChannelMergerNode createChannelMerger(optional unsigned long numberOfInputs = 6); // Offline rendering - // void prepareOfflineBufferRendering(unsigned long numberOfChannels, unsigned long numberOfFrames, float sampleRate); - attribute EventListener oncomplete; + // void prepareOfflineBufferRendering(unsigned long numberOfChannels, unsigned long numberOfFrames, unrestricted float sampleRate); + attribute EventHandler oncomplete; void startRendering(); - - [Conditional=LEGACY_WEB_AUDIO, ImplementedAs=createGain] GainNode createGainNode(); - [Conditional=LEGACY_WEB_AUDIO, ImplementedAs=createDelay, RaisesException] DelayNode createDelayNode(optional double maxDelayTime); - - [Conditional=LEGACY_WEB_AUDIO, ImplementedAs=createScriptProcessor, RaisesException] ScriptProcessorNode createJavaScriptNode(unsigned long bufferSize, optional unsigned long numberOfInputChannels, optional unsigned long numberOfOutputChannels); - }; |