Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(674)

Side by Side Diff: extensions/common/api/audio.idl

Issue 2578473002: chrome.audio API: treat mute as system wide property (Closed)
Patch Set: . Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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.
11 enum StreamType {
12 INPUT,
13 OUTPUT
14 };
15
10 dictionary OutputDeviceInfo { 16 dictionary OutputDeviceInfo {
11 // The unique identifier of the audio output device. 17 // The unique identifier of the audio output device.
12 DOMString id; 18 DOMString id;
13 // The user-friendly name (e.g. "Bose Amplifier"). 19 // The user-friendly name (e.g. "Bose Amplifier").
14 DOMString name; 20 DOMString name;
15 // True if this is the current active device. 21 // True if this is the current active device.
16 boolean isActive; 22 boolean isActive;
17 // True if this is muted. 23 // True if this is muted.
18 boolean isMuted; 24 boolean isMuted;
19 // The output volume ranging from 0.0 to 100.0. 25 // The output volume ranging from 0.0 to 100.0.
20 double volume; 26 double volume;
21 }; 27 };
22 28
23 dictionary InputDeviceInfo { 29 dictionary InputDeviceInfo {
24 // The unique identifier of the audio input device. 30 // The unique identifier of the audio input device.
25 DOMString id; 31 DOMString id;
26 // The user-friendly name (e.g. "USB Microphone"). 32 // The user-friendly name (e.g. "USB Microphone").
27 DOMString name; 33 DOMString name;
28 // True if this is the current active device. 34 // True if this is the current active device.
29 boolean isActive; 35 boolean isActive;
30 // True if this is muted. 36 // True if this is muted.
31 boolean isMuted; 37 boolean isMuted;
32 // The input gain ranging from 0.0 to 100.0. 38 // The input gain ranging from 0.0 to 100.0.
33 double gain; 39 double gain;
34 }; 40 };
35 41
36 dictionary AudioDeviceInfo { 42 dictionary AudioDeviceInfo {
37 // The unique identifier of the audio device. 43 // The unique identifier of the audio device.
38 DOMString id; 44 DOMString id;
45 // Stream type associated with this device (input or output).
46 StreamType streamType;
39 // True for input device; false for output device. 47 // True for input device; false for output device.
40 boolean isInput; 48 [deprecated="Use |streamType|."] boolean isInput;
41 // Type of the device, including "INTERNAL_SPEAKER", "INTERNAL_MIC", 49 // Type of the device, including "INTERNAL_SPEAKER", "INTERNAL_MIC",
42 // "HEADPHONE", "USB", "BLUETOOTH", "HDMI", "MIC", "KEYBOARD_MIC", 50 // "HEADPHONE", "USB", "BLUETOOTH", "HDMI", "MIC", "KEYBOARD_MIC",
43 // "AOKR", and "OTHER". 51 // "AOKR", and "OTHER".
44 DOMString deviceType; 52 DOMString deviceType;
45 // The user-friendly name (e.g. "USB Microphone"). 53 // The user-friendly name (e.g. "USB Microphone").
46 DOMString displayName; 54 DOMString displayName;
47 // Device name. 55 // Device name.
48 DOMString deviceName; 56 DOMString deviceName;
49 // True if this is the current active device. 57 // True if this is the current active device.
50 boolean isActive; 58 boolean isActive;
51 // True if this is muted. 59 // True if this is muted.
52 boolean isMuted; 60 boolean isMuted;
53 // The sound level of the device, volume for output, gain for input. 61 // The sound level of the device, volume for output, gain for input.
54 long level; 62 long level;
55 // The stable/persisted device id string when available. 63 // The stable/persisted device id string when available.
56 DOMString? stableDeviceId; 64 DOMString? stableDeviceId;
57 }; 65 };
58 66
59 dictionary DeviceProperties { 67 dictionary DeviceProperties {
60 // True if this is muted. 68 // True if this is muted.
61 boolean isMuted; 69 [deprecated="Use $(ref:setMute) to set mute state."] boolean? isMuted;
62 // If this is an output device then this field indicates the output volume. 70 // If this is an output device then this field indicates the output volume.
63 // If this is an input device then this field is ignored. 71 // If this is an input device then this field is ignored.
64 double? volume; 72 double? volume;
65 // If this is an input device then this field indicates the input gain. 73 // If this is an input device then this field indicates the input gain.
66 // If this is an output device then this field is ignored. 74 // If this is an output device then this field is ignored.
67 double? gain; 75 double? gain;
68 }; 76 };
69 77
78 dictionary MuteStateChangedEvent {
79 // Type of the stream for which mute value has changed. The updated mute
80 // value applies to all devices with this stream type.
81 StreamType streamType;
82
83 // Value to which mute steate changed.
84 boolean value;
85 };
86
70 callback GetInfoCallback = void(OutputDeviceInfo[] outputInfo, 87 callback GetInfoCallback = void(OutputDeviceInfo[] outputInfo,
71 InputDeviceInfo[] inputInfo); 88 InputDeviceInfo[] inputInfo);
72 callback SetActiveDevicesCallback = void(); 89 callback GetMuteCallback = void(boolean value);
73 callback SetPropertiesCallback = void(); 90 callback EmptyCallback = void();
74 91
75 interface Functions { 92 interface Functions {
76 // Gets the information of all audio output and input devices. 93 // Gets the information of all audio output and input devices.
77 static void getInfo(GetInfoCallback callback); 94 static void getInfo(GetInfoCallback callback);
78 95
79 // Sets the active devices to the devices specified by |ids|. 96 // Sets the active devices to the devices specified by |ids|.
80 // It can pass in the "complete" active device id list of either input 97 // It can pass in the "complete" active device id list of either input
81 // devices, or output devices, or both. If only input device ids are passed 98 // devices, or output devices, or both. If only input device ids are passed
82 // in, it will only change the input devices' active status, output devices wi ll 99 // in, it will only change the input devices' active status, output devices
83 // NOT be changed; similarly for the case if only output devices are passed. 100 // will NOT be changed; similarly for the case if only output devices are
84 // If the devices specified in |new_active_ids| are already active, they will 101 // passed. If the devices specified in |new_active_ids| are already active,
85 // remain active. Otherwise, the old active devices will be de-activated 102 // they will remain active. Otherwise, the old active devices will be
86 // before we activate the new devices with the same type(input/output). 103 // de-activated before we activate the new devices with the same
87 static void setActiveDevices(DOMString[] ids, 104 // type(input/output).
88 SetActiveDevicesCallback callback); 105 static void setActiveDevices(DOMString[] ids, EmptyCallback callback);
89 106
90 // Sets the properties for the input or output device. 107 // Sets the properties for the input or output device.
91 static void setProperties(DOMString id, 108 static void setProperties(DOMString id,
92 DeviceProperties properties, 109 DeviceProperties properties,
93 SetPropertiesCallback callback); 110 EmptyCallback callback);
94 }; 111
112 // Gets system-wide mute state for the specified stream type.
113 // |streamType|: Stream type for which mute state should be fetched.
114 // |callback|: Callback reporting whether mute is set or not for specified
115 // stream type.
116 static void getMute(StreamType streamType, GetMuteCallback callback);
117
118 // Sets mute state for a stream type. The mute state will apply to all audio
119 // devices with the specified audio stream type.
120 // |streamType|: Stream type for which mute status should be set.
121 // |value|: New mute value.
122 static void setMute(StreamType streamType,
123 boolean value,
124 EmptyCallback callback);
125 };
95 126
96 interface Events { 127 interface Events {
97 // Fired when anything changes to the audio device configuration. 128 // Fired when anything changes to the audio device configuration.
98 static void onDeviceChanged(); 129 static void onDeviceChanged();
99 130
100 // Fired when sound level changes for an active audio device. 131 // Fired when sound level changes for an active audio device.
101 // |id|: id of the audio device. 132 // |id|: id of the audio device.
102 // |level|: new sound level of device(volume for output, gain for input). 133 // |level|: new sound level of device(volume for output, gain for input).
103 static void OnLevelChanged(DOMString id, long level); 134 static void OnLevelChanged(DOMString id, long level);
104 135
105 // Fired when the mute state of the audio input or output changes. 136 // Fired when the mute state of the audio input or output changes.
137 // Note that mute state is system-wide and the new value applies to every
138 // audio device with specified stream type.
139 static void onMuteStateChanged(MuteStateChangedEvent event);
140
141 // Fired when the mute state of the audio input or output changes.
106 // |isInput|: true indicating audio input; false indicating audio output. 142 // |isInput|: true indicating audio input; false indicating audio output.
107 // |isMuted|: new value of mute state. 143 // |isMuted|: new value of mute state.
144 [deprecated="Use $(ref:onMuteStateChanged)."]
tbarzic 2016/12/22 01:29:56 Do you know if this one is used at all - it doesn'
jennyz 2017/01/10 00:47:53 Better ask mnilsson.
108 static void OnMuteChanged(boolean isInput, boolean isMuted); 145 static void OnMuteChanged(boolean isInput, boolean isMuted);
109 146
110 // Fired when audio devices change, either new devices being added, or 147 // Fired when audio devices change, either new devices being added, or
111 // existing devices being removed. 148 // existing devices being removed.
112 // |devices|: List of all present audio devices after the change. 149 // |devices|: List of all present audio devices after the change.
113 static void OnDevicesChanged(AudioDeviceInfo[] devices); 150 static void OnDevicesChanged(AudioDeviceInfo[] devices);
114 }; 151 };
115 }; 152 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698