|
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 enum OscillatorType { |
|
14 // Hack: Use numbers to support alternate enum values |
|
15 "0", "1", "2", "3", "4", |
|
16 |
|
17 "sine", |
|
18 "square", |
|
19 "sawtooth", |
|
20 "triangle", |
|
21 "custom" |
|
22 }; |
|
23 |
|
24 interface OscillatorNode : AudioNode { |
|
25 |
|
26 [SetterThrows] |
|
27 attribute OscillatorType type; |
|
28 |
|
29 readonly attribute AudioParam frequency; // in Hertz |
|
30 readonly attribute AudioParam detune; // in Cents |
|
31 |
|
32 [Throws] |
|
33 void start(optional double when = 0); |
|
34 [Throws] |
|
35 void stop(optional double when = 0); |
|
36 void setPeriodicWave(PeriodicWave periodicWave); |
|
37 |
|
38 attribute EventHandler onended; |
|
39 |
|
40 }; |
|
41 |
|
42 /* |
|
43 * The origin of this IDL file is |
|
44 * https://dvcs.w3.org/hg/audio/raw-file/tip/webaudio/specification.html#AlternateNames |
|
45 */ |
|
46 partial interface OscillatorNode { |
|
47 // Same as start() |
|
48 [Throws,Pref="media.webaudio.legacy.OscillatorNode"] |
|
49 void noteOn(double when); |
|
50 |
|
51 // Same as stop() |
|
52 [Throws,Pref="media.webaudio.legacy.OscillatorNode"] |
|
53 void noteOff(double when); |
|
54 |
|
55 [Pref="media.webaudio.legacy.OscillatorNode"] |
|
56 const unsigned short SINE = 0; |
|
57 [Pref="media.webaudio.legacy.OscillatorNode"] |
|
58 const unsigned short SQUARE = 1; |
|
59 [Pref="media.webaudio.legacy.OscillatorNode"] |
|
60 const unsigned short SAWTOOTH = 2; |
|
61 [Pref="media.webaudio.legacy.OscillatorNode"] |
|
62 const unsigned short TRIANGLE = 3; |
|
63 [Pref="media.webaudio.legacy.OscillatorNode"] |
|
64 const unsigned short CUSTOM = 4; |
|
65 }; |
|
66 |