# HG changeset patch # User František Kučera # Date 1601405344 -7200 # Node ID 01553c2ffa1d36ac2e5fea852960ae4c0e7a6a54 # Parent 7f3ab657dc50eacabd360e5aa2017796b15ce95e configurable JACK client name diff -r 7f3ab657dc50 -r 01553c2ffa1d bash-completion.sh --- a/bash-completion.sh Tue Sep 29 20:41:10 2020 +0200 +++ b/bash-completion.sh Tue Sep 29 20:49:04 2020 +0200 @@ -27,10 +27,11 @@ "false" ) - if [[ "$w1" == "--TODO" ]]; then COMPREPLY=($(compgen -W "${BOOLEAN[*]}" -- "$w0")) + if [[ "$w1" == "--TODO" ]]; then COMPREPLY=($(compgen -W "${BOOLEAN[*]}" -- "$w0")) + elif [[ "$w1" == "--jack-client-name" && "x$w0" == "x" ]]; then COMPREPLY=("'relpipe-out-jack'") else OPTIONS=( - "--TODO" + "--jack-client-name" ) COMPREPLY=($(compgen -W "${OPTIONS[*]}" -- "$w0")) fi diff -r 7f3ab657dc50 -r 01553c2ffa1d src/CLIParser.h --- a/src/CLIParser.h Tue Sep 29 20:41:10 2020 +0200 +++ b/src/CLIParser.h Tue Sep 29 20:49:04 2020 +0200 @@ -48,7 +48,7 @@ public: - static const relpipe::common::type::StringX OPTION_TODO; + static const relpipe::common::type::StringX OPTION_JACK_CLIENT_NAME; Configuration parse(const std::vector& arguments) { Configuration c; @@ -56,8 +56,8 @@ for (int i = 0; i < arguments.size();) { relpipe::common::type::StringX option = readNext(arguments, i); - if (option == OPTION_TODO) { - c.todo = parseBoolean(readNext(arguments, i)); + if (option == OPTION_JACK_CLIENT_NAME) { + c.jackClientName = readNext(arguments, i); } else throw relpipe::cli::RelpipeCLIException(L"Unsupported CLI option: " + option, relpipe::cli::CLI::EXIT_CODE_BAD_CLI_ARGUMENTS); } @@ -68,7 +68,7 @@ } }; -const relpipe::common::type::StringX CLIParser::OPTION_TODO = L"--todo"; +const relpipe::common::type::StringX CLIParser::OPTION_JACK_CLIENT_NAME = L"--jack-client-name"; } } diff -r 7f3ab657dc50 -r 01553c2ffa1d src/Configuration.h --- a/src/Configuration.h Tue Sep 29 20:41:10 2020 +0200 +++ b/src/Configuration.h Tue Sep 29 20:49:04 2020 +0200 @@ -28,7 +28,7 @@ class Configuration { public: - relpipe::common::type::Boolean todo = true; + relpipe::common::type::StringX jackClientName = L"relpipe-out-jack"; virtual ~Configuration() { } diff -r 7f3ab657dc50 -r 01553c2ffa1d src/JackHandler.h --- a/src/JackHandler.h Tue Sep 29 20:41:10 2020 +0200 +++ b/src/JackHandler.h Tue Sep 29 20:49:04 2020 +0200 @@ -53,7 +53,7 @@ JackHandler(Configuration& configuration) : configuration(configuration) { // Initialize JACK connection: - std::string clientName = "relpipe-out-jack"; + std::string clientName = convertor.to_bytes(configuration.jackClientName); jackClient = jack_client_open(clientName.c_str(), JackNullOption, nullptr); if (jackClient == nullptr) throw JackException(L"Could not create JACK client.");