| 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. |
| 11 enum StreamType { | 11 enum StreamType { |
| 12 INPUT, | 12 INPUT, |
| 13 OUTPUT | 13 OUTPUT |
| 14 }; | 14 }; |
| 15 | 15 |
| 16 // Available audio device types. |
| 17 enum DeviceType { |
| 18 HEADPHONE, |
| 19 MIC, |
| 20 USB, |
| 21 BLUETOOTH, |
| 22 HDMI, |
| 23 INTERNAL_SPEAKER, |
| 24 INTERNAL_MIC, |
| 25 FRONT_MIC, |
| 26 REAR_MIC, |
| 27 KEYBOARD_MIC, |
| 28 HOTWORD, |
| 29 LINEOUT, |
| 30 POST_MIX_LOOPBACK, |
| 31 POST_DSP_LOOPBACK, |
| 32 OTHER |
| 33 }; |
| 34 |
| 16 dictionary OutputDeviceInfo { | 35 dictionary OutputDeviceInfo { |
| 17 // The unique identifier of the audio output device. | 36 // The unique identifier of the audio output device. |
| 18 DOMString id; | 37 DOMString id; |
| 19 // The user-friendly name (e.g. "Bose Amplifier"). | 38 // The user-friendly name (e.g. "Bose Amplifier"). |
| 20 DOMString name; | 39 DOMString name; |
| 21 // True if this is the current active device. | 40 // True if this is the current active device. |
| 22 boolean isActive; | 41 boolean isActive; |
| 23 // True if this is muted. | 42 // True if this is muted. |
| 24 boolean isMuted; | 43 boolean isMuted; |
| 25 // The output volume ranging from 0.0 to 100.0. | 44 // The output volume ranging from 0.0 to 100.0. |
| (...skipping 13 matching lines...) Expand all Loading... |
| 39 double gain; | 58 double gain; |
| 40 }; | 59 }; |
| 41 | 60 |
| 42 dictionary AudioDeviceInfo { | 61 dictionary AudioDeviceInfo { |
| 43 // The unique identifier of the audio device. | 62 // The unique identifier of the audio device. |
| 44 DOMString id; | 63 DOMString id; |
| 45 // Stream type associated with this device. | 64 // Stream type associated with this device. |
| 46 StreamType streamType; | 65 StreamType streamType; |
| 47 // True for input device; false for output device. | 66 // True for input device; false for output device. |
| 48 [deprecated="Use |streamType|."] boolean isInput; | 67 [deprecated="Use |streamType|."] boolean isInput; |
| 49 // Type of the device, including "INTERNAL_SPEAKER", "INTERNAL_MIC", | 68 // Type of the device. |
| 50 // "HEADPHONE", "USB", "BLUETOOTH", "HDMI", "MIC", "KEYBOARD_MIC", | 69 DeviceType deviceType; |
| 51 // "AOKR", and "OTHER". | |
| 52 DOMString deviceType; | |
| 53 // The user-friendly name (e.g. "USB Microphone"). | 70 // The user-friendly name (e.g. "USB Microphone"). |
| 54 DOMString displayName; | 71 DOMString displayName; |
| 55 // Device name. | 72 // Device name. |
| 56 DOMString deviceName; | 73 DOMString deviceName; |
| 57 // True if this is the current active device. | 74 // True if this is the current active device. |
| 58 boolean isActive; | 75 boolean isActive; |
| 59 // True if this is muted. | 76 // True if this is muted. |
| 60 boolean isMuted; | 77 boolean isMuted; |
| 61 // The sound level of the device, volume for output, gain for input. | 78 // The sound level of the device, volume for output, gain for input. |
| 62 long level; | 79 long level; |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 // Note that mute state is system-wide and the new value applies to every | 169 // Note that mute state is system-wide and the new value applies to every |
| 153 // audio device with specified stream type. | 170 // audio device with specified stream type. |
| 154 static void onMuteChanged(MuteChangedEvent event); | 171 static void onMuteChanged(MuteChangedEvent event); |
| 155 | 172 |
| 156 // Fired when audio devices change, either new devices being added, or | 173 // Fired when audio devices change, either new devices being added, or |
| 157 // existing devices being removed. | 174 // existing devices being removed. |
| 158 // |devices|: List of all present audio devices after the change. | 175 // |devices|: List of all present audio devices after the change. |
| 159 static void OnDevicesChanged(AudioDeviceInfo[] devices); | 176 static void OnDevicesChanged(AudioDeviceInfo[] devices); |
| 160 }; | 177 }; |
| 161 }; | 178 }; |
| OLD | NEW |