Fix issue in mixer host app when retrieving mixer input strings. Also firmed up some usage error checking.

This commit is contained in:
Ross Owen
2023-02-03 11:09:43 +00:00
parent 43f77c177d
commit 0e07dc29bc

View File

@@ -175,7 +175,6 @@ void display_available_mixer_sources(int mixIndex)
} }
} }
/* Gets the current mixer inputs from the device an displays them */ /* Gets the current mixer inputs from the device an displays them */
void display_mixer_sources(int mixerIndex) 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++) for(int i = 0; i < usb_mixsel_get_output_count(mixerIndex); i++)
{ {
int inputChan = (int)usb_mixsel_get_state(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); 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(); 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]);
usb_set_aud_channel_map(dst, src);
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);
}
else if (strcmp(argv[1], "--set-daw-channel-map") == 0) else if (strcmp(argv[1], "--set-daw-channel-map") == 0)
{ {
unsigned int dst = 0; unsigned int dst = 0;
unsigned int src = 0; unsigned int src = 0;
if (argc < 4) { if (argc != 4)
{
usage_error(); usage_error();
return -1; return -1;
} }
@@ -592,8 +590,6 @@ int main (int argc, char **argv) {
src = atoi(argv[3]); src = atoi(argv[3]);
usb_set_usb_channel_map(dst, src); usb_set_usb_channel_map(dst, src);
} }
else if(strcmp(argv[1], "--get-mixer-levels-input") == 0 || else if(strcmp(argv[1], "--get-mixer-levels-input") == 0 ||
strcmp(argv[1],"--get-mixer-levels-output") == 0) strcmp(argv[1],"--get-mixer-levels-output") == 0)