From 0e07dc29bcda24f7c8fc65a2081cf145cb7d0d9d Mon Sep 17 00:00:00 2001 From: Ross Owen Date: Fri, 3 Feb 2023 11:09:43 +0000 Subject: [PATCH] Fix issue in mixer host app when retrieving mixer input strings. Also firmed up some usage error checking. --- host_usb_mixer_control/mixer_app.cpp | 36 +++++++++++++--------------- 1 file changed, 16 insertions(+), 20 deletions(-) diff --git a/host_usb_mixer_control/mixer_app.cpp b/host_usb_mixer_control/mixer_app.cpp index 5736ae3e..1ee2f079 100644 --- a/host_usb_mixer_control/mixer_app.cpp +++ b/host_usb_mixer_control/mixer_app.cpp @@ -175,7 +175,6 @@ void display_available_mixer_sources(int mixIndex) } } - /* Gets the current mixer inputs from the device an displays them */ void display_mixer_sources(int mixerIndex) { @@ -190,7 +189,7 @@ void display_mixer_sources(int mixerIndex) for(int i = 0; i < usb_mixsel_get_output_count(mixerIndex); i++) { int inputChan = (int)usb_mixsel_get_state(mixerIndex, i); - char *str = usb_mixer_get_input_name(mixerIndex,i); + char *str = usb_mixer_get_input_name(mixerIndex,inputChan); printf(" Mixer input %d: Source chan id: %d (%s)\n", i, inputChan, str); } } @@ -564,27 +563,26 @@ int main (int argc, char **argv) { { display_daw_channel_map_sources(); } + else if (strcmp(argv[1], "--set-aud-channel-map") == 0) + { + unsigned int dst = 0; + unsigned int src = 0; + if (argc != 4) + { + usage_error(); + return -1; + } + dst = atoi(argv[2]); + src = atoi(argv[3]); - - else if (strcmp(argv[1], "--set-aud-channel-map") == 0) - { - unsigned int dst = 0; - unsigned int src = 0; - if (argc < 4) { - usage_error(); - return -1; - } - dst = atoi(argv[2]); - src = atoi(argv[3]); - - usb_set_aud_channel_map(dst, src); - } - + usb_set_aud_channel_map(dst, src); + } else if (strcmp(argv[1], "--set-daw-channel-map") == 0) { unsigned int dst = 0; unsigned int src = 0; - if (argc < 4) { + if (argc != 4) + { usage_error(); return -1; } @@ -592,8 +590,6 @@ int main (int argc, char **argv) { src = atoi(argv[3]); usb_set_usb_channel_map(dst, src); - - } else if(strcmp(argv[1], "--get-mixer-levels-input") == 0 || strcmp(argv[1],"--get-mixer-levels-output") == 0)