| 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 // Type of stream an audio device provides. | 10 // Type of stream an audio device provides. |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 FRONT_MIC, | 25 FRONT_MIC, |
| 26 REAR_MIC, | 26 REAR_MIC, |
| 27 KEYBOARD_MIC, | 27 KEYBOARD_MIC, |
| 28 HOTWORD, | 28 HOTWORD, |
| 29 LINEOUT, | 29 LINEOUT, |
| 30 POST_MIX_LOOPBACK, | 30 POST_MIX_LOOPBACK, |
| 31 POST_DSP_LOOPBACK, | 31 POST_DSP_LOOPBACK, |
| 32 OTHER | 32 OTHER |
| 33 }; | 33 }; |
| 34 | 34 |
| 35 [deprecated = "Used only with the deprecated $(ref:getInfo)."] | 35 [nodoc, deprecated = "Used only with the deprecated $(ref:getInfo)."] |
| 36 dictionary OutputDeviceInfo { | 36 dictionary OutputDeviceInfo { |
| 37 // The unique identifier of the audio output device. | 37 // The unique identifier of the audio output device. |
| 38 DOMString id; | 38 DOMString id; |
| 39 // The user-friendly name (e.g. "Bose Amplifier"). | 39 // The user-friendly name (e.g. "Bose Amplifier"). |
| 40 DOMString name; | 40 DOMString name; |
| 41 // True if this is the current active device. | 41 // True if this is the current active device. |
| 42 boolean isActive; | 42 boolean isActive; |
| 43 // True if this is muted. | 43 // True if this is muted. |
| 44 boolean isMuted; | 44 boolean isMuted; |
| 45 // The output volume ranging from 0.0 to 100.0. | 45 // The output volume ranging from 0.0 to 100.0. |
| 46 double volume; | 46 double volume; |
| 47 }; | 47 }; |
| 48 | 48 |
| 49 [deprecated = "Used only with the deprecated $(ref:getInfo)."] | 49 [nodoc, deprecated = "Used only with the deprecated $(ref:getInfo)."] |
| 50 dictionary InputDeviceInfo { | 50 dictionary InputDeviceInfo { |
| 51 // The unique identifier of the audio input device. | 51 // The unique identifier of the audio input device. |
| 52 DOMString id; | 52 DOMString id; |
| 53 // The user-friendly name (e.g. "USB Microphone"). | 53 // The user-friendly name (e.g. "USB Microphone"). |
| 54 DOMString name; | 54 DOMString name; |
| 55 // True if this is the current active device. | 55 // True if this is the current active device. |
| 56 boolean isActive; | 56 boolean isActive; |
| 57 // True if this is muted. | 57 // True if this is muted. |
| 58 boolean isMuted; | 58 boolean isMuted; |
| 59 // The input gain ranging from 0.0 to 100.0. | 59 // The input gain ranging from 0.0 to 100.0. |
| 60 double gain; | 60 double gain; |
| 61 }; | 61 }; |
| 62 | 62 |
| 63 dictionary AudioDeviceInfo { | 63 dictionary AudioDeviceInfo { |
| 64 // The unique identifier of the audio device. | 64 // The unique identifier of the audio device. |
| 65 DOMString id; | 65 DOMString id; |
| 66 // Stream type associated with this device. | 66 // Stream type associated with this device. |
| 67 StreamType streamType; | 67 StreamType streamType; |
| 68 // True for input device; false for output device. | |
| 69 [deprecated="Use |streamType|."] boolean isInput; | |
| 70 // Type of the device. | 68 // Type of the device. |
| 71 DeviceType deviceType; | 69 DeviceType deviceType; |
| 72 // The user-friendly name (e.g. "USB Microphone"). | 70 // The user-friendly name (e.g. "USB Microphone"). |
| 73 DOMString displayName; | 71 DOMString displayName; |
| 74 // Device name. | 72 // Device name. |
| 75 DOMString deviceName; | 73 DOMString deviceName; |
| 76 // True if this is the current active device. | 74 // True if this is the current active device. |
| 77 boolean isActive; | 75 boolean isActive; |
| 78 // True if this is muted. | |
| 79 boolean isMuted; | |
| 80 // The sound level of the device, volume for output, gain for input. | 76 // The sound level of the device, volume for output, gain for input. |
| 81 long level; | 77 long level; |
| 82 // The stable/persisted device id string when available. | 78 // The stable/persisted device id string when available. |
| 83 DOMString? stableDeviceId; | 79 DOMString? stableDeviceId; |
| 84 }; | 80 }; |
| 85 | 81 |
| 86 dictionary DeviceFilter { | 82 dictionary DeviceFilter { |
| 87 // If set, only audio devices whose stream type is included in this list | 83 // If set, only audio devices whose stream type is included in this list |
| 88 // will satisfy the filter. | 84 // will satisfy the filter. |
| 89 StreamType[]? streamTypes; | 85 StreamType[]? streamTypes; |
| 90 | 86 |
| 91 // If set, only audio devices whose active state matches this value will | 87 // If set, only audio devices whose active state matches this value will |
| 92 // satisfy the filter. | 88 // satisfy the filter. |
| 93 boolean? isActive; | 89 boolean? isActive; |
| 94 }; | 90 }; |
| 95 | 91 |
| 96 dictionary DeviceProperties { | 92 dictionary DeviceProperties { |
| 97 // True if this is muted. | 93 // True if this is muted. |
| 98 [deprecated="Use $(ref:setMute) to set mute state."] boolean? isMuted; | 94 [nodoc, deprecated="Use $(ref:setMute) to set mute state."] |
| 95 boolean? isMuted; |
| 99 | 96 |
| 100 // If this is an output device then this field indicates the output volume. | 97 // If this is an output device then this field indicates the output volume. |
| 101 // If this is an input device then this field is ignored. | 98 // If this is an input device then this field is ignored. |
| 102 [deprecated="Use |level| to set output volume."] double? volume; | 99 [nodoc, deprecated="Use |level| to set output volume."] double? volume; |
| 103 | 100 |
| 104 // If this is an input device then this field indicates the input gain. | 101 // If this is an input device then this field indicates the input gain. |
| 105 // If this is an output device then this field is ignored. | 102 // If this is an output device then this field is ignored. |
| 106 [deprecated="Use |level| to set input gain."] double? gain; | 103 [nodoc, deprecated="Use |level| to set input gain."] double? gain; |
| 107 | 104 |
| 108 // <p> | 105 // <p> |
| 109 // The audio device's desired sound level. Defaults to the device's | 106 // The audio device's desired sound level. Defaults to the device's |
| 110 // current sound level. | 107 // current sound level. |
| 111 // </p> | 108 // </p> |
| 112 // <p>If used with audio input device, represents audio device gain.</p> | 109 // <p>If used with audio input device, represents audio device gain.</p> |
| 113 // <p>If used with audio output device, represents audio device volume.</p> | 110 // <p>If used with audio output device, represents audio device volume.</p> |
| 114 long? level; | 111 long? level; |
| 115 }; | 112 }; |
| 116 | 113 |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 | 182 |
| 186 // Sets mute state for a stream type. The mute state will apply to all audio | 183 // Sets mute state for a stream type. The mute state will apply to all audio |
| 187 // devices with the specified audio stream type. | 184 // devices with the specified audio stream type. |
| 188 // |streamType|: Stream type for which mute state should be set. | 185 // |streamType|: Stream type for which mute state should be set. |
| 189 // |isMuted|: New mute value. | 186 // |isMuted|: New mute value. |
| 190 static void setMute(StreamType streamType, | 187 static void setMute(StreamType streamType, |
| 191 boolean isMuted, | 188 boolean isMuted, |
| 192 optional EmptyCallback callback); | 189 optional EmptyCallback callback); |
| 193 | 190 |
| 194 // Gets the information of all audio output and input devices. | 191 // Gets the information of all audio output and input devices. |
| 195 [deprecated="Use $(ref:getDevices) instead."] | 192 [nodoc, deprecated="Use $(ref:getDevices) instead."] |
| 196 static void getInfo(GetInfoCallback callback); | 193 static void getInfo(GetInfoCallback callback); |
| 197 }; | 194 }; |
| 198 | 195 |
| 199 interface Events { | 196 interface Events { |
| 200 // Fired when sound level changes for an active audio device. | 197 // Fired when sound level changes for an active audio device. |
| 201 static void onLevelChanged(LevelChangedEvent event); | 198 static void onLevelChanged(LevelChangedEvent event); |
| 202 | 199 |
| 203 // Fired when the mute state of the audio input or output changes. | 200 // Fired when the mute state of the audio input or output changes. |
| 204 // Note that mute state is system-wide and the new value applies to every | 201 // Note that mute state is system-wide and the new value applies to every |
| 205 // audio device with specified stream type. | 202 // audio device with specified stream type. |
| 206 static void onMuteChanged(MuteChangedEvent event); | 203 static void onMuteChanged(MuteChangedEvent event); |
| 207 | 204 |
| 208 // Fired when audio devices change, either new devices being added, or | 205 // Fired when audio devices change, either new devices being added, or |
| 209 // existing devices being removed. | 206 // existing devices being removed. |
| 210 // |devices|: List of all present audio devices after the change. | 207 // |devices|: List of all present audio devices after the change. |
| 211 static void onDeviceListChanged(AudioDeviceInfo[] devices); | 208 static void onDeviceListChanged(AudioDeviceInfo[] devices); |
| 212 | 209 |
| 213 // Fired when anything changes to the audio device configuration. | 210 // Fired when anything changes to the audio device configuration. |
| 214 [deprecated="Use more granular $(ref:onLevelChanged), | 211 [nodoc, deprecated="Use more granular $(ref:onLevelChanged), |
| 215 $(ref:onMuteChanged) and $(ref:onDeviceListChanged) instead."] | 212 $(ref:onMuteChanged) and $(ref:onDeviceListChanged) instead."] |
| 216 static void onDeviceChanged(); | 213 static void onDeviceChanged(); |
| 217 }; | 214 }; |
| 218 }; | 215 }; |
| OLD | NEW |