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

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

Issue 2605983002: Simplify logic behind chrome.audio.setActiveDevices (Closed)
Patch Set: . Created 3 years, 11 months 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 dictionary OutputDeviceInfo { 10 dictionary OutputDeviceInfo {
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 // True if this is muted. 60 // True if this is muted.
61 boolean isMuted; 61 boolean isMuted;
62 // If this is an output device then this field indicates the output volume. 62 // 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. 63 // If this is an input device then this field is ignored.
64 double? volume; 64 double? volume;
65 // If this is an input device then this field indicates the input gain. 65 // 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. 66 // If this is an output device then this field is ignored.
67 double? gain; 67 double? gain;
68 }; 68 };
69 69
70 dictionary DeviceIdLists {
71 // <p>IDs of all input devices that should be active.</p>
72 // <p>
73 // Only <b>existing input</b> device IDs will be accepted. If this is not
74 // the case, the method will fail without updating active devices.
75 // </p>
76 DOMString[]? input;
77
78 // <p>IDs of all output devices that should be active.</p>
79 // <p>
80 // Only <b>existing output</b> device IDs will be accepted. If this is not
81 // the case, the method will fail without updating active devices.
82 // </p>
83 DOMString[]? output;
84 };
85
70 callback GetInfoCallback = void(OutputDeviceInfo[] outputInfo, 86 callback GetInfoCallback = void(OutputDeviceInfo[] outputInfo,
71 InputDeviceInfo[] inputInfo); 87 InputDeviceInfo[] inputInfo);
72 callback SetActiveDevicesCallback = void(); 88 callback EmptyCallback = void();
73 callback SetPropertiesCallback = void();
74 89
75 interface Functions { 90 interface Functions {
76 // Gets the information of all audio output and input devices. 91 // Gets the information of all audio output and input devices.
77 static void getInfo(GetInfoCallback callback); 92 static void getInfo(GetInfoCallback callback);
78 93
79 // Sets the active devices to the devices specified by |ids|.
80 // 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
82 // in, it will only change the input devices' active status, output devices wi ll
83 // NOT be changed; similarly for the case if only output devices are passed.
84 // If the devices specified in |new_active_ids| are already active, they will
85 // remain active. Otherwise, the old active devices will be de-activated
86 // before we activate the new devices with the same type(input/output).
87 static void setActiveDevices(DOMString[] ids,
88 SetActiveDevicesCallback callback);
89 94
90 // Sets the properties for the input or output device. 95 // Sets the properties for the input or output device.
91 static void setProperties(DOMString id, 96 static void setProperties(DOMString id,
92 DeviceProperties properties, 97 DeviceProperties properties,
93 SetPropertiesCallback callback); 98 EmptyCallback callback);
94 }; 99
100 // Sets lists of active input and/or output devices.
101 // |ids|: Specifies IDs of devices that should be active. The device IDs
102 // are split on basis of the device's audio stream type. If list
103 // for a particular stream direction is not set, set of active devices
104 // with that stream direction will not be affected.
105 static void setActiveDeviceLists(DeviceIdLists ids, EmptyCallback callback);
Devlin 2017/01/13 16:11:00 Could we instead update the signature of the curre
tbarzic 2017/01/13 18:52:49 Yes. Or even better, we could define the first arg
106
107 // Sets the active devices to the devices specified by |ids|.
108 // It can pass in the "complete" active device id list of either input
109 // devices, or output devices, or both. If only input device ids are passed
110 // in, it will only change the input devices' active status, output devices
111 // will *not* be changed; similarly for the case if only output devices are
112 // passed.
113 // If the devices specified in |new_active_ids| are already active, they
114 // will remain active. Otherwise, the old active devices will be
115 // de-activated before we activate the new devices with the same
116 // type(input/output).
117 [deprecated="Use $(ref:setActiveDeviceLists)"]
118 static void setActiveDevices(DOMString[] ids, EmptyCallback callback);
119 };
95 120
96 interface Events { 121 interface Events {
97 // Fired when anything changes to the audio device configuration. 122 // Fired when anything changes to the audio device configuration.
98 static void onDeviceChanged(); 123 static void onDeviceChanged();
99 124
100 // Fired when sound level changes for an active audio device. 125 // Fired when sound level changes for an active audio device.
101 // |id|: id of the audio device. 126 // |id|: id of the audio device.
102 // |level|: new sound level of device(volume for output, gain for input). 127 // |level|: new sound level of device(volume for output, gain for input).
103 static void OnLevelChanged(DOMString id, long level); 128 static void OnLevelChanged(DOMString id, long level);
104 129
105 // Fired when the mute state of the audio input or output changes. 130 // Fired when the mute state of the audio input or output changes.
106 // |isInput|: true indicating audio input; false indicating audio output. 131 // |isInput|: true indicating audio input; false indicating audio output.
107 // |isMuted|: new value of mute state. 132 // |isMuted|: new value of mute state.
108 static void OnMuteChanged(boolean isInput, boolean isMuted); 133 static void OnMuteChanged(boolean isInput, boolean isMuted);
109 134
110 // Fired when audio devices change, either new devices being added, or 135 // Fired when audio devices change, either new devices being added, or
111 // existing devices being removed. 136 // existing devices being removed.
112 // |devices|: List of all present audio devices after the change. 137 // |devices|: List of all present audio devices after the change.
113 static void OnDevicesChanged(AudioDeviceInfo[] devices); 138 static void OnDevicesChanged(AudioDeviceInfo[] devices);
114 }; 139 };
115 }; 140 };
OLDNEW
« no previous file with comments | « extensions/browser/extension_function_histogram_value.h ('k') | extensions/test/data/api_test/audio/test.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698