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.
10 dictionary OutputDeviceInfo
{
11 // The unique identifier of the audio output device.
13 // The user-friendly name (e.g. "Bose Amplifier").
15 // True if this is the current active device.
17 // True if this is muted.
19 // The output volume ranging from 0.0 to 100.0.
23 dictionary InputDeviceInfo
{
24 // The unique identifier of the audio input device.
26 // The user-friendly name (e.g. "USB Microphone").
28 // True if this is the current active device.
30 // True if this is muted.
32 // The input gain ranging from 0.0 to 100.0.
36 dictionary DeviceProperties
{
37 // True if this is muted.
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.
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.
47 callback GetInfoCallback
= void(OutputDeviceInfo
[] outputInfo
,
48 InputDeviceInfo
[] inputInfo
);
49 callback SetActiveDevicesCallback
= void();
50 callback SetPropertiesCallback
= void();
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);
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
);