aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Reisner <dreisner@archlinux.org>2013-01-01 21:37:22 -0500
committerDave Reisner <dreisner@archlinux.org>2013-01-01 21:37:22 -0500
commit3b7cca5b99b6daa5c138a86373f7ca335147df90 (patch)
tree63a205fd1e28428ea871d7efb785b83b68a48f49
parent598c7174b5b917a2a47ea1cca724f77c0f673485 (diff)
downloadmirror-ponymix-3b7cca5b99b6daa5c138a86373f7ca335147df90.tar.gz
mirror-ponymix-3b7cca5b99b6daa5c138a86373f7ca335147df90.tar.bz2
mirror-ponymix-3b7cca5b99b6daa5c138a86373f7ca335147df90.zip
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.
-rw-r--r--ponymix.cc17
1 files changed, 16 insertions, 1 deletions
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);
}