src/Configuration.h
author František Kučera <franta-hg@frantovo.cz>
Thu, 08 Oct 2020 17:23:07 +0200
branchv_0
changeset 14 cde9bb07ea0a
parent 13 326935d1bfab
child 15 463ce61415f1
permissions -rw-r--r--
add options --connect-ports and --disconnect-ports to allow connecting and disconnecting arbitrary JACK ports
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
8
8ef1980db907 configurable JACK client name
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     1
/**
8ef1980db907 configurable JACK client name
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     2
 * Relational pipes
8ef1980db907 configurable JACK client name
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     3
 * Copyright © 2020 František Kučera (Frantovo.cz, GlobalCode.info)
8ef1980db907 configurable JACK client name
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     4
 *
8ef1980db907 configurable JACK client name
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     5
 * This program is free software: you can redistribute it and/or modify
8ef1980db907 configurable JACK client name
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     6
 * it under the terms of the GNU General Public License as published by
8ef1980db907 configurable JACK client name
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     7
 * the Free Software Foundation, version 3 of the License.
8ef1980db907 configurable JACK client name
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     8
 *
8ef1980db907 configurable JACK client name
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     9
 * This program is distributed in the hope that it will be useful,
8ef1980db907 configurable JACK client name
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
8ef1980db907 configurable JACK client name
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
8ef1980db907 configurable JACK client name
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    12
 * GNU General Public License for more details.
8ef1980db907 configurable JACK client name
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    13
 *
8ef1980db907 configurable JACK client name
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    14
 * You should have received a copy of the GNU General Public License
8ef1980db907 configurable JACK client name
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    15
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
8ef1980db907 configurable JACK client name
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    16
 */
