Commit 528d8818 authored by rtoy's avatar rtoy Committed by Commit bot

Implement BaseAudioContext

Implements BaseAudioContext as the base class of an AudioContext and
OfflineAudioContext, moving the relevant attributes and methods from
AudioContext to BaseAudioContext.

The changes in the expected results are mostly caused by exception
messages now saying BaseAudioContext instead of AudioContext.

BUG=555608
TEST=no new tests

Review-Url: https://codereview.chromium.org/1865583002
Cr-Commit-Position: refs/heads/master@{#417297}
parent 69aa44f5
...@@ -12,7 +12,6 @@ PASS Performance.prototype.__proto__ is EventTarget.prototype ...@@ -12,7 +12,6 @@ PASS Performance.prototype.__proto__ is EventTarget.prototype
PASS SharedWorker.prototype.__proto__ is EventTarget.prototype PASS SharedWorker.prototype.__proto__ is EventTarget.prototype
PASS WebSocket.prototype.__proto__ is EventTarget.prototype PASS WebSocket.prototype.__proto__ is EventTarget.prototype
PASS Worker.prototype.__proto__ is EventTarget.prototype PASS Worker.prototype.__proto__ is EventTarget.prototype
PASS AudioContext.prototype.__proto__ is EventTarget.prototype
PASS Window.prototype.__proto__.__proto__ is EventTarget.prototype PASS Window.prototype.__proto__.__proto__ is EventTarget.prototype
PASS successfullyParsed is true PASS successfullyParsed is true
......
...@@ -123,40 +123,9 @@ interface AudioBufferSourceNode : AudioSourceNode ...@@ -123,40 +123,9 @@ interface AudioBufferSourceNode : AudioSourceNode
setter loopEnd setter loopEnd
setter loopStart setter loopStart
setter onended setter onended
interface AudioContext : EventTarget interface AudioContext : BaseAudioContext
attribute @@toStringTag attribute @@toStringTag
getter currentTime
getter destination
getter listener
getter onstatechange
getter sampleRate
getter state
method close
method constructor method constructor
method createAnalyser
method createBiquadFilter
method createBuffer
method createBufferSource
method createChannelMerger
method createChannelSplitter
method createConvolver
method createDelay
method createDynamicsCompressor
method createGain
method createIIRFilter
method createMediaElementSource
method createMediaStreamDestination
method createMediaStreamSource
method createOscillator
method createPanner
method createPeriodicWave
method createScriptProcessor
method createStereoPanner
method createWaveShaper
method decodeAudioData
method resume
method suspend
setter onstatechange
interface AudioDestinationNode : AudioNode interface AudioDestinationNode : AudioNode
attribute @@toStringTag attribute @@toStringTag
getter maxChannelCount getter maxChannelCount
...@@ -3563,7 +3532,7 @@ interface OfflineAudioCompletionEvent : Event ...@@ -3563,7 +3532,7 @@ interface OfflineAudioCompletionEvent : Event
attribute @@toStringTag attribute @@toStringTag
getter renderedBuffer getter renderedBuffer
method constructor method constructor
interface OfflineAudioContext : AudioContext interface OfflineAudioContext : BaseAudioContext
attribute @@toStringTag attribute @@toStringTag
getter length getter length
getter oncomplete getter oncomplete
...@@ -6225,40 +6194,9 @@ interface XSLTProcessor ...@@ -6225,40 +6194,9 @@ interface XSLTProcessor
method setParameter method setParameter
method transformToDocument method transformToDocument
method transformToFragment method transformToFragment
interface webkitAudioContext : EventTarget interface webkitAudioContext : BaseAudioContext
attribute @@toStringTag attribute @@toStringTag
getter currentTime
getter destination
getter listener
getter onstatechange
getter sampleRate
getter state
method close
method constructor method constructor
method createAnalyser
method createBiquadFilter
method createBuffer
method createBufferSource
method createChannelMerger
method createChannelSplitter
method createConvolver
method createDelay
method createDynamicsCompressor
method createGain
method createIIRFilter
method createMediaElementSource
method createMediaStreamDestination
method createMediaStreamSource
method createOscillator
method createPanner
method createPeriodicWave
method createScriptProcessor
method createStereoPanner
method createWaveShaper
method decodeAudioData
method resume
method suspend
setter onstatechange
interface webkitIDBCursor interface webkitIDBCursor
attribute @@toStringTag attribute @@toStringTag
getter direction getter direction
...@@ -6390,7 +6328,7 @@ interface webkitMediaStream : EventTarget ...@@ -6390,7 +6328,7 @@ interface webkitMediaStream : EventTarget
setter onaddtrack setter onaddtrack
setter oninactive setter oninactive
setter onremovetrack setter onremovetrack
interface webkitOfflineAudioContext : AudioContext interface webkitOfflineAudioContext : BaseAudioContext
attribute @@toStringTag attribute @@toStringTag
getter length getter length
getter oncomplete getter oncomplete
......
...@@ -4,9 +4,9 @@ On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE ...@@ -4,9 +4,9 @@ On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE
PASS context.createChannelMerger() did not throw an exception. PASS context.createChannelMerger() did not throw an exception.
PASS context.createChannelMerger(0) threw IndexSizeError: Failed to execute 'createChannelMerger' on 'AudioContext': The number of inputs provided (0) is outside the range [1, 32].. PASS context.createChannelMerger(0) threw IndexSizeError: Failed to execute 'createChannelMerger' on 'BaseAudioContext': The number of inputs provided (0) is outside the range [1, 32]..
PASS context.createChannelMerger(32) did not throw an exception. PASS context.createChannelMerger(32) did not throw an exception.
PASS context.createChannelMerger(33) threw IndexSizeError: Failed to execute 'createChannelMerger' on 'AudioContext': The number of inputs provided (33) is outside the range [1, 32].. PASS context.createChannelMerger(33) threw IndexSizeError: Failed to execute 'createChannelMerger' on 'BaseAudioContext': The number of inputs provided (33) is outside the range [1, 32]..
PASS merger.channelCount is equal to 1. PASS merger.channelCount is equal to 1.
PASS merger.channelCount = 3 threw InvalidStateError: Failed to set the 'channelCount' property on 'AudioNode': ChannelMerger: channelCount cannot be changed from 1. PASS merger.channelCount = 3 threw InvalidStateError: Failed to set the 'channelCount' property on 'AudioNode': ChannelMerger: channelCount cannot be changed from 1.
PASS merger.channelCountMode is equal to "explicit". PASS merger.channelCountMode is equal to "explicit".
......
...@@ -10,22 +10,22 @@ PASS gain = context.createGain() did not throw exception. ...@@ -10,22 +10,22 @@ PASS gain = context.createGain() did not throw exception.
PASS gain.connect(context.destination) did not throw exception. PASS gain.connect(context.destination) did not throw exception.
PASS context.close() was correctly resolved PASS context.close() was correctly resolved
PASS gain.disconnect(destination) did not throw exception. PASS gain.disconnect(destination) did not throw exception.
PASS context.createAnalyser() threw exception InvalidStateError: Failed to execute 'createAnalyser' on 'AudioContext': AudioContext has been closed.. PASS context.createAnalyser() threw exception InvalidStateError: Failed to execute 'createAnalyser' on 'BaseAudioContext': AudioContext has been closed..
PASS context.createBiquadFilter() threw exception InvalidStateError: Failed to execute 'createBiquadFilter' on 'AudioContext': AudioContext has been closed.. PASS context.createBiquadFilter() threw exception InvalidStateError: Failed to execute 'createBiquadFilter' on 'BaseAudioContext': AudioContext has been closed..
PASS context.createBuffer(1, 1, 48000) did not throw exception. PASS context.createBuffer(1, 1, 48000) did not throw exception.
PASS context.createBufferSource() threw exception InvalidStateError: Failed to execute 'createBufferSource' on 'AudioContext': AudioContext has been closed.. PASS context.createBufferSource() threw exception InvalidStateError: Failed to execute 'createBufferSource' on 'BaseAudioContext': AudioContext has been closed..
PASS context.createChannelMerger() threw exception InvalidStateError: Failed to execute 'createChannelMerger' on 'AudioContext': AudioContext has been closed.. PASS context.createChannelMerger() threw exception InvalidStateError: Failed to execute 'createChannelMerger' on 'BaseAudioContext': AudioContext has been closed..
PASS context.createChannelSplitter() threw exception InvalidStateError: Failed to execute 'createChannelSplitter' on 'AudioContext': AudioContext has been closed.. PASS context.createChannelSplitter() threw exception InvalidStateError: Failed to execute 'createChannelSplitter' on 'BaseAudioContext': AudioContext has been closed..
PASS context.createConvolver() threw exception InvalidStateError: Failed to execute 'createConvolver' on 'AudioContext': AudioContext has been closed.. PASS context.createConvolver() threw exception InvalidStateError: Failed to execute 'createConvolver' on 'BaseAudioContext': AudioContext has been closed..
PASS context.createDelay() threw exception InvalidStateError: Failed to execute 'createDelay' on 'AudioContext': AudioContext has been closed.. PASS context.createDelay() threw exception InvalidStateError: Failed to execute 'createDelay' on 'BaseAudioContext': AudioContext has been closed..
PASS context.createDynamicsCompressor() threw exception InvalidStateError: Failed to execute 'createDynamicsCompressor' on 'AudioContext': AudioContext has been closed.. PASS context.createDynamicsCompressor() threw exception InvalidStateError: Failed to execute 'createDynamicsCompressor' on 'BaseAudioContext': AudioContext has been closed..
PASS context.createGain() threw exception InvalidStateError: Failed to execute 'createGain' on 'AudioContext': AudioContext has been closed.. PASS context.createGain() threw exception InvalidStateError: Failed to execute 'createGain' on 'BaseAudioContext': AudioContext has been closed..
PASS context.createOscillator() threw exception InvalidStateError: Failed to execute 'createOscillator' on 'AudioContext': AudioContext has been closed.. PASS context.createOscillator() threw exception InvalidStateError: Failed to execute 'createOscillator' on 'BaseAudioContext': AudioContext has been closed..
PASS context.createPanner() threw exception InvalidStateError: Failed to execute 'createPanner' on 'AudioContext': AudioContext has been closed.. PASS context.createPanner() threw exception InvalidStateError: Failed to execute 'createPanner' on 'BaseAudioContext': AudioContext has been closed..
PASS context.createPeriodicWave(wave, wave) threw exception InvalidStateError: Failed to execute 'createPeriodicWave' on 'AudioContext': AudioContext has been closed.. PASS context.createPeriodicWave(wave, wave) threw exception InvalidStateError: Failed to execute 'createPeriodicWave' on 'BaseAudioContext': AudioContext has been closed..
PASS context.createScriptProcessor() threw exception InvalidStateError: Failed to execute 'createScriptProcessor' on 'AudioContext': AudioContext has been closed.. PASS context.createScriptProcessor() threw exception InvalidStateError: Failed to execute 'createScriptProcessor' on 'BaseAudioContext': AudioContext has been closed..
PASS context.createStereoPanner() threw exception InvalidStateError: Failed to execute 'createStereoPanner' on 'AudioContext': AudioContext has been closed.. PASS context.createStereoPanner() threw exception InvalidStateError: Failed to execute 'createStereoPanner' on 'BaseAudioContext': AudioContext has been closed..
PASS context.createWaveShaper() threw exception InvalidStateError: Failed to execute 'createWaveShaper' on 'AudioContext': AudioContext has been closed.. PASS context.createWaveShaper() threw exception InvalidStateError: Failed to execute 'createWaveShaper' on 'BaseAudioContext': AudioContext has been closed..
PASS osc.connect(gain) threw exception InvalidStateError: Failed to execute 'connect' on 'AudioNode': Cannot connect after the context has been closed.. PASS osc.connect(gain) threw exception InvalidStateError: Failed to execute 'connect' on 'AudioNode': Cannot connect after the context has been closed..
PASS gain.disconnect() did not throw exception. PASS gain.disconnect() did not throw exception.
PASS Attempt to resume a closed context was correctly rejected PASS Attempt to resume a closed context was correctly rejected
......
CONSOLE WARNING: line 386: Delay.delayTime.value -1 outside nominal range [0, 1.5]; value will be clamped. CONSOLE WARNING: line 387: Delay.delayTime.value -1 outside nominal range [0, 1.5]; value will be clamped.
CONSOLE WARNING: line 395: Delay.delayTime.value 4 outside nominal range [0, 1.5]; value will be clamped. CONSOLE WARNING: line 396: Delay.delayTime.value 4 outside nominal range [0, 1.5]; value will be clamped.
CONSOLE WARNING: line 386: StereoPanner.pan.value -3 outside nominal range [-1, 1]; value will be clamped. CONSOLE WARNING: line 387: StereoPanner.pan.value -3 outside nominal range [-1, 1]; value will be clamped.
CONSOLE WARNING: line 395: StereoPanner.pan.value 3 outside nominal range [-1, 1]; value will be clamped. CONSOLE WARNING: line 396: StereoPanner.pan.value 3 outside nominal range [-1, 1]; value will be clamped.
CONSOLE WARNING: line 386: DynamicsCompressor.threshold.value -201 outside nominal range [-100, 0]; value will be clamped. CONSOLE WARNING: line 387: DynamicsCompressor.threshold.value -201 outside nominal range [-100, 0]; value will be clamped.
CONSOLE WARNING: line 395: DynamicsCompressor.threshold.value 1 outside nominal range [-100, 0]; value will be clamped. CONSOLE WARNING: line 396: DynamicsCompressor.threshold.value 1 outside nominal range [-100, 0]; value will be clamped.
CONSOLE WARNING: line 386: DynamicsCompressor.knee.value -1 outside nominal range [0, 40]; value will be clamped. CONSOLE WARNING: line 387: DynamicsCompressor.knee.value -1 outside nominal range [0, 40]; value will be clamped.
CONSOLE WARNING: line 395: DynamicsCompressor.knee.value 81 outside nominal range [0, 40]; value will be clamped. CONSOLE WARNING: line 396: DynamicsCompressor.knee.value 81 outside nominal range [0, 40]; value will be clamped.
CONSOLE WARNING: line 395: DynamicsCompressor.ratio.value 41 outside nominal range [1, 20]; value will be clamped. CONSOLE WARNING: line 396: DynamicsCompressor.ratio.value 41 outside nominal range [1, 20]; value will be clamped.
CONSOLE WARNING: line 386: DynamicsCompressor.attack.value -1 outside nominal range [0, 1]; value will be clamped. CONSOLE WARNING: line 387: DynamicsCompressor.attack.value -1 outside nominal range [0, 1]; value will be clamped.
CONSOLE WARNING: line 395: DynamicsCompressor.attack.value 3 outside nominal range [0, 1]; value will be clamped. CONSOLE WARNING: line 396: DynamicsCompressor.attack.value 3 outside nominal range [0, 1]; value will be clamped.
CONSOLE WARNING: line 386: DynamicsCompressor.release.value -1 outside nominal range [0, 1]; value will be clamped. CONSOLE WARNING: line 387: DynamicsCompressor.release.value -1 outside nominal range [0, 1]; value will be clamped.
CONSOLE WARNING: line 395: DynamicsCompressor.release.value 3 outside nominal range [0, 1]; value will be clamped. CONSOLE WARNING: line 396: DynamicsCompressor.release.value 3 outside nominal range [0, 1]; value will be clamped.
CONSOLE WARNING: line 386: BiquadFilter.frequency.value -1 outside nominal range [0, 24000]; value will be clamped. CONSOLE WARNING: line 387: BiquadFilter.frequency.value -1 outside nominal range [0, 24000]; value will be clamped.
CONSOLE WARNING: line 395: BiquadFilter.frequency.value 48001 outside nominal range [0, 24000]; value will be clamped. CONSOLE WARNING: line 396: BiquadFilter.frequency.value 48001 outside nominal range [0, 24000]; value will be clamped.
CONSOLE WARNING: line 386: Oscillator.frequency.value -48001 outside nominal range [-24000, 24000]; value will be clamped. CONSOLE WARNING: line 387: Oscillator.frequency.value -48001 outside nominal range [-24000, 24000]; value will be clamped.
CONSOLE WARNING: line 395: Oscillator.frequency.value 48001 outside nominal range [-24000, 24000]; value will be clamped. CONSOLE WARNING: line 396: Oscillator.frequency.value 48001 outside nominal range [-24000, 24000]; value will be clamped.
CONSOLE WARNING: line 438: 'AudioListener.dopplerFactor' is deprecated and will be removed in M55, around November 2016. It has no effect as the Web Audio doppler effects have already been removed internally. See https://www.chromestatus.com/features/5238926818148352 for more details. CONSOLE WARNING: line 439: 'AudioListener.dopplerFactor' is deprecated and will be removed in M55, around November 2016. It has no effect as the Web Audio doppler effects have already been removed internally. See https://www.chromestatus.com/features/5238926818148352 for more details.
CONSOLE WARNING: line 438: 'AudioListener.speedOfSound' is deprecated and will be removed in M55, around November 2016. It has no effect as the Web Audio doppler effects have already been removed internally. See https://www.chromestatus.com/features/5238926818148352 for more details. CONSOLE WARNING: line 439: 'AudioListener.speedOfSound' is deprecated and will be removed in M55, around November 2016. It has no effect as the Web Audio doppler effects have already been removed internally. See https://www.chromestatus.com/features/5238926818148352 for more details.
CONSOLE WARNING: line 315: Delay.delayTime.setValueAtTime value -1 outside nominal range [0, 1]; value will be clamped. CONSOLE WARNING: line 316: Delay.delayTime.setValueAtTime value -1 outside nominal range [0, 1]; value will be clamped.
CONSOLE WARNING: line 316: Delay.delayTime.linearRampToValueAtTime value 2 outside nominal range [0, 1]; value will be clamped. CONSOLE WARNING: line 317: Delay.delayTime.linearRampToValueAtTime value 2 outside nominal range [0, 1]; value will be clamped.
CONSOLE WARNING: line 317: Delay.delayTime.exponentialRampToValue value 3 outside nominal range [0, 1]; value will be clamped. CONSOLE WARNING: line 318: Delay.delayTime.exponentialRampToValue value 3 outside nominal range [0, 1]; value will be clamped.
CONSOLE WARNING: line 318: Delay.delayTime.setTargetAtTime value -1 outside nominal range [0, 1]; value will be clamped. CONSOLE WARNING: line 319: Delay.delayTime.setTargetAtTime value -1 outside nominal range [0, 1]; value will be clamped.
CONSOLE WARNING: line 319: Delay.delayTime.setValueCurveAtTime value 1.5 outside nominal range [0, 1]; value will be clamped. CONSOLE WARNING: line 320: Delay.delayTime.setValueCurveAtTime value 1.5 outside nominal range [0, 1]; value will be clamped.
Test AudioParam Nominal Range Values. Test AudioParam Nominal Range Values.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
......
...@@ -210,7 +210,8 @@ ...@@ -210,7 +210,8 @@
creator: "createMediaStreamDestination", creator: "createMediaStreamDestination",
args: [] args: []
} }
// Can't currently test MediaStreamSource // Can't currently test MediaStreamSource because we're using an offline
// context.
]; ];
// Create the context so we can use it in the following test. // Create the context so we can use it in the following test.
......
...@@ -3,7 +3,7 @@ Basic tests for decodeAudioData promise. ...@@ -3,7 +3,7 @@ Basic tests for decodeAudioData promise.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS decodeAudioData(null) rejected correctly (with TypeError: Failed to execute 'decodeAudioData' on 'AudioContext': parameter 1 is not of type 'ArrayBuffer'.). PASS decodeAudioData(null) rejected correctly (with TypeError: Failed to execute 'decodeAudioData' on 'BaseAudioContext': parameter 1 is not of type 'ArrayBuffer'.).
PASS Decode valid file with promise: Correctly succeeded in decoding resources/media/24bit-44khz.wav PASS Decode valid file with promise: Correctly succeeded in decoding resources/media/24bit-44khz.wav
PASS Decode invalid file with promise: Correctly failed to decode resources/media/invalid-audio-file.txt: EncodingError: Unable to decode audio data PASS Decode invalid file with promise: Correctly failed to decode resources/media/invalid-audio-file.txt: EncodingError: Unable to decode audio data
PASS Decoding valid file with promise and callback: successCallback invoked correctly PASS Decoding valid file with promise and callback: successCallback invoked correctly
......
...@@ -2,10 +2,10 @@ Tests attribute and maximum allowed delay of DelayNode. ...@@ -2,10 +2,10 @@ Tests attribute and maximum allowed delay of DelayNode.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS context.createDelay(180) threw exception NotSupportedError: Failed to execute 'createDelay' on 'AudioContext': The max delay time provided (180) is outside the range (0, 180).. PASS context.createDelay(180) threw exception NotSupportedError: Failed to execute 'createDelay' on 'BaseAudioContext': The max delay time provided (180) is outside the range (0, 180)..
PASS context.createDelay(0) threw exception NotSupportedError: Failed to execute 'createDelay' on 'AudioContext': The max delay time provided (0) is outside the range (0, 180).. PASS context.createDelay(0) threw exception NotSupportedError: Failed to execute 'createDelay' on 'BaseAudioContext': The max delay time provided (0) is outside the range (0, 180)..
PASS context.createDelay(-1) threw exception NotSupportedError: Failed to execute 'createDelay' on 'AudioContext': The max delay time provided (-1) is outside the range (0, 180).. PASS context.createDelay(-1) threw exception NotSupportedError: Failed to execute 'createDelay' on 'BaseAudioContext': The max delay time provided (-1) is outside the range (0, 180)..
PASS context.createDelay(NaN) threw exception TypeError: Failed to execute 'createDelay' on 'AudioContext': The provided double value is non-finite.. PASS context.createDelay(NaN) threw exception TypeError: Failed to execute 'createDelay' on 'BaseAudioContext': The provided double value is non-finite..
PASS delay.delayTime.value === 0.5 is true PASS delay.delayTime.value === 0.5 is true
PASS Test signal was correctly delayed by 0.5 sec. PASS Test signal was correctly delayed by 0.5 sec.
PASS successfullyParsed is true PASS successfullyParsed is true
......
...@@ -7,31 +7,31 @@ Tests DOM exception messages ...@@ -7,31 +7,31 @@ Tests DOM exception messages
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS context.createBuffer(99, 1, context.sampleRate) threw exception NotSupportedError: Failed to execute 'createBuffer' on 'AudioContext': The number of channels provided (99) is outside the range [1, 32].. PASS context.createBuffer(99, 1, context.sampleRate) threw exception NotSupportedError: Failed to execute 'createBuffer' on 'BaseAudioContext': The number of channels provided (99) is outside the range [1, 32]..
PASS context.createBuffer(0, 1, context.sampleRate) threw exception NotSupportedError: Failed to execute 'createBuffer' on 'AudioContext': The number of channels provided (0) is outside the range [1, 32].. PASS context.createBuffer(0, 1, context.sampleRate) threw exception NotSupportedError: Failed to execute 'createBuffer' on 'BaseAudioContext': The number of channels provided (0) is outside the range [1, 32]..
PASS context.createBuffer(1, 1, 1) threw exception NotSupportedError: Failed to execute 'createBuffer' on 'AudioContext': The sample rate provided (1) is outside the range [3000, 192000].. PASS context.createBuffer(1, 1, 1) threw exception NotSupportedError: Failed to execute 'createBuffer' on 'BaseAudioContext': The sample rate provided (1) is outside the range [3000, 192000]..
PASS context.createBuffer(1, 1, 1e6) threw exception NotSupportedError: Failed to execute 'createBuffer' on 'AudioContext': The sample rate provided (1.00000e+6) is outside the range [3000, 192000].. PASS context.createBuffer(1, 1, 1e6) threw exception NotSupportedError: Failed to execute 'createBuffer' on 'BaseAudioContext': The sample rate provided (1.00000e+6) is outside the range [3000, 192000]..
PASS context.createBuffer(1, 1, 3000) did not throw exception. PASS context.createBuffer(1, 1, 3000) did not throw exception.
PASS context.createBuffer(1, 1, 192000) did not throw exception. PASS context.createBuffer(1, 1, 192000) did not throw exception.
PASS context.createBuffer(1, 0, context.sampleRate) threw exception NotSupportedError: Failed to execute 'createBuffer' on 'AudioContext': The number of frames provided (0) is less than or equal to the minimum bound (0).. PASS context.createBuffer(1, 0, context.sampleRate) threw exception NotSupportedError: Failed to execute 'createBuffer' on 'BaseAudioContext': The number of frames provided (0) is less than or equal to the minimum bound (0)..
PASS context.createBuffer(new ArrayBuffer(100), true) threw exception TypeError: Failed to execute 'createBuffer' on 'AudioContext': 3 arguments required, but only 2 present.. PASS context.createBuffer(new ArrayBuffer(100), true) threw exception TypeError: Failed to execute 'createBuffer' on 'BaseAudioContext': 3 arguments required, but only 2 present..
PASS context.createMediaElementSource(null) threw exception TypeError: Failed to execute 'createMediaElementSource' on 'AudioContext': parameter 1 is not of type 'HTMLMediaElement'.. PASS context.createMediaElementSource(null) threw exception TypeError: Failed to execute 'createMediaElementSource' on 'BaseAudioContext': parameter 1 is not of type 'HTMLMediaElement'..
PASS context.createMediaStreamSource(null) threw exception TypeError: Failed to execute 'createMediaStreamSource' on 'AudioContext': parameter 1 is not of type 'MediaStream'.. PASS context.createMediaStreamSource(null) threw exception TypeError: Failed to execute 'createMediaStreamSource' on 'BaseAudioContext': parameter 1 is not of type 'MediaStream'..
PASS context.createScriptProcessor(1, 1, 1) threw exception IndexSizeError: Failed to execute 'createScriptProcessor' on 'AudioContext': buffer size (1) must be 0 or a power of two between 256 and 16384.. PASS context.createScriptProcessor(1, 1, 1) threw exception IndexSizeError: Failed to execute 'createScriptProcessor' on 'BaseAudioContext': buffer size (1) must be 0 or a power of two between 256 and 16384..
PASS context.createScriptProcessor(4096, 100, 1) threw exception IndexSizeError: Failed to execute 'createScriptProcessor' on 'AudioContext': number of input channels (100) exceeds maximum (32).. PASS context.createScriptProcessor(4096, 100, 1) threw exception IndexSizeError: Failed to execute 'createScriptProcessor' on 'BaseAudioContext': number of input channels (100) exceeds maximum (32)..
PASS context.createScriptProcessor(4096, 1, 100) threw exception IndexSizeError: Failed to execute 'createScriptProcessor' on 'AudioContext': number of output channels (1) exceeds maximum (32).. PASS context.createScriptProcessor(4096, 1, 100) threw exception IndexSizeError: Failed to execute 'createScriptProcessor' on 'BaseAudioContext': number of output channels (1) exceeds maximum (32)..
PASS context.createScriptProcessor() did not throw exception. PASS context.createScriptProcessor() did not throw exception.
PASS context.createScriptProcessor(0) did not throw exception. PASS context.createScriptProcessor(0) did not throw exception.
PASS context.createChannelSplitter(0) threw exception IndexSizeError: Failed to execute 'createChannelSplitter' on 'AudioContext': The number of outputs provided (0) is outside the range [1, 32].. PASS context.createChannelSplitter(0) threw exception IndexSizeError: Failed to execute 'createChannelSplitter' on 'BaseAudioContext': The number of outputs provided (0) is outside the range [1, 32]..
PASS context.createChannelSplitter(99) threw exception IndexSizeError: Failed to execute 'createChannelSplitter' on 'AudioContext': The number of outputs provided (99) is outside the range [1, 32].. PASS context.createChannelSplitter(99) threw exception IndexSizeError: Failed to execute 'createChannelSplitter' on 'BaseAudioContext': The number of outputs provided (99) is outside the range [1, 32]..
PASS context.createChannelMerger(0) threw exception IndexSizeError: Failed to execute 'createChannelMerger' on 'AudioContext': The number of inputs provided (0) is outside the range [1, 32].. PASS context.createChannelMerger(0) threw exception IndexSizeError: Failed to execute 'createChannelMerger' on 'BaseAudioContext': The number of inputs provided (0) is outside the range [1, 32]..
PASS context.createChannelMerger(99) threw exception IndexSizeError: Failed to execute 'createChannelMerger' on 'AudioContext': The number of inputs provided (99) is outside the range [1, 32].. PASS context.createChannelMerger(99) threw exception IndexSizeError: Failed to execute 'createChannelMerger' on 'BaseAudioContext': The number of inputs provided (99) is outside the range [1, 32]..
PASS context.createPeriodicWave(null, null) threw exception TypeError: Failed to execute 'createPeriodicWave' on 'AudioContext': parameter 1 is not of type 'Float32Array'.. PASS context.createPeriodicWave(null, null) threw exception TypeError: Failed to execute 'createPeriodicWave' on 'BaseAudioContext': parameter 1 is not of type 'Float32Array'..
PASS context.createPeriodicWave(new Float32Array(10), null) threw exception TypeError: Failed to execute 'createPeriodicWave' on 'AudioContext': parameter 2 is not of type 'Float32Array'.. PASS context.createPeriodicWave(new Float32Array(10), null) threw exception TypeError: Failed to execute 'createPeriodicWave' on 'BaseAudioContext': parameter 2 is not of type 'Float32Array'..
PASS context.createPeriodicWave(new Float32Array(4100), new Float32Array(4100)) did not throw exception. PASS context.createPeriodicWave(new Float32Array(4100), new Float32Array(4100)) did not throw exception.
PASS context.createPeriodicWave(new Float32Array(8192), new Float32Array(8192)) did not throw exception. PASS context.createPeriodicWave(new Float32Array(8192), new Float32Array(8192)) did not throw exception.
PASS context.createPeriodicWave(new Float32Array(10000), new Float32Array(10000)) did not throw exception. PASS context.createPeriodicWave(new Float32Array(10000), new Float32Array(10000)) did not throw exception.
PASS context.createPeriodicWave(new Float32Array(10), new Float32Array(7)) threw exception IndexSizeError: Failed to execute 'createPeriodicWave' on 'AudioContext': length of real array (10) and length of imaginary array (7) must match.. PASS context.createPeriodicWave(new Float32Array(10), new Float32Array(7)) threw exception IndexSizeError: Failed to execute 'createPeriodicWave' on 'BaseAudioContext': length of real array (10) and length of imaginary array (7) must match..
PASS node.fftSize = 42 threw exception IndexSizeError: Failed to set the 'fftSize' property on 'AnalyserNode': The value provided (42) is not a power of two.. PASS node.fftSize = 42 threw exception IndexSizeError: Failed to set the 'fftSize' property on 'AnalyserNode': The value provided (42) is not a power of two..
PASS node.fftSize is not 42 PASS node.fftSize is not 42
PASS node.fftSize = 16 threw exception IndexSizeError: Failed to set the 'fftSize' property on 'AnalyserNode': The FFT size provided (16) is outside the range [32, 32768].. PASS node.fftSize = 16 threw exception IndexSizeError: Failed to set the 'fftSize' property on 'AnalyserNode': The FFT size provided (16) is outside the range [32, 32768]..
......
...@@ -10,20 +10,20 @@ PASS channelCountMode is equal to "max". ...@@ -10,20 +10,20 @@ PASS channelCountMode is equal to "max".
PASS channelInterpretation is equal to "speakers". PASS channelInterpretation is equal to "speakers".
PASS All basic IIRFilter parameters are correct. PASS All basic IIRFilter parameters are correct.
PASS createIIRFilter() threw TypeError: Failed to execute 'createIIRFilter' on 'AudioContext': 2 arguments required, but only 0 present.. PASS createIIRFilter() threw TypeError: Failed to execute 'createIIRFilter' on 'BaseAudioContext': 2 arguments required, but only 0 present..
PASS createIIRFilter(new Float32Array(1)) threw TypeError: Failed to execute 'createIIRFilter' on 'AudioContext': 2 arguments required, but only 1 present.. PASS createIIRFilter(new Float32Array(1)) threw TypeError: Failed to execute 'createIIRFilter' on 'BaseAudioContext': 2 arguments required, but only 1 present..
PASS createIIRFilter(null, null) threw TypeError: Failed to execute 'createIIRFilter' on 'AudioContext': The 1st argument is neither an array, nor does it have indexed properties.. PASS createIIRFilter(null, null) threw TypeError: Failed to execute 'createIIRFilter' on 'BaseAudioContext': The 1st argument is neither an array, nor does it have indexed properties..
PASS createIIRFilter([], []) threw NotSupportedError: Failed to execute 'createIIRFilter' on 'AudioContext': The number of feedback coefficients provided (0) is outside the range [1, 20].. PASS createIIRFilter([], []) threw NotSupportedError: Failed to execute 'createIIRFilter' on 'BaseAudioContext': The number of feedback coefficients provided (0) is outside the range [1, 20]..
PASS createIIRFilter([1], []) threw NotSupportedError: Failed to execute 'createIIRFilter' on 'AudioContext': The number of feedback coefficients provided (0) is outside the range [1, 20].. PASS createIIRFilter([1], []) threw NotSupportedError: Failed to execute 'createIIRFilter' on 'BaseAudioContext': The number of feedback coefficients provided (0) is outside the range [1, 20]..
PASS createIIRFilter([], [1]) threw NotSupportedError: Failed to execute 'createIIRFilter' on 'AudioContext': The number of feedforward coefficients provided (0) is outside the range [1, 20].. PASS createIIRFilter([], [1]) threw NotSupportedError: Failed to execute 'createIIRFilter' on 'BaseAudioContext': The number of feedforward coefficients provided (0) is outside the range [1, 20]..
PASS createIIRFilter(new Float32Array(20), new Float32Array(20)) did not throw an exception. PASS createIIRFilter(new Float32Array(20), new Float32Array(20)) did not throw an exception.
PASS createIIRFilter(new Float32Array(21), [1]) threw NotSupportedError: Failed to execute 'createIIRFilter' on 'AudioContext': The number of feedforward coefficients provided (21) is outside the range [1, 20].. PASS createIIRFilter(new Float32Array(21), [1]) threw NotSupportedError: Failed to execute 'createIIRFilter' on 'BaseAudioContext': The number of feedforward coefficients provided (21) is outside the range [1, 20]..
PASS createIIRFilter([1], new Float32Array(21)) threw NotSupportedError: Failed to execute 'createIIRFilter' on 'AudioContext': The number of feedback coefficients provided (21) is outside the range [1, 20].. PASS createIIRFilter([1], new Float32Array(21)) threw NotSupportedError: Failed to execute 'createIIRFilter' on 'BaseAudioContext': The number of feedback coefficients provided (21) is outside the range [1, 20]..
PASS createIIRFilter([1], new Float32Array(2)) threw InvalidStateError: Failed to execute 'createIIRFilter' on 'AudioContext': First feedback coefficient cannot be zero.. PASS createIIRFilter([1], new Float32Array(2)) threw InvalidStateError: Failed to execute 'createIIRFilter' on 'BaseAudioContext': First feedback coefficient cannot be zero..
PASS createIIRFilter(new Float32Array(10), [1]) threw InvalidStateError: Failed to execute 'createIIRFilter' on 'AudioContext': At least one feedforward coefficient must be non-zero.. PASS createIIRFilter(new Float32Array(10), [1]) threw InvalidStateError: Failed to execute 'createIIRFilter' on 'BaseAudioContext': At least one feedforward coefficient must be non-zero..
PASS createIIRFilter([1], [1, NaN, Infinity]) threw InvalidStateError: Failed to execute 'createIIRFilter' on 'AudioContext': The feedback coefficient 1 is infinite.. PASS createIIRFilter([1], [1, NaN, Infinity]) threw InvalidStateError: Failed to execute 'createIIRFilter' on 'BaseAudioContext': The feedback coefficient 1 is infinite..
PASS createIIRFilter([1, NaN, Infinity], [1]) threw InvalidStateError: Failed to execute 'createIIRFilter' on 'AudioContext': The feedforward coefficient 1 is infinite.. PASS createIIRFilter([1, NaN, Infinity], [1]) threw InvalidStateError: Failed to execute 'createIIRFilter' on 'BaseAudioContext': The feedforward coefficient 1 is infinite..
PASS createIIRFilter([1, 'abc', []], [1]) threw InvalidStateError: Failed to execute 'createIIRFilter' on 'AudioContext': The feedforward coefficient 1 is not a number.. PASS createIIRFilter([1, 'abc', []], [1]) threw InvalidStateError: Failed to execute 'createIIRFilter' on 'BaseAudioContext': The feedforward coefficient 1 is not a number..
PASS All exceptions for createIIRFilter were correctly thrown. PASS All exceptions for createIIRFilter were correctly thrown.
PASS getFrequencyResponse(null, new Float32Array(1), new Float32Array(1)) threw TypeError: Failed to execute 'getFrequencyResponse' on 'IIRFilterNode': parameter 1 is not of type 'Float32Array'.. PASS getFrequencyResponse(null, new Float32Array(1), new Float32Array(1)) threw TypeError: Failed to execute 'getFrequencyResponse' on 'IIRFilterNode': parameter 1 is not of type 'Float32Array'..
......
...@@ -8,7 +8,7 @@ PASS audioNode.connect(0, 0, 0) threw exception TypeError: Failed to execute 'co ...@@ -8,7 +8,7 @@ PASS audioNode.connect(0, 0, 0) threw exception TypeError: Failed to execute 'co
PASS audioNode.connect(context.destination, 5, 0) threw exception IndexSizeError: Failed to execute 'connect' on 'AudioNode': output index (5) exceeds number of outputs (1).. PASS audioNode.connect(context.destination, 5, 0) threw exception IndexSizeError: Failed to execute 'connect' on 'AudioNode': output index (5) exceeds number of outputs (1)..
PASS audioNode.connect(context.destination, 0, 5) threw exception IndexSizeError: Failed to execute 'connect' on 'AudioNode': input index (5) exceeds number of inputs (1).. PASS audioNode.connect(context.destination, 0, 5) threw exception IndexSizeError: Failed to execute 'connect' on 'AudioNode': input index (5) exceeds number of inputs (1)..
PASS audioNode.connect(context.destination, 0, 0) did not throw exception. PASS audioNode.connect(context.destination, 0, 0) did not throw exception.
PASS context.createMediaElementSource(audioElement) threw exception InvalidStateError: Failed to execute 'createMediaElementSource' on 'AudioContext': HTMLMediaElement already connected previously to a different MediaElementSourceNode.. PASS context.createMediaElementSource(audioElement) threw exception InvalidStateError: Failed to execute 'createMediaElementSource' on 'BaseAudioContext': HTMLMediaElement already connected previously to a different MediaElementSourceNode..
PASS successfullyParsed is true PASS successfullyParsed is true
TEST COMPLETE TEST COMPLETE
......
...@@ -12,7 +12,7 @@ description("Verifies that for .mediaElement getters, a wrapper that corresponds ...@@ -12,7 +12,7 @@ description("Verifies that for .mediaElement getters, a wrapper that corresponds
var source; var source;
function testMediaWrapper(kind) { function testMediaWrapper(kind) {
var element = document.createElement(kind); var element = document.createElement(kind);
var context = new OfflineAudioContext(1, 1000, 44100); var context = new AudioContext();
source = context.createMediaElementSource(element); source = context.createMediaElementSource(element);
element = context = null; element = context = null;
......
...@@ -12,7 +12,6 @@ PASS Performance.prototype.__proto__ is EventTarget.prototype ...@@ -12,7 +12,6 @@ PASS Performance.prototype.__proto__ is EventTarget.prototype
PASS SharedWorker.prototype.__proto__ is EventTarget.prototype PASS SharedWorker.prototype.__proto__ is EventTarget.prototype
PASS WebSocket.prototype.__proto__ is EventTarget.prototype PASS WebSocket.prototype.__proto__ is EventTarget.prototype
PASS Worker.prototype.__proto__ is EventTarget.prototype PASS Worker.prototype.__proto__ is EventTarget.prototype
PASS AudioContext.prototype.__proto__ is EventTarget.prototype
PASS Window.prototype.__proto__.__proto__ is EventTarget.prototype PASS Window.prototype.__proto__.__proto__ is EventTarget.prototype
PASS successfullyParsed is true PASS successfullyParsed is true
......
...@@ -6,7 +6,8 @@ ...@@ -6,7 +6,8 @@
<script> <script>
description("Check that interfaces inherit from EventTarget"); description("Check that interfaces inherit from EventTarget");
eventTargets = ['EventSource', 'FileReader', 'MediaSource', 'MessagePort', 'Node', 'Performance', 'SharedWorker', 'WebSocket', 'Worker', 'AudioContext']; eventTargets = ['EventSource', 'FileReader', 'MediaSource', 'MessagePort',
'Node', 'Performance', 'SharedWorker', 'WebSocket', 'Worker'];
for (var i = 0; i < eventTargets.length; i++) { for (var i = 0; i < eventTargets.length; i++) {
if (eventTargets[i] in window) if (eventTargets[i] in window)
......
...@@ -158,40 +158,9 @@ interface AudioBufferSourceNode : AudioSourceNode ...@@ -158,40 +158,9 @@ interface AudioBufferSourceNode : AudioSourceNode
setter loopEnd setter loopEnd
setter loopStart setter loopStart
setter onended setter onended
interface AudioContext : EventTarget interface AudioContext : BaseAudioContext
attribute @@toStringTag attribute @@toStringTag
getter currentTime
getter destination
getter listener
getter onstatechange
getter sampleRate
getter state
method close
method constructor method constructor
method createAnalyser
method createBiquadFilter
method createBuffer
method createBufferSource
method createChannelMerger
method createChannelSplitter
method createConvolver
method createDelay
method createDynamicsCompressor
method createGain
method createIIRFilter
method createMediaElementSource
method createMediaStreamDestination
method createMediaStreamSource
method createOscillator
method createPanner
method createPeriodicWave
method createScriptProcessor
method createStereoPanner
method createWaveShaper
method decodeAudioData
method resume
method suspend
setter onstatechange
interface AudioDestinationNode : AudioNode interface AudioDestinationNode : AudioNode
attribute @@toStringTag attribute @@toStringTag
getter maxChannelCount getter maxChannelCount
...@@ -4206,7 +4175,7 @@ interface OfflineAudioCompletionEvent : Event ...@@ -4206,7 +4175,7 @@ interface OfflineAudioCompletionEvent : Event
attribute @@toStringTag attribute @@toStringTag
getter renderedBuffer getter renderedBuffer
method constructor method constructor
interface OfflineAudioContext : AudioContext interface OfflineAudioContext : BaseAudioContext
attribute @@toStringTag attribute @@toStringTag
getter length getter length
getter oncomplete getter oncomplete
...@@ -7360,40 +7329,9 @@ interface XSLTProcessor ...@@ -7360,40 +7329,9 @@ interface XSLTProcessor
method setParameter method setParameter
method transformToDocument method transformToDocument
method transformToFragment method transformToFragment
interface webkitAudioContext : EventTarget interface webkitAudioContext : BaseAudioContext
attribute @@toStringTag attribute @@toStringTag
getter currentTime
getter destination
getter listener
getter onstatechange
getter sampleRate
getter state
method close
method constructor method constructor
method createAnalyser
method createBiquadFilter
method createBuffer
method createBufferSource
method createChannelMerger
method createChannelSplitter
method createConvolver
method createDelay
method createDynamicsCompressor
method createGain
method createIIRFilter
method createMediaElementSource
method createMediaStreamDestination
method createMediaStreamSource
method createOscillator
method createPanner
method createPeriodicWave
method createScriptProcessor
method createStereoPanner
method createWaveShaper
method decodeAudioData
method resume
method suspend
setter onstatechange
interface webkitIDBCursor interface webkitIDBCursor
attribute @@toStringTag attribute @@toStringTag
getter direction getter direction
...@@ -7527,7 +7465,7 @@ interface webkitMediaStream : EventTarget ...@@ -7527,7 +7465,7 @@ interface webkitMediaStream : EventTarget
setter onaddtrack setter onaddtrack
setter oninactive setter oninactive
setter onremovetrack setter onremovetrack
interface webkitOfflineAudioContext : AudioContext interface webkitOfflineAudioContext : BaseAudioContext
attribute @@toStringTag attribute @@toStringTag
getter length getter length
getter oncomplete getter oncomplete
......
...@@ -264,6 +264,7 @@ modules_idl_files = ...@@ -264,6 +264,7 @@ modules_idl_files =
"webaudio/AudioParam.idl", "webaudio/AudioParam.idl",
"webaudio/AudioProcessingEvent.idl", "webaudio/AudioProcessingEvent.idl",
"webaudio/AudioSourceNode.idl", "webaudio/AudioSourceNode.idl",
"webaudio/BaseAudioContext.idl",
"webaudio/BiquadFilterNode.idl", "webaudio/BiquadFilterNode.idl",
"webaudio/ChannelMergerNode.idl", "webaudio/ChannelMergerNode.idl",
"webaudio/ChannelSplitterNode.idl", "webaudio/ChannelSplitterNode.idl",
......
...@@ -26,7 +26,7 @@ const unsigned MaxHardwareContexts = 6; ...@@ -26,7 +26,7 @@ const unsigned MaxHardwareContexts = 6;
static unsigned s_hardwareContextCount = 0; static unsigned s_hardwareContextCount = 0;
static unsigned s_contextId = 0; static unsigned s_contextId = 0;
BaseAudioContext* AudioContext::create(Document& document, ExceptionState& exceptionState) AudioContext* AudioContext::create(Document& document, ExceptionState& exceptionState)
{ {
DCHECK(isMainThread()); DCHECK(isMainThread());
......
...@@ -19,8 +19,9 @@ class ScriptState; ...@@ -19,8 +19,9 @@ class ScriptState;
// This is an BaseAudioContext which actually plays sound, unlike an // This is an BaseAudioContext which actually plays sound, unlike an
// OfflineAudioContext which renders sound into a buffer. // OfflineAudioContext which renders sound into a buffer.
class AudioContext : public BaseAudioContext { class AudioContext : public BaseAudioContext {
DEFINE_WRAPPERTYPEINFO();
public: public:
static BaseAudioContext* create(Document&, ExceptionState&); static AudioContext* create(Document&, ExceptionState&);
~AudioContext() override; ~AudioContext() override;
DECLARE_VIRTUAL_TRACE(); DECLARE_VIRTUAL_TRACE();
......
...@@ -23,74 +23,18 @@ ...@@ -23,74 +23,18 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
enum AudioContextState {
"suspended",
"running",
"closed"
};
[ [
ActiveScriptWrappable, ActiveScriptWrappable,
Constructor, Constructor,
ConstructorCallWith=Document, ConstructorCallWith=Document,
DependentLifetime, DependentLifetime,
ImplementedAs=BaseAudioContext,
NoInterfaceObject, NoInterfaceObject,
RaisesException=Constructor, RaisesException=Constructor,
] interface AudioContext : EventTarget { ] interface AudioContext : BaseAudioContext {
// 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;
// All AudioNodes in the context run at this sample-rate (sample-frames per second).
readonly attribute float sampleRate;
// All panning is relative to this listener.
readonly attribute AudioListener listener;
// Current state of the AudioContext
readonly attribute AudioContextState state;
[RaisesException] AudioBuffer createBuffer(unsigned long numberOfChannels, unsigned long numberOfFrames, float sampleRate);
// Asynchronous audio file data decoding.
[RaisesException, MeasureAs=AudioContextDecodeAudioData, CallWith=ScriptState] Promise<AudioBuffer> decodeAudioData(ArrayBuffer audioData, optional AudioBufferCallback successCallback, optional AudioBufferCallback errorCallback);
// Sources // Sources
[RaisesException, MeasureAs=AudioContextCreateBufferSource] AudioBufferSourceNode createBufferSource(); // TODO(rtoy): The following methods should be here instead of in BaseAudioContext:
//
[RaisesException, MeasureAs=AudioContextCreateMediaElementSource] MediaElementAudioSourceNode createMediaElementSource(HTMLMediaElement mediaElement); // createMediaElementSource(HTMLMediaElement mediaElement)
// createMediaStreamSource(MediaStream mediaStream)
[RaisesException, MeasureAs=AudioContextCreateMediaStreamSource] MediaStreamAudioSourceNode createMediaStreamSource(MediaStream mediaStream); // createMediaStreamDestination()
[RaisesException, MeasureAs=AudioContextCreateMediaStreamDestination] MediaStreamAudioDestinationNode createMediaStreamDestination();
// Processing nodes
[RaisesException, MeasureAs=AudioContextCreateGain] GainNode createGain();
[RaisesException, MeasureAs=AudioContextCreateDelay] DelayNode createDelay(optional double maxDelayTime);
[RaisesException, MeasureAs=AudioContextCreateBiquadFilter] BiquadFilterNode createBiquadFilter();
[RaisesException, MeasureAs=AudioContextCreateIIRFilter] IIRFilterNode createIIRFilter(sequence<double> feedForward, sequence<double> feedBack);
[RaisesException, MeasureAs=AudioContextCreateWaveShaper] WaveShaperNode createWaveShaper();
[RaisesException, MeasureAs=AudioContextCreatePannerAutomated] PannerNode createPanner();
[RaisesException, MeasureAs=AudioContextCreateConvolver] ConvolverNode createConvolver();
[RaisesException, MeasureAs=AudioContextCreateDynamicsCompressor] DynamicsCompressorNode createDynamicsCompressor();
[RaisesException, MeasureAs=AudioContextCreateAnalyser] AnalyserNode createAnalyser();
[RaisesException, MeasureAs=AudioContextCreateScriptProcessor] ScriptProcessorNode createScriptProcessor(optional unsigned long bufferSize, optional unsigned long numberOfInputChannels, optional unsigned long numberOfOutputChannels);
[RaisesException, MeasureAs=AudioContextCreateStereoPanner] StereoPannerNode createStereoPanner();
[RaisesException, MeasureAs=AudioContextCreateOscillator] OscillatorNode createOscillator();
[RaisesException, MeasureAs=AudioContextCreatePeriodicWave] PeriodicWave createPeriodicWave(Float32Array real, Float32Array imag, optional PeriodicWaveConstraints options);
// Channel splitting and merging
[RaisesException, MeasureAs=AudioContextCreateChannelSplitter] ChannelSplitterNode createChannelSplitter(optional unsigned long numberOfOutputs);
[RaisesException, MeasureAs=AudioContextCreateChannelMerger] ChannelMergerNode createChannelMerger(optional unsigned long numberOfInputs);
// Close
[MeasureAs=AudioContextClose, CallWith=ScriptState, ImplementedAs=closeContext] Promise<void> close();
// Pause/resume
[MeasureAs=AudioContextSuspend, CallWith=ScriptState, ImplementedAs=suspendContext] Promise<void> suspend();
[MeasureAs=AudioContextResume, CallWith=ScriptState, ImplementedAs=resumeContext] Promise<void> resume();
attribute EventHandler onstatechange;
}; };
...@@ -46,7 +46,7 @@ enum ChannelInterpretation { ...@@ -46,7 +46,7 @@ enum ChannelInterpretation {
[RaisesException, MeasureAs=AudioNodeDisconnectFromAudioNode] void disconnect(AudioNode destination, unsigned long output, unsigned long input); [RaisesException, MeasureAs=AudioNodeDisconnectFromAudioNode] void disconnect(AudioNode destination, unsigned long output, unsigned long input);
[RaisesException, MeasureAs=AudioNodeDisconnectFromAudioParam] void disconnect(AudioParam destination); [RaisesException, MeasureAs=AudioNodeDisconnectFromAudioParam] void disconnect(AudioParam destination);
[RaisesException, MeasureAs=AudioNodeDisconnectFromAudioParam] void disconnect(AudioParam destination, unsigned long output); [RaisesException, MeasureAs=AudioNodeDisconnectFromAudioParam] void disconnect(AudioParam destination, unsigned long output);
readonly attribute AudioContext context; readonly attribute BaseAudioContext context;
readonly attribute unsigned long numberOfInputs; readonly attribute unsigned long numberOfInputs;
readonly attribute unsigned long numberOfOutputs; readonly attribute unsigned long numberOfOutputs;
[RaisesException=Setter] attribute unsigned long channelCount; [RaisesException=Setter] attribute unsigned long channelCount;
......
// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// WebAudio spec: https://webaudio.github.io/web-audio-api/#BaseAudioContext
enum AudioContextState {
"suspended",
"running",
"closed"
};
[
ActiveScriptWrappable,
DependentLifetime,
NoInterfaceObject,
] interface BaseAudioContext : 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;
// All AudioNodes in the context run at this sample-rate (sample-frames per second).
readonly attribute float sampleRate;
// All panning is relative to this listener.
readonly attribute AudioListener listener;
// Current state of the AudioContext
readonly attribute AudioContextState state;
[RaisesException] AudioBuffer createBuffer(unsigned long numberOfChannels, unsigned long numberOfFrames, float sampleRate);
// Asynchronous audio file data decoding.
[RaisesException, MeasureAs=AudioContextDecodeAudioData, CallWith=ScriptState] Promise<AudioBuffer> decodeAudioData(ArrayBuffer audioData, optional AudioBufferCallback successCallback, optional AudioBufferCallback errorCallback);
// Sources
[RaisesException, MeasureAs=AudioContextCreateBufferSource] AudioBufferSourceNode createBufferSource();
// Processing nodes
[RaisesException, MeasureAs=AudioContextCreateGain] GainNode createGain();
[RaisesException, MeasureAs=AudioContextCreateDelay] DelayNode createDelay(optional double maxDelayTime);
[RaisesException, MeasureAs=AudioContextCreateBiquadFilter] BiquadFilterNode createBiquadFilter();
[RaisesException, MeasureAs=AudioContextCreateIIRFilter] IIRFilterNode createIIRFilter(sequence<double> feedForward, sequence<double> feedBack);
[RaisesException, MeasureAs=AudioContextCreateWaveShaper] WaveShaperNode createWaveShaper();
[RaisesException, MeasureAs=AudioContextCreatePannerAutomated] PannerNode createPanner();
[RaisesException, MeasureAs=AudioContextCreateConvolver] ConvolverNode createConvolver();
[RaisesException, MeasureAs=AudioContextCreateDynamicsCompressor] DynamicsCompressorNode createDynamicsCompressor();
[RaisesException, MeasureAs=AudioContextCreateAnalyser] AnalyserNode createAnalyser();
[RaisesException, MeasureAs=AudioContextCreateScriptProcessor] ScriptProcessorNode createScriptProcessor(optional unsigned long bufferSize, optional unsigned long numberOfInputChannels, optional unsigned long numberOfOutputChannels);
[RaisesException, MeasureAs=AudioContextCreateStereoPanner] StereoPannerNode createStereoPanner();
[RaisesException, MeasureAs=AudioContextCreateOscillator] OscillatorNode createOscillator();
[RaisesException, MeasureAs=AudioContextCreatePeriodicWave] PeriodicWave createPeriodicWave(Float32Array real, Float32Array imag, optional PeriodicWaveConstraints options);
// Channel splitting and merging
[RaisesException, MeasureAs=AudioContextCreateChannelSplitter] ChannelSplitterNode createChannelSplitter(optional unsigned long numberOfOutputs);
[RaisesException, MeasureAs=AudioContextCreateChannelMerger] ChannelMergerNode createChannelMerger(optional unsigned long numberOfInputs);
// Close
[MeasureAs=AudioContextClose, CallWith=ScriptState, ImplementedAs=closeContext] Promise<void> close();
// Pause/resume
[MeasureAs=AudioContextSuspend, CallWith=ScriptState, ImplementedAs=suspendContext] Promise<void> suspend();
[MeasureAs=AudioContextResume, CallWith=ScriptState, ImplementedAs=resumeContext] Promise<void> resume();
// TODO(rtoy): These really belong to the AudioContext, but we need them
// here so we can use an offline audio context to test these.
[RaisesException, MeasureAs=AudioContextCreateMediaElementSource] MediaElementAudioSourceNode createMediaElementSource(HTMLMediaElement mediaElement);
[RaisesException, MeasureAs=AudioContextCreateMediaStreamSource] MediaStreamAudioSourceNode createMediaStreamSource(MediaStream mediaStream);
[RaisesException, MeasureAs=AudioContextCreateMediaStreamDestination] MediaStreamAudioDestinationNode createMediaStreamDestination();
attribute EventHandler onstatechange;
};
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
ConstructorCallWith=ExecutionContext, ConstructorCallWith=ExecutionContext,
RaisesException=Constructor, RaisesException=Constructor,
NoInterfaceObject, NoInterfaceObject,
] interface OfflineAudioContext : AudioContext { ] interface OfflineAudioContext : BaseAudioContext {
// Offline rendering // Offline rendering
attribute EventHandler oncomplete; attribute EventHandler oncomplete;
readonly attribute unsigned long length; readonly attribute unsigned long length;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment