1 /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
4 * You can obtain one at http://mozilla.org/MPL/2.0/.
6 * The origin of this IDL file is
7 * https://webaudio.github.io/web-audio-api/#idl-def-BaseAudioContext
9 * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C
10 * liability, trademark and document use rules apply.
13 callback DecodeSuccessCallback = undefined (AudioBuffer decodedData);
14 callback DecodeErrorCallback = undefined (DOMException error);
16 enum AudioContextState {
23 interface BaseAudioContext : EventTarget {
24 readonly attribute AudioDestinationNode destination;
25 readonly attribute float sampleRate;
26 readonly attribute double currentTime;
27 readonly attribute AudioListener listener;
28 readonly attribute AudioContextState state;
29 [Throws, SameObject, SecureContext]
30 readonly attribute AudioWorklet audioWorklet;
33 Promise<undefined> resume();
35 attribute EventHandler onstatechange;
38 AudioBuffer createBuffer (unsigned long numberOfChannels,
43 Promise<AudioBuffer> decodeAudioData(ArrayBuffer audioData,
44 optional DecodeSuccessCallback successCallback,
45 optional DecodeErrorCallback errorCallback);
49 AudioBufferSourceNode createBufferSource();
52 ConstantSourceNode createConstantSource();
55 ScriptProcessorNode createScriptProcessor(optional unsigned long bufferSize = 0,
56 optional unsigned long numberOfInputChannels = 2,
57 optional unsigned long numberOfOutputChannels = 2);
60 AnalyserNode createAnalyser();
63 GainNode createGain();
66 DelayNode createDelay(optional double maxDelayTime = 1); // TODO: no = 1
69 BiquadFilterNode createBiquadFilter();
72 IIRFilterNode createIIRFilter(sequence<double> feedforward, sequence<double> feedback);
75 WaveShaperNode createWaveShaper();
78 PannerNode createPanner();
81 StereoPannerNode createStereoPanner();
84 ConvolverNode createConvolver();
87 ChannelSplitterNode createChannelSplitter(optional unsigned long numberOfOutputs = 6);
90 ChannelMergerNode createChannelMerger(optional unsigned long numberOfInputs = 6);
93 DynamicsCompressorNode createDynamicsCompressor();
96 OscillatorNode createOscillator();
99 PeriodicWave createPeriodicWave(sequence<float> real,
100 sequence<float> imag,
101 optional PeriodicWaveConstraints constraints = {});