8ef1980db907 configurable JACK client name
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    17
#pragma once
8ef1980db907 configurable JACK client name
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    18
8ef1980db907 configurable JACK client name
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    19
#include <vector>
8ef1980db907 configurable JACK client name
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    20
#include <iostream>
8ef1980db907 configurable JACK client name
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    21
8ef1980db907 configurable JACK client name
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    22
#include <relpipe/common/type/typedefs.h>
8ef1980db907 configurable JACK client name
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    23
8ef1980db907 configurable JACK client name
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    24
8ef1980db907 configurable JACK client name
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    25
namespace relpipe {
8ef1980db907 configurable JACK client name
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    26
namespace in {
8ef1980db907 configurable JACK client name
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    27
namespace jack {
8ef1980db907 configurable JACK client name
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    28
8ef1980db907 configurable JACK client name
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    29
class Configuration {
8ef1980db907 configurable JACK client name
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    30
public:
14
cde9bb07ea0a add options --connect-ports and --disconnect-ports to allow connecting and disconnecting arbitrary JACK ports
František Kučera <franta-hg@frantovo.cz>
parents: 13
diff changeset
    31
cde9bb07ea0a add options --connect-ports and --disconnect-ports to allow connecting and disconnecting arbitrary JACK ports
František Kučera <franta-hg@frantovo.cz>
parents: 13
diff changeset
    32
	class ConnectionRecipe {
cde9bb07ea0a add options --connect-ports and --disconnect-ports to allow connecting and disconnecting arbitrary JACK ports
František Kučera <franta-hg@frantovo.cz>
parents: 13
diff changeset
    33
	public:
cde9bb07ea0a add options --connect-ports and --disconnect-ports to allow connecting and disconnecting arbitrary JACK ports
František Kučera <franta-hg@frantovo.cz>
parents: 13
diff changeset
    34
		bool connected;
cde9bb07ea0a add options --connect-ports and --disconnect-ports to allow connecting and disconnecting arbitrary JACK ports
František Kučera <franta-hg@frantovo.cz>
parents: 13
diff changeset
    35
		relpipe::common::type::StringX sourcePort;
cde9bb07ea0a add options --connect-ports and --disconnect-ports to allow connecting and disconnecting arbitrary JACK ports
František Kučera <franta-hg@frantovo.cz>
parents: 13
diff changeset
    36
		relpipe::common::type::StringX destinationPort;
cde9bb07ea0a add options --connect-ports and --disconnect-ports to allow connecting and disconnecting arbitrary JACK ports
František Kučera <franta-hg@frantovo.cz>
parents: 13
diff changeset
    37
cde9bb07ea0a add options --connect-ports and --disconnect-ports to allow connecting and disconnecting arbitrary JACK ports
František Kučera <franta-hg@frantovo.cz>
parents: 13
diff changeset
    38
		ConnectionRecipe(bool connected, relpipe::common::type::StringX sourcePort, relpipe::common::type::StringX destinationPort) : connected(connected), sourcePort(sourcePort), destinationPort(destinationPort) {
cde9bb07ea0a add options --connect-ports and --disconnect-ports to allow connecting and disconnecting arbitrary JACK ports
František Kučera <franta-hg@frantovo.cz>
parents: 13
diff changeset
    39
		}
cde9bb07ea0a add options --connect-ports and --disconnect-ports to allow connecting and disconnecting arbitrary JACK ports
František Kučera <franta-hg@frantovo.cz>
parents: 13
diff changeset
    40
11
07247893054e add options --list-jack-ports and --list-midi-messages useful for bash-completion
František Kučera <franta-hg@frantovo.cz>
parents: 10
diff changeset
    41
	};
14
cde9bb07ea0a add options --connect-ports and --disconnect-ports to allow connecting and disconnecting arbitrary JACK ports
František Kučera <franta-hg@frantovo.cz>
parents: 13
diff changeset
    42
12
e8aae4d42c01 simplify CLI options: --client --connect-to --required-connections --list-ports + add --port
František Kučera <franta-hg@frantovo.cz>
parents: 11
diff changeset
    43
	relpipe::common::type::StringX client = L"relpipe-in-jack";
e8aae4d42c01 simplify CLI options: --client --connect-to --required-connections --list-ports + add --port
František Kučera <franta-hg@frantovo.cz>
parents: 11
diff changeset
    44
	relpipe::common::type::StringX port = L"midi-in";
e8aae4d42c01 simplify CLI options: --client --connect-to --required-connections --list-ports + add --port
František Kučera <franta-hg@frantovo.cz>
parents: 11
diff changeset
    45
	std::vector<relpipe::common::type::StringX> connectTo;
14
cde9bb07ea0a add options --connect-ports and --disconnect-ports to allow connecting and disconnecting arbitrary JACK ports
František Kučera <franta-hg@frantovo.cz>
parents: 13
diff changeset
    46
	std::vector<ConnectionRecipe> connectionRecipes;
12
e8aae4d42c01 simplify CLI options: --client --connect-to --required-connections --list-ports + add --port
František Kučera <franta-hg@frantovo.cz>
parents: 11
diff changeset
    47
	int requiredConnections = 0;
e8aae4d42c01 simplify CLI options: --client --connect-to --required-connections --list-ports + add --port
František Kučera <franta-hg@frantovo.cz>
parents: 11
diff changeset
    48
	relpipe::common::type::Boolean listPorts = false;
13
326935d1bfab add option --list-connections for listing JACK connections
František Kučera <franta-hg@frantovo.cz>
parents: 12
diff changeset
    49
	relpipe::common::type::Boolean listConnections = false;
11
07247893054e add options --list-jack-ports and --list-midi-messages useful for bash-completion
František Kučera <franta-hg@frantovo.cz>
parents: 10
diff changeset
    50
	relpipe::common::type::Boolean listMidiMessages = true;
8
8ef1980db907 configurable JACK client name
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    51
8ef1980db907 configurable JACK client name
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    52
	virtual ~Configuration() {
8ef1980db907 configurable JACK client name
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    53
	}
8ef1980db907 configurable JACK client name
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    54
};
8ef1980db907 configurable JACK client name
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    55
8ef1980db907 configurable JACK client name
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    56
}
8ef1980db907 configurable JACK client name
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    57
}
10
ded44e94147c add --jack-connect-to-port and --required-jack-connections options
František Kučera <franta-hg@frantovo.cz>
parents: 8
diff changeset
    58
}