// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// https://webaudio.github.io/web-audio-api/#enumdef-audiocontextstate
enum AudioContextState {
"suspended",
"running",
"closed"
};
// https://webaudio.github.io/web-audio-api/#BaseAudioContext
callback DecodeErrorCallback = void (DOMException error);
callback DecodeSuccessCallback = void (AudioBuffer decodedData);
[
Exposed=Window,
ActiveScriptWrappable
] interface BaseAudioContext : EventTarget {
readonly attribute AudioDestinationNode destination;
[HighEntropy=Direct, Measure] readonly attribute float sampleRate;
readonly attribute double currentTime;
readonly attribute AudioListener listener;
readonly attribute AudioContextState state;
[SecureContext] readonly attribute AudioWorklet audioWorklet;
attribute EventHandler onstatechange;
[RaisesException, MeasureAs=AudioContextCreateAnalyser] AnalyserNode createAnalyser();
[RaisesException, MeasureAs=AudioContextCreateBiquadFilter] BiquadFilterNode createBiquadFilter();
[RaisesException] AudioBuffer createBuffer(unsigned long numberOfChannels, unsigned long numberOfFrames, float sampleRate);
[RaisesException, MeasureAs=AudioContextCreateBufferSource] AudioBufferSourceNode createBufferSource();
[RaisesException, MeasureAs=AudioContextCreateChannelMerger] ChannelMergerNode createChannelMerger(optional unsigned long numberOfInputs);
[RaisesException, MeasureAs=AudioContextCreateChannelSplitter] ChannelSplitterNode createChannelSplitter(optional unsigned long numberOfOutputs);
[RaisesException, MeasureAs=AudioContextCreateConstantSource] ConstantSourceNode createConstantSource();
[RaisesException, MeasureAs=AudioContextCreateConvolver] ConvolverNode createConvolver();
[RaisesException, MeasureAs=AudioContextCreateDelay] DelayNode createDelay(optional double maxDelayTime);
[HighEntropy, RaisesException, MeasureAs=AudioContextCreateDynamicsCompressor] DynamicsCompressorNode createDynamicsCompressor();
[RaisesException, MeasureAs=AudioContextCreateGain] GainNode createGain();
[RaisesException, MeasureAs=AudioContextCreateIIRFilter] IIRFilterNode createIIRFilter(sequence<double> feedForward, sequence<double> feedBack);
[HighEntropy, RaisesException, MeasureAs=AudioContextCreateOscillator] OscillatorNode createOscillator();
[RaisesException, MeasureAs=AudioContextCreatePannerAutomated] PannerNode createPanner();
[RaisesException, MeasureAs=AudioContextCreatePeriodicWave] PeriodicWave createPeriodicWave(sequence<float> real, sequence<float> imag, optional PeriodicWaveConstraints constraints = {});
[RaisesException, MeasureAs=AudioContextCreateScriptProcessor] ScriptProcessorNode createScriptProcessor(optional unsigned long bufferSize, optional unsigned long numberOfInputChannels, optional unsigned long numberOfOutputChannels);
[RaisesException, MeasureAs=AudioContextCreateStereoPanner] StereoPannerNode createStereoPanner();
[RaisesException, MeasureAs=AudioContextCreateWaveShaper] WaveShaperNode createWaveShaper();
[RaisesException, MeasureAs=AudioContextDecodeAudioData, CallWith=ScriptState] Promise<AudioBuffer> decodeAudioData(ArrayBuffer audioData, optional DecodeSuccessCallback? successCallback, optional DecodeErrorCallback? errorCallback);
};