OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // The <code>chrome.audio</code> API is provided to allow users to | 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 | 6 // get information about and control the audio devices attached to the |
7 // system. This API is currently only implemented for ChromeOS. | 7 // system. This API is currently only implemented for ChromeOS. |
8 namespace audio { | 8 namespace audio { |
9 | 9 |
10 dictionary OutputDeviceInfo { | 10 dictionary OutputDeviceInfo { |
(...skipping 26 matching lines...) Expand all Loading... |
37 // True if this is muted. | 37 // True if this is muted. |
38 boolean isMuted; | 38 boolean isMuted; |
39 // If this is an output device then this field indicates the output volume. | 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. | 40 // If this is an input device then this field is ignored. |
41 double? volume; | 41 double? volume; |
42 // If this is an input device then this field indicates the input gain. | 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. | 43 // If this is an output device then this field is ignored. |
44 double? gain; | 44 double? gain; |
45 }; | 45 }; |
46 | 46 |
| 47 dictionary AudioDeviceInfo { |
| 48 // The unique identifier of the audio device. |
| 49 DOMString id; |
| 50 // True if the device is an input device; False if it is an output device. |
| 51 boolean isInput; |
| 52 // Display name of the device, (e.g. "Bose Amplifier"). |
| 53 DOMString displayName; |
| 54 // Device name of the device. |
| 55 DOMString deviceName; |
| 56 // True if the device is active. |
| 57 boolean isActive; |
| 58 // True if the device is muted. |
| 59 boolean isMuted; |
| 60 // Volume if this is an output device, Gain if this is an input device. |
| 61 double volumeGain; |
| 62 }; |
| 63 |
47 callback GetInfoCallback = void(OutputDeviceInfo[] outputInfo, | 64 callback GetInfoCallback = void(OutputDeviceInfo[] outputInfo, |
48 InputDeviceInfo[] inputInfo); | 65 InputDeviceInfo[] inputInfo); |
49 callback SetActiveDevicesCallback = void(); | 66 callback SetActiveDevicesCallback = void(); |
50 callback SetPropertiesCallback = void(); | 67 callback SetPropertiesCallback = void(); |
| 68 callback GetDeviceInfoCallback = void(AudioDeviceInfo[] deviceInfo); |
51 | 69 |
52 interface Functions { | 70 interface Functions { |
53 // Get the information of all audio output and input devices. | 71 // Gets the information of all audio output and input devices. |
54 static void getInfo(GetInfoCallback callback); | 72 static void getInfo(GetInfoCallback callback); |
55 | 73 |
56 // Select a subset of audio devices as active. | 74 // Sets the active nodes to the nodes specified by |ids|. |
| 75 // It can pass in the "complete" active node id list of either input |
| 76 // nodes, or output nodes, or both. If only input node ids are passed in, |
| 77 // it will only change the input nodes' active status, output nodes will NOT |
| 78 // be changed; similarly for the case if only output nodes are passed. |
| 79 // If the nodes specified in |new_active_ids| are already active, they will |
| 80 // remain active. Otherwise, the old active nodes will be de-activated before |
| 81 // we activate the new nodes with the same type(input/output). |
57 static void setActiveDevices(DOMString[] ids, | 82 static void setActiveDevices(DOMString[] ids, |
58 SetActiveDevicesCallback callback); | 83 SetActiveDevicesCallback callback); |
59 | 84 |
60 // Sets the properties for the input or output device. | 85 // Sets the properties for the input or output device. |
61 static void setProperties(DOMString id, | 86 static void setProperties(DOMString id, |
62 DeviceProperties properties, | 87 DeviceProperties properties, |
63 SetPropertiesCallback callback); | 88 SetPropertiesCallback callback); |
| 89 |
| 90 // Gets the information of all audio devices. |
| 91 static void getDeviceInfo(GetDeviceInfoCallback callback); |
64 }; | 92 }; |
65 | 93 |
66 interface Events { | 94 interface Events { |
67 // Fired when anything changes to the audio device configuration. | 95 // Fired when anything changes to the audio device configuration. |
68 static void onDeviceChanged(); | 96 static void onDeviceChanged(); |
| 97 |
| 98 // Fired when output volume changes for a particular node. |
| 99 // |id|: id of the output node. |
| 100 // |volume|: new volume of the output node. |
| 101 static void OnOutputNodeVolumeChanged(DOMString id, double volume); |
69 }; | 102 }; |
70 }; | 103 }; |
OLD | NEW |