From 3b7cca5b99b6daa5c138a86373f7ca335147df90 Mon Sep 17 00:00:00 2001 From: Dave Reisner Date: Tue, 1 Jan 2013 21:37:22 -0500 Subject: maybe fix app mode? A sources-output can only be moved to a new source, and a sink-input can only be moved to a new sink. So, derive the target type based on this. Also, reroute sink -> sink-input and source -> source-output to save some keystrokes. --- ponymix.cc | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/ponymix.cc b/ponymix.cc index 69d13f8..08c2ad5 100644 --- a/ponymix.cc +++ b/ponymix.cc @@ -382,9 +382,24 @@ static int SetProfile(Pulse& ponymix, int argc, char* argv[] _unused_) { static int Move(Pulse& ponymix, int argc, char* argv[]) { if (argc != 1) errx(1, "error: move requires 1 argument"); + // this assignment is a lie. stfu g++ + enum DeviceType target_type = opt_devtype; + switch (opt_devtype) { + case DEVTYPE_SOURCE: + opt_devtype = DEVTYPE_SOURCE_OUTPUT; + case DEVTYPE_SOURCE_OUTPUT: + target_type = DEVTYPE_SOURCE; + break; + case DEVTYPE_SINK: + opt_devtype = DEVTYPE_SINK_INPUT; + case DEVTYPE_SINK_INPUT: + target_type = DEVTYPE_SINK; + break; + } + // Does this even work? auto source = string_to_device_or_die(ponymix, opt_device, opt_devtype); - auto target = string_to_device_or_die(ponymix, argv[0], opt_devtype); + auto target = string_to_device_or_die(ponymix, argv[0], target_type); return !ponymix.Move(*source, *target); } -- cgit v1.2.3