mirror of
https://github.com/fluencelabs/wasm-bindgen
synced 2025-04-22 12:42:14 +00:00
This commit employs the strategy described in #908 to apply a non-breaking change to fix WebIDL to be compatible with all browsers, including Safari. The problem here is that `BaseAudioContext` and `AudioScheduledSourceNode` are not types in Safari, but they are types in Firefox/Chrome. The fix here was to move the contents of these two interfaces into mixins, and then include the mixins in all classes which inherit from these two classes. That should have the same effect as defining the methods inherently on the original interface. Additionally a special `[RustDeprecated]` attribute to WebIDL was added to signify interfaces this has happened to. Currently it's directly tailored towards this case of "this intermediate class doesn't exist in all browsers", but we may want to refine and extend the deprecation message over time. Although it's possible we could do this as a breaking change to `web-sys` I'm hoping that we can do this as a non-breaking change for now and then eventually on the next breaking release batch all these changes together, deleting the intermediate classes. This is also hopefully a good trial run for how stable web-sys can be when it's actually stable! cc #897 cc #908
109 lines
3.7 KiB
Plaintext
Vendored
109 lines
3.7 KiB
Plaintext
Vendored
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
|
* You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
*
|
|
* The origin of this IDL file is
|
|
* https://webaudio.github.io/web-audio-api/#idl-def-BaseAudioContext
|
|
*
|
|
* Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C
|
|
* liability, trademark and document use rules apply.
|
|
*/
|
|
|
|
callback DecodeSuccessCallback = void (AudioBuffer decodedData);
|
|
callback DecodeErrorCallback = void (DOMException error);
|
|
|
|
enum AudioContextState {
|
|
"suspended",
|
|
"running",
|
|
"closed"
|
|
};
|
|
|
|
[RustDeprecated="doesn't exist in Safari, use `AudioContext` instead now"]
|
|
interface BaseAudioContext : EventTarget {
|
|
};
|
|
|
|
BaseAudioContext includes rustBaseAudioContext;
|
|
|
|
interface mixin rustBaseAudioContext {
|
|
readonly attribute AudioDestinationNode destination;
|
|
readonly attribute float sampleRate;
|
|
readonly attribute double currentTime;
|
|
readonly attribute AudioListener listener;
|
|
readonly attribute AudioContextState state;
|
|
[Throws, SameObject, SecureContext, Pref="dom.audioworklet.enabled"]
|
|
readonly attribute AudioWorklet audioWorklet;
|
|
// Bug 1324552: readonly attribute double baseLatency;
|
|
|
|
[Throws]
|
|
Promise<void> resume();
|
|
|
|
attribute EventHandler onstatechange;
|
|
|
|
[NewObject, Throws]
|
|
AudioBuffer createBuffer (unsigned long numberOfChannels,
|
|
unsigned long length,
|
|
float sampleRate);
|
|
|
|
[Throws]
|
|
Promise<AudioBuffer> decodeAudioData(ArrayBuffer audioData,
|
|
optional DecodeSuccessCallback successCallback,
|
|
optional DecodeErrorCallback errorCallback);
|
|
|
|
// AudioNode creation
|
|
[NewObject, Throws]
|
|
AudioBufferSourceNode createBufferSource();
|
|
|
|
[NewObject, Throws]
|
|
ConstantSourceNode createConstantSource();
|
|
|
|
[NewObject, Throws]
|
|
ScriptProcessorNode createScriptProcessor(optional unsigned long bufferSize = 0,
|
|
optional unsigned long numberOfInputChannels = 2,
|
|
optional unsigned long numberOfOutputChannels = 2);
|
|
|
|
[NewObject, Throws]
|
|
AnalyserNode createAnalyser();
|
|
|
|
[NewObject, Throws]
|
|
GainNode createGain();
|
|
|
|
[NewObject, Throws]
|
|
DelayNode createDelay(optional double maxDelayTime = 1); // TODO: no = 1
|
|
|
|
[NewObject, Throws]
|
|
BiquadFilterNode createBiquadFilter();
|
|
|
|
[NewObject, Throws]
|
|
IIRFilterNode createIIRFilter(sequence<double> feedforward, sequence<double> feedback);
|
|
|
|
[NewObject, Throws]
|
|
WaveShaperNode createWaveShaper();
|
|
|
|
[NewObject, Throws]
|
|
PannerNode createPanner();
|
|
|
|
[NewObject, Throws]
|
|
StereoPannerNode createStereoPanner();
|
|
|
|
[NewObject, Throws]
|
|
ConvolverNode createConvolver();
|
|
|
|
[NewObject, Throws]
|
|
ChannelSplitterNode createChannelSplitter(optional unsigned long numberOfOutputs = 6);
|
|
|
|
[NewObject, Throws]
|
|
ChannelMergerNode createChannelMerger(optional unsigned long numberOfInputs = 6);
|
|
|
|
[NewObject, Throws]
|
|
DynamicsCompressorNode createDynamicsCompressor();
|
|
|
|
[NewObject, Throws]
|
|
OscillatorNode createOscillator();
|
|
|
|
[NewObject, Throws]
|
|
PeriodicWave createPeriodicWave(Float32Array real,
|
|
Float32Array imag,
|
|
optional PeriodicWaveConstraints constraints);
|
|
};
|