Adding Test Fixture for initial test cases for the App Remoting Test Driver. Also...
[chromium-blink-merge.git] / extensions / common / api / audio.idl
blob9461cbd3cf04377d9a04ada630b88dbbdaaaa250
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 // The <code>chrome.audio</code> API is provided to allow users to
6 // get information about and control the audio devices attached to the
7 // system. This API is currently only implemented for ChromeOS.
8 namespace audio {
10 dictionary OutputDeviceInfo {
11 // The unique identifier of the audio output device.
12 DOMString id;
13 // The user-friendly name (e.g. "Bose Amplifier").
14 DOMString name;
15 // True if this is the current active device.
16 boolean isActive;
17 // True if this is muted.
18 boolean isMuted;
19 // The output volume ranging from 0.0 to 100.0.
20 double volume;
23 dictionary InputDeviceInfo {
24 // The unique identifier of the audio input device.
25 DOMString id;
26 // The user-friendly name (e.g. "USB Microphone").
27 DOMString name;
28 // True if this is the current active device.
29 boolean isActive;
30 // True if this is muted.
31 boolean isMuted;
32 // The input gain ranging from 0.0 to 100.0.
33 double gain;
36 dictionary DeviceProperties {
37 // True if this is muted.
38 boolean isMuted;
39 // If this is an output device then this field indicates the output volume.
40 // If this is an input device then this field is ignored.
41 double? volume;
42 // If this is an input device then this field indicates the input gain.
43 // If this is an output device then this field is ignored.
44 double? gain;
47 callback GetInfoCallback = void(OutputDeviceInfo[] outputInfo,
48 InputDeviceInfo[] inputInfo);
49 callback SetActiveDevicesCallback = void();
50 callback SetPropertiesCallback = void();
52 interface Functions {
53 // Gets the information of all audio output and input devices.
54 static void getInfo(GetInfoCallback callback);
56 // Sets the active nodes to the nodes specified by |ids|.
57 // It can pass in the "complete" active node id list of either input
58 // nodes, or output nodes, or both. If only input node ids are passed in,
59 // it will only change the input nodes' active status, output nodes will NOT
60 // be changed; similarly for the case if only output nodes are passed.
61 // If the nodes specified in |new_active_ids| are already active, they will
62 // remain active. Otherwise, the old active nodes will be de-activated before
63 // we activate the new nodes with the same type(input/output).
64 static void setActiveDevices(DOMString[] ids,
65 SetActiveDevicesCallback callback);
67 // Sets the properties for the input or output device.
68 static void setProperties(DOMString id,
69 DeviceProperties properties,
70 SetPropertiesCallback callback);
73 interface Events {
74 // Fired when anything changes to the audio device configuration.
75 static void onDeviceChanged();
77 // Fired when sound level changes for an active audio node.
78 // |id|: id of the audio node.
79 // |level|: new sound level of the node(volume for output, gain for input).
80 static void OnLevelChanged(DOMString id, long level);