| <!DOCTYPE html> |
| <html class="a"> |
| <head> |
| <title>AudioBuffer IDL Test</title> |
| <script src="/resources/testharness.js"></script> |
| <script src="/resources/testharnessreport.js"></script> |
| <script src="/resources/idlharness.js"></script> |
| <script src="/resources/WebIDLParser.js"></script> |
| <script src="/webaudio/js/helpers.js"></script> |
| <style type="text/css"> |
| #event-target-idl, |
| #base-audio-context-idl |
| { visibility:hidden; height: 0px;} |
| </style> |
| </head> |
| <body class="a"> |
| |
| <pre id="event-target-idl">interface EventTarget { |
| void addEventListener(DOMString type, EventListener? callback, optional boolean capture = false); |
| void removeEventListener(DOMString type, EventListener? callback, optional boolean capture = false); |
| boolean dispatchEvent(Event event); |
| }; |
| |
| /* |
| callback interface EventListener { |
| void handleEvent(Event event); |
| }; |
| */ |
| // Callback interfaces are not supported yet, but that's ok |
| interface EventListener {}; |
| </pre> |
| |
| <pre id="base-audio-context-idl">callback DecodeErrorCallback = void (DOMException error); |
| callback DecodeSuccessCallback = void (AudioBuffer decodedData); |
| |
| interface BaseAudioContext : EventTarget { |
| readonly attribute AudioDestinationNode destination; |
| readonly attribute float sampleRate; |
| readonly attribute double currentTime; |
| readonly attribute AudioListener listener; |
| readonly attribute AudioContextState state; |
| readonly attribute double baseLatency; |
| Promise<void> resume (); |
| attribute EventHandler onstatechange; |
| AudioBuffer createBuffer (unsigned long numberOfChannels, unsigned long length, float sampleRate); |
| Promise<AudioBuffer> decodeAudioData (ArrayBuffer audioData, optional DecodeSuccessCallback successCallback, optional DecodeErrorCallback errorCallback); |
| AudioBufferSourceNode createBufferSource (); |
| ConstantSourceNode createConstantSource (); |
| ScriptProcessorNode createScriptProcessor (optional unsigned long bufferSize = 0 |
| , optional unsigned long numberOfInputChannels = 2 |
| , optional unsigned long numberOfOutputChannels = 2 |
| ); |
| AnalyserNode createAnalyser (); |
| GainNode createGain (); |
| DelayNode createDelay (optional double maxDelayTime); |
| BiquadFilterNode createBiquadFilter (); |
| IIRFilterNode createIIRFilter (sequence<double> feedforward, sequence<double> feedback); |
| WaveShaperNode createWaveShaper (); |
| PannerNode createPanner (); |
| StereoPannerNode createStereoPanner (); |
| ConvolverNode createConvolver (); |
| ChannelSplitterNode createChannelSplitter (optional unsigned long numberOfOutputs = 6 |
| ); |
| ChannelMergerNode createChannelMerger (optional unsigned long numberOfInputs = 6 |
| ); |
| DynamicsCompressorNode createDynamicsCompressor (); |
| OscillatorNode createOscillator (); |
| PeriodicWave createPeriodicWave (Float32Array real, Float32Array imag, optional PeriodicWaveConstraints constraints); |
| };</pre> |
| |
| <pre id="audio-buffer-idl">dictionary AudioBufferOptions { |
| unsigned long numberOfChannels = 1; |
| required unsigned long length; |
| required float sampleRate; |
| }; |
| |
| [Constructor(AudioBufferOptions options)] |
| interface AudioBuffer { |
| readonly attribute float sampleRate; |
| readonly attribute unsigned long length; |
| readonly attribute double duration; |
| readonly attribute unsigned long numberOfChannels; |
| Float32Array getChannelData (unsigned long channel); |
| void copyFromChannel (Float32Array destination, unsigned long channelNumber, optional unsigned long startInChannel = 0 |
| ); |
| void copyToChannel (Float32Array source, unsigned long channelNumber, optional unsigned long startInChannel = 0 |
| ); |
| };</pre> |
| |
| <div id="log"></div> |
| |
| <script> |
| (function() { |
| var idl_array = new IdlArray(); |
| idl_array.add_untested_idls(document.getElementById("event-target-idl").textContent); |
| idl_array.add_untested_idls(document.getElementById("base-audio-context-idl").textContent); |
| idl_array.add_idls(document.getElementById("audio-buffer-idl").textContent); |
| |
| // For these tests the value of the arguments is unimportant. |
| audio_buffer = (new AudioContext).createBuffer(numberOfChannels = 1, length = 256, sampleRate = 44100); |
| |
| idl_array.add_objects({AudioBuffer: ["audio_buffer"]}); |
| idl_array.test(); |
| })(); |
| </script> |
| </body> |
| </html> |