multimedia: Add API to set active output volume
Add cras utils and multimedia server API to set active output volume.
BUG=chromium:463813
TEST=not used yet.
Change-Id: I9557a8fe0f6b24b5c112508994543d4379b954c4
Reviewed-on: https://chromium-review.googlesource.com/257291
Reviewed-by: Wai-Hong Tam <waihong@chromium.org>
Commit-Queue: Cheng-Yi Chiang <cychiang@chromium.org>
Tested-by: Cheng-Yi Chiang <cychiang@chromium.org>
diff --git a/client/cros/audio/cras_utils.py b/client/cros/audio/cras_utils.py
index 33ca9b9..e53e11d 100644
--- a/client/cros/audio/cras_utils.py
+++ b/client/cros/audio/cras_utils.py
@@ -127,6 +127,16 @@
return (output_match.group(1).strip(), input_match.group(1).strip())
+
+def set_selected_output_node_volume(volume):
+ """Sets the selected output node volume.
+
+ @param volume: the volume to be set (0-100).
+ """
+ selected_output_node_id, _ = get_selected_nodes()
+ set_node_volume(selected_output_node_id, volume)
+
+
def get_active_stream_count():
"""Gets the number of active streams."""
server_info = dump_server_info()