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

Unified Diff: extensions/common/api/audio.idl

Issue 2635983006: Final cleanup pass over audio device API (Closed)
Patch Set: . Created 3 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: extensions/common/api/audio.idl
diff --git a/extensions/common/api/audio.idl b/extensions/common/api/audio.idl
index a1706126b68ffa83854e1eb15c2960da5ffe452b..9ffe8f6d82ea743f75065e39bd7d0c629d484256 100644
--- a/extensions/common/api/audio.idl
+++ b/extensions/common/api/audio.idl
@@ -81,15 +81,35 @@ namespace audio {
DOMString? stableDeviceId;
};
+ dictionary DeviceFilter {
+ // If set, only audio devices whose stream type is included in this list
+ // will satisfy the filter.
+ StreamType[]? streamTypes;
+
+ // If set, only audio devices whose active state matches this value will
+ // satisfy the filter.
+ boolean? isActive;
+ };
+
dictionary DeviceProperties {
// True if this is muted.
[deprecated="Use $(ref:setMute) to set mute state."] boolean? isMuted;
+
// If this is an output device then this field indicates the output volume.
// If this is an input device then this field is ignored.
- double? volume;
+ [deprecated="Use |level| to set output volume."] double? volume;
Devlin 2017/02/10 20:24:29 Remind me - what's the plan for removing these?
tbarzic 2017/02/10 21:05:18 I'll send out a cl that makes these available only
+
// If this is an input device then this field indicates the input gain.
// If this is an output device then this field is ignored.
- double? gain;
+ [deprecated="Use |level| to set input gain."] double? gain;
+
+ // <p>
+ // The audio device's desired sound level. Defaults to the device's
+ // current sound level.
+ // </p>
+ // <p>If used with audio input device, represents audio device gain.</p>
+ // <p>If used with audio output device, represents audio device volume.</p>
+ long? level;
Devlin 2017/02/10 20:24:29 Would it make sense to rename gain/volume on the d
tbarzic 2017/02/10 21:05:18 Those are actually also deprecated - they're only
};
dictionary DeviceIdLists {
@@ -113,14 +133,27 @@ namespace audio {
boolean isMuted;
};
+ dictionary LevelChangedEvent {
+ // ID of device whose sound level has changed.
+ DOMString deviceId;
+
+ // The device's new sound level.
+ long level;
+ };
+
callback GetInfoCallback = void(OutputDeviceInfo[] outputInfo,
InputDeviceInfo[] inputInfo);
- callback EmptyCallback = void();
+ callback GetDevicesCallback = void(AudioDeviceInfo[] devices);
callback GetMuteCallback = void(boolean value);
+ callback EmptyCallback = void();
interface Functions {
- // Gets the information of all audio output and input devices.
- static void getInfo(GetInfoCallback callback);
+ // Gets a list of audio devices filtered based on |filter|.
+ // |filter|: Device properties by which to filter the list of returned
+ // audio devices. Use <code>{}</code> to get all available audio
+ // devices.
+ // |callback|: Reports the requested list of audio devices.
+ static void getDevices(DeviceFilter filter, GetDevicesCallback callback);
Devlin 2017/02/10 20:24:29 should filter be optional?
tbarzic 2017/02/10 21:05:18 I slightly prefer it not being optional, but I can
Devlin 2017/02/13 23:18:09 If there's no reason to require it, it seems odd t
tbarzic 2017/02/14 00:27:13 OK, done.
// Sets lists of active input and/or output devices.
// |ids|: <p>Specifies IDs of devices that should be active. If either the
@@ -131,7 +164,7 @@ namespace audio {
// <p><b>NOTE:</b> While the method signature allows device IDs to be
// passed as a list of strings, this method of setting active devices
// is deprecated and should not be relied upon to work. Please use
- // $(ref: DeviceIdLists) instead.
+ // $(ref:DeviceIdLists) instead.
// </p>
static void setActiveDevices((DeviceIdLists or DOMString[]) ids,
EmptyCallback callback);
@@ -154,16 +187,15 @@ namespace audio {
static void setMute(StreamType streamType,
boolean isMuted,
optional EmptyCallback callback);
+
+ // Gets the information of all audio output and input devices.
+ [deprecated="Use $(ref:getDevices) instead."]
+ static void getInfo(GetInfoCallback callback);
};
interface Events {
- // Fired when anything changes to the audio device configuration.
- static void onDeviceChanged();
-
// Fired when sound level changes for an active audio device.
- // |id|: id of the audio device.
- // |level|: new sound level of device(volume for output, gain for input).
- static void OnLevelChanged(DOMString id, long level);
+ static void onLevelChanged(LevelChangedEvent event);
// Fired when the mute state of the audio input or output changes.
// Note that mute state is system-wide and the new value applies to every
@@ -173,6 +205,11 @@ namespace audio {
// Fired when audio devices change, either new devices being added, or
// existing devices being removed.
// |devices|: List of all present audio devices after the change.
- static void OnDevicesChanged(AudioDeviceInfo[] devices);
Devlin 2017/02/10 20:24:29 Did we check that no one is currently using this e
tbarzic 2017/02/10 21:05:18 yes, I checked the event is not currently in use.
+ static void onDeviceListChanged(AudioDeviceInfo[] devices);
+
+ // Fired when anything changes to the audio device configuration.
+ [deprecated="Use more granular $(ref:onLevelChanged),
+ $(ref:onMuteChanged) and $(ref:onDeviceListChanged) instead."]
+ static void onDeviceChanged();
};
};

Powered by Google App Engine
This is Rietveld 408576698