From 9e715089a4279d08b7cc8d7fbdb3eb8696230e65 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sun, 4 Aug 2013 23:20:56 +0200 Subject: Commands: new command "toggleoutput" --- src/OutputCommands.cxx | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/OutputCommands.cxx') diff --git a/src/OutputCommands.cxx b/src/OutputCommands.cxx index 7d626477a..5e4a145da 100644 --- a/src/OutputCommands.cxx +++ b/src/OutputCommands.cxx @@ -64,6 +64,22 @@ handle_disableoutput(Client *client, G_GNUC_UNUSED int argc, char *argv[]) return COMMAND_RETURN_OK; } +enum command_return +handle_toggleoutput(Client *client, gcc_unused int argc, char *argv[]) +{ + unsigned device; + if (!check_unsigned(client, &device, argv[1])) + return COMMAND_RETURN_ERROR; + + if (!audio_output_toggle_index(device)) { + command_error(client, ACK_ERROR_NO_EXIST, + "No such audio output"); + return COMMAND_RETURN_ERROR; + } + + return COMMAND_RETURN_OK; +} + enum command_return handle_devices(Client *client, G_GNUC_UNUSED int argc, G_GNUC_UNUSED char *argv[]) -- cgit v1.2.3