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://webaudio.github.io/web-audio-api/#enumdef-automationrate
8 * https://webaudio.github.io/web-audio-api/#audioparam
9 *
10 * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C
11 * liability, trademark and document use rules apply.
12 */
13
14enum AutomationRate {
15    "a-rate",
16    "k-rate"
17};
18
19[Pref="dom.webaudio.enabled",
20 Exposed=Window]
21interface AudioParam {
22    [SetterThrows]
23                    attribute float value;
24    readonly        attribute float defaultValue;
25    readonly        attribute float minValue;
26    readonly        attribute float maxValue;
27
28    // Parameter automation.
29    [Throws]
30    AudioParam setValueAtTime(float value, double startTime);
31    [Throws]
32    AudioParam linearRampToValueAtTime(float value, double endTime);
33    [Throws]
34    AudioParam exponentialRampToValueAtTime(float value, double endTime);
35
36    // Exponentially approach the target value with a rate having the given time constant.
37    [Throws]
38    AudioParam setTargetAtTime(float target, double startTime, double timeConstant);
39
40    // Sets an array of arbitrary parameter values starting at time for the given duration.
41    // The number of values will be scaled to fit into the desired duration.
42    [Throws]
43    AudioParam setValueCurveAtTime(sequence<float> values, double startTime, double duration);
44
45    // Cancels all scheduled parameter changes with times greater than or equal to startTime.
46    [Throws]
47    AudioParam cancelScheduledValues(double startTime);
48
49};
50
51// Mozilla extension
52partial interface AudioParam {
53  // The ID of the AudioNode this AudioParam belongs to.
54  [ChromeOnly]
55  readonly attribute unsigned long parentNodeId;
56  // The name of the AudioParam
57  [ChromeOnly]
58  readonly attribute DOMString name;
59};
60
61partial interface AudioParam {
62  // This attribute is used for mochitest only.
63  [ChromeOnly]
64  readonly attribute boolean isTrackSuspended;
65};
66