|
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/. |
|
5 * |
|
6 * The origin of this IDL file is |
|
7 * https://dvcs.w3.org/hg/audio/raw-file/tip/webaudio/specification.html |
|
8 * |
|
9 * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C |
|
10 * liability, trademark and document use rules apply. |
|
11 */ |
|
12 |
|
13 callback DecodeSuccessCallback = void (AudioBuffer decodedData); |
|
14 callback DecodeErrorCallback = void (); |
|
15 |
|
16 [Constructor, |
|
17 Constructor(AudioChannel audioChannelType)] |
|
18 interface AudioContext : EventTarget { |
|
19 |
|
20 readonly attribute AudioDestinationNode destination; |
|
21 readonly attribute float sampleRate; |
|
22 readonly attribute double currentTime; |
|
23 readonly attribute AudioListener listener; |
|
24 |
|
25 [NewObject, Throws] |
|
26 AudioBuffer createBuffer(unsigned long numberOfChannels, unsigned long length, float sampleRate); |
|
27 |
|
28 void decodeAudioData(ArrayBuffer audioData, |
|
29 DecodeSuccessCallback successCallback, |
|
30 optional DecodeErrorCallback errorCallback); |
|
31 |
|
32 // AudioNode creation |
|
33 [NewObject] |
|
34 AudioBufferSourceNode createBufferSource(); |
|
35 |
|
36 [NewObject, Throws] |
|
37 MediaStreamAudioDestinationNode createMediaStreamDestination(); |
|
38 |
|
39 [NewObject, Throws] |
|
40 ScriptProcessorNode createScriptProcessor(optional unsigned long bufferSize = 0, |
|
41 optional unsigned long numberOfInputChannels = 2, |
|
42 optional unsigned long numberOfOutputChannels = 2); |
|
43 |
|
44 [NewObject] |
|
45 AnalyserNode createAnalyser(); |
|
46 [NewObject, Throws] |
|
47 MediaElementAudioSourceNode createMediaElementSource(HTMLMediaElement mediaElement); |
|
48 [NewObject, Throws] |
|
49 MediaStreamAudioSourceNode createMediaStreamSource(MediaStream mediaStream); |
|
50 [NewObject] |
|
51 GainNode createGain(); |
|
52 [NewObject, Throws] |
|
53 DelayNode createDelay(optional double maxDelayTime = 1); |
|
54 [NewObject] |
|
55 BiquadFilterNode createBiquadFilter(); |
|
56 [NewObject] |
|
57 WaveShaperNode createWaveShaper(); |
|
58 [NewObject] |
|
59 PannerNode createPanner(); |
|
60 [NewObject] |
|
61 ConvolverNode createConvolver(); |
|
62 |
|
63 [NewObject, Throws] |
|
64 ChannelSplitterNode createChannelSplitter(optional unsigned long numberOfOutputs = 6); |
|
65 [NewObject, Throws] |
|
66 ChannelMergerNode createChannelMerger(optional unsigned long numberOfInputs = 6); |
|
67 |
|
68 [NewObject] |
|
69 DynamicsCompressorNode createDynamicsCompressor(); |
|
70 |
|
71 [NewObject] |
|
72 OscillatorNode createOscillator(); |
|
73 [NewObject, Throws] |
|
74 PeriodicWave createPeriodicWave(Float32Array real, Float32Array imag); |
|
75 |
|
76 }; |
|
77 |
|
78 // Mozilla extensions |
|
79 partial interface AudioContext { |
|
80 // Read AudioChannel.webidl for more information about this attribute. |
|
81 [Pref="media.useAudioChannelService", SetterThrows] |
|
82 attribute AudioChannel mozAudioChannelType; |
|
83 }; |