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

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>List of input devices specified by their ID.</p>
72 // <p>To indicate input devices should be unaffected, leave this property
73 // unset.</p>
74 DOMString[]? input;
75
76 // <p>List of output devices specified by their ID.</p>
77 // <p>To indicate output devices should be unaffected, leave this property
78 // unset.</p>
79 DOMString[]? output;
80 };
81
70 callback GetInfoCallback = void(OutputDeviceInfo[] outputInfo, 82 callback GetInfoCallback = void(OutputDeviceInfo[] outputInfo,
71 InputDeviceInfo[] inputInfo); 83 InputDeviceInfo[] inputInfo);
72 callback SetActiveDevicesCallback = void(); 84 callback EmptyCallback = void();
73 callback SetPropertiesCallback = void();
74 85
75 interface Functions { 86 interface Functions {
76 // Gets the information of all audio output and input devices. 87 // Gets the information of all audio output and input devices.
77 static void getInfo(GetInfoCallback callback); 88 static void getInfo(GetInfoCallback callback);
78 89
79 // Sets the active devices to the devices specified by |ids|. 90 // Sets lists of active input and/or output devices.
80 // It can pass in the "complete" active device id list of either input 91 // |ids|: <p>Specifies IDs of devices that should be active. If either the
81 // devices, or output devices, or both. If only input device ids are passed 92 // input or output list is not set, devices in that category are
82 // in, it will only change the input devices' active status, output devices wi ll 93 // unaffected.
83 // NOT be changed; similarly for the case if only output devices are passed. 94 // </p>
84 // If the devices specified in |new_active_ids| are already active, they will 95 // <p>It is an error to pass in a non-existent device ID.</p>
85 // remain active. Otherwise, the old active devices will be de-activated 96 // <p><b>NOTE:</b> While the method signature allows device IDs to be
86 // before we activate the new devices with the same type(input/output). 97 // passed as a list of strings, this method of setting active devices
87 static void setActiveDevices(DOMString[] ids, 98 // is deprecated and should not be relied upon to work. Please use
88 SetActiveDevicesCallback callback); 99 // $(ref: DeviceIdLists) instead.
100 // </p>
101 static void setActiveDevices((DeviceIdLists or DOMString[]) ids,
102 EmptyCallback callback);
89 103
90 // Sets the properties for the input or output device. 104 // Sets the properties for the input or output device.
91 static void setProperties(DOMString id, 105 static void setProperties(DOMString id,
92 DeviceProperties properties, 106 DeviceProperties properties,
93 SetPropertiesCallback callback); 107 EmptyCallback callback);
94 }; 108 };
95 109
96 interface Events { 110 interface Events {
97 // Fired when anything changes to the audio device configuration. 111 // Fired when anything changes to the audio device configuration.
98 static void onDeviceChanged(); 112 static void onDeviceChanged();
99 113
100 // Fired when sound level changes for an active audio device. 114 // Fired when sound level changes for an active audio device.
101 // |id|: id of the audio device. 115 // |id|: id of the audio device.
102 // |level|: new sound level of device(volume for output, gain for input). 116 // |level|: new sound level of device(volume for output, gain for input).
103 static void OnLevelChanged(DOMString id, long level); 117 static void OnLevelChanged(DOMString id, long level);
104 118
105 // Fired when the mute state of the audio input or output changes. 119 // Fired when the mute state of the audio input or output changes.
106 // |isInput|: true indicating audio input; false indicating audio output. 120 // |isInput|: true indicating audio input; false indicating audio output.
107 // |isMuted|: new value of mute state. 121 // |isMuted|: new value of mute state.
108 static void OnMuteChanged(boolean isInput, boolean isMuted); 122 static void OnMuteChanged(boolean isInput, boolean isMuted);
109 123
110 // Fired when audio devices change, either new devices being added, or 124 // Fired when audio devices change, either new devices being added, or
111 // existing devices being removed. 125 // existing devices being removed.
112 // |devices|: List of all present audio devices after the change. 126 // |devices|: List of all present audio devices after the change.
113 static void OnDevicesChanged(AudioDeviceInfo[] devices); 127 static void OnDevicesChanged(AudioDeviceInfo[] devices);
114 }; 128 };
115 }; 129 };
OLDNEW
« no previous file with comments | « extensions/browser/api/audio/audio_service_chromeos.cc ('k') | extensions/test/data/api_test/audio/test.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698