diff options
-rw-r--r-- | configure.ac | 2 | ||||
-rw-r--r-- | src/aiomixer.cc | 30 |
2 files changed, 18 insertions, 14 deletions
diff --git a/configure.ac b/configure.ac index a9b7f68..933c83a 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -AC_INIT([libaudioio], 1.0.0 ) +AC_INIT([libaudioio], 1.0.0) AC_CONFIG_SRCDIR([src/audioio.cc]) diff --git a/src/aiomixer.cc b/src/aiomixer.cc index bfe37f9..30f721b 100644 --- a/src/aiomixer.cc +++ b/src/aiomixer.cc @@ -69,11 +69,11 @@ int main(int argc, char *argv[]) char *p; bool list = false; - bool list_enum = false; + bool show_enum = false; + bool list_enums = false; bool range = false; bool num_channels = false; - std::string enum_name; std::string enum_value; std::string level_name; @@ -83,14 +83,14 @@ int main(int argc, char *argv[]) while(1) { static struct option long_options[] = { {"list", no_argument, 0, 'L'}, - {"enum", required_argument, 0, 'e'}, + {"enum", optional_argument, 0, 'e'}, {"level", required_argument, 0, 'l'}, {"version", no_argument, 0, 'v'}, {"help", no_argument, 0, 'h'}, {0, 0, 0, 0} }; - c = getopt_long (argc, argv, "hvLe:l:rc", long_options, &option_index); + c = getopt_long (argc, argv, "hvLe::l::rcE", long_options, &option_index); if (c == -1) break; @@ -108,14 +108,13 @@ int main(int argc, char *argv[]) num_channels = true; break; + case 'E': + list_enums = true; + break; + case 'e': - p = strchr(optarg, '='); - if(p) { - *p = '\0'; - enum_value = p+1; - } - enum_name = optarg; - if(enum_name == "") list_enum = true; + show_enum = true; + if(optarg) enum_value = optarg; break; case 'l': @@ -205,7 +204,7 @@ int main(int argc, char *argv[]) } */ - if(list_enum) { + if(list_enums) { std::vector<std::string> evs = mix->enumValues(); std::vector<std::string>::iterator i = evs.begin(); printf("Enum values:\n"); @@ -216,7 +215,12 @@ int main(int argc, char *argv[]) printf("\n"); } - if(enum_name != "" && enum_value == "") { + if(enum_value != "") { + printf("Setting enum value to '%s'\n", enum_value.c_str()); + mix->setEnumValue(enum_value); + } + + if(show_enum) { std::string ev = mix->enumValue(); printf("Enum value: '%s'\n", ev.c_str()); } |