2012-08-31 13:59:37 -07:00
|
|
|
/* -*- 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://dvcs.w3.org/hg/audio/raw-file/tip/webaudio/specification.html
|
|
|
|
*
|
|
|
|
* Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C
|
|
|
|
* liability, trademark and document use rules apply.
|
|
|
|
*/
|
|
|
|
|
2013-02-01 14:13:23 -08:00
|
|
|
callback DecodeSuccessCallback = void (AudioBuffer decodedData);
|
|
|
|
callback DecodeErrorCallback = void ();
|
|
|
|
|
2014-04-17 23:06:23 -07:00
|
|
|
[Constructor,
|
|
|
|
Constructor(AudioChannel audioChannelType)]
|
2013-04-24 21:28:39 -07:00
|
|
|
interface AudioContext : EventTarget {
|
2012-09-18 16:07:33 -07:00
|
|
|
|
|
|
|
readonly attribute AudioDestinationNode destination;
|
2012-11-29 19:31:39 -08:00
|
|
|
readonly attribute float sampleRate;
|
2013-03-14 18:01:02 -07:00
|
|
|
readonly attribute double currentTime;
|
2012-11-05 16:26:03 -08:00
|
|
|
readonly attribute AudioListener listener;
|
2012-09-18 16:07:33 -07:00
|
|
|
|
2013-09-30 09:32:22 -07:00
|
|
|
[NewObject, Throws]
|
2012-09-21 15:42:14 -07:00
|
|
|
AudioBuffer createBuffer(unsigned long numberOfChannels, unsigned long length, float sampleRate);
|
|
|
|
|
2013-02-01 14:13:23 -08:00
|
|
|
void decodeAudioData(ArrayBuffer audioData,
|
|
|
|
DecodeSuccessCallback successCallback,
|
|
|
|
optional DecodeErrorCallback errorCallback);
|
|
|
|
|
2014-04-17 23:06:23 -07:00
|
|
|
// AudioNode creation
|
2013-09-30 09:32:22 -07:00
|
|
|
[NewObject]
|
2012-09-18 16:07:33 -07:00
|
|
|
AudioBufferSourceNode createBufferSource();
|
|
|
|
|
2013-09-30 09:32:22 -07:00
|
|
|
[NewObject, Throws]
|
2013-05-21 12:17:47 -07:00
|
|
|
MediaStreamAudioDestinationNode createMediaStreamDestination();
|
|
|
|
|
2013-09-30 09:32:22 -07:00
|
|
|
[NewObject, Throws]
|
2013-04-13 18:37:04 -07:00
|
|
|
ScriptProcessorNode createScriptProcessor(optional unsigned long bufferSize = 0,
|
|
|
|
optional unsigned long numberOfInputChannels = 2,
|
|
|
|
optional unsigned long numberOfOutputChannels = 2);
|
|
|
|
|
2013-09-30 09:32:22 -07:00
|
|
|
[NewObject]
|
2013-03-31 20:41:14 -07:00
|
|
|
AnalyserNode createAnalyser();
|
2013-09-30 09:32:22 -07:00
|
|
|
[NewObject, Throws]
|
2013-07-24 20:01:49 -07:00
|
|
|
MediaElementAudioSourceNode createMediaElementSource(HTMLMediaElement mediaElement);
|
2013-09-30 09:32:22 -07:00
|
|
|
[NewObject, Throws]
|
2013-07-24 04:29:39 -07:00
|
|
|
MediaStreamAudioSourceNode createMediaStreamSource(MediaStream mediaStream);
|
2013-09-30 09:32:22 -07:00
|
|
|
[NewObject]
|
2012-10-31 12:09:32 -07:00
|
|
|
GainNode createGain();
|
2013-09-30 09:32:22 -07:00
|
|
|
[NewObject, Throws]
|
2012-11-19 12:52:29 -08:00
|
|
|
DelayNode createDelay(optional double maxDelayTime = 1);
|
2013-09-30 09:32:22 -07:00
|
|
|
[NewObject]
|
2012-11-07 17:59:14 -08:00
|
|
|
BiquadFilterNode createBiquadFilter();
|
2013-09-30 09:32:22 -07:00
|
|
|
[NewObject]
|
2013-05-13 21:12:30 -07:00
|
|
|
WaveShaperNode createWaveShaper();
|
2013-09-30 09:32:22 -07:00
|
|
|
[NewObject]
|
2012-11-05 18:14:13 -08:00
|
|
|
PannerNode createPanner();
|
2013-09-30 09:32:22 -07:00
|
|
|
[NewObject]
|
2013-06-10 13:07:55 -07:00
|
|
|
ConvolverNode createConvolver();
|
2012-10-31 12:09:32 -07:00
|
|
|
|
2013-09-30 09:32:22 -07:00
|
|
|
[NewObject, Throws]
|
2013-05-05 08:49:13 -07:00
|
|
|
ChannelSplitterNode createChannelSplitter(optional unsigned long numberOfOutputs = 6);
|
2013-09-30 09:32:22 -07:00
|
|
|
[NewObject, Throws]
|
2013-05-05 08:49:37 -07:00
|
|
|
ChannelMergerNode createChannelMerger(optional unsigned long numberOfInputs = 6);
|
2013-05-05 08:49:13 -07:00
|
|
|
|
2013-09-30 09:32:22 -07:00
|
|
|
[NewObject]
|
2012-11-06 17:01:11 -08:00
|
|
|
DynamicsCompressorNode createDynamicsCompressor();
|
|
|
|
|
2013-09-30 09:32:22 -07:00
|
|
|
[NewObject]
|
2013-08-19 11:53:00 -07:00
|
|
|
OscillatorNode createOscillator();
|
2013-09-30 09:32:22 -07:00
|
|
|
[NewObject, Throws]
|
2013-06-19 15:24:26 -07:00
|
|
|
PeriodicWave createPeriodicWave(Float32Array real, Float32Array imag);
|
2013-05-28 04:19:07 -07:00
|
|
|
|
2012-08-31 13:59:37 -07:00
|
|
|
};
|
|
|
|
|
2013-10-11 04:55:47 -07:00
|
|
|
// Mozilla extensions
|
|
|
|
partial interface AudioContext {
|
2013-10-28 17:08:14 -07:00
|
|
|
// Read AudioChannel.webidl for more information about this attribute.
|
2013-10-11 04:55:47 -07:00
|
|
|
[Pref="media.useAudioChannelService", SetterThrows]
|
|
|
|
attribute AudioChannel mozAudioChannelType;
|
2014-06-12 23:06:14 -07:00
|
|
|
|
|
|
|
// These 2 events are dispatched when the AudioContext object is muted by
|
|
|
|
// the AudioChannelService. It's call 'interrupt' because when this event is
|
|
|
|
// dispatched on a HTMLMediaElement, the audio stream is paused.
|
|
|
|
[Pref="media.useAudioChannelService"]
|
|
|
|
attribute EventHandler onmozinterruptbegin;
|
|
|
|
|
|
|
|
[Pref="media.useAudioChannelService"]
|
|
|
|
attribute EventHandler onmozinterruptend;
|
2014-08-03 06:46:17 -07:00
|
|
|
|
|
|
|
// This method is for test only.
|
|
|
|
[ChromeOnly] AudioChannel testAudioChannelInAudioNodeStream();
|
2014-06-12 23:06:14 -07:00
|
|
|
};
|