1
// ------------------------------------------------------------------------
2
// eca-control-main.h: ECA_CONTROL_MAIN class
3
// Copyright (C) 2009 Kai Vehmanen
6
// eca-style-version: 3
8
// This program is free software; you can redistribute it and/or modify
9
// it under the terms of the GNU General Public License as published by
10
// the Free Software Foundation; either version 2 of the License, or
11
// (at your option) any later version.
13
// This program is distributed in the hope that it will be useful,
14
// but WITHOUT ANY WARRANTY; without even the implied warranty of
15
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
// GNU General Public License for more details.
18
// You should have received a copy of the GNU General Public License
19
// along with this program. If not, see <http://www.gnu.org/licenses/>.
20
// ------------------------------------------------------------------------
22
#ifndef INCLUDED_ECA_CONTROL_MAIN_H
23
#define INCLUDED_ECA_CONTROL_MAIN_H
28
#include "eca-chainsetup-edit.h"
30
struct eci_return_value {
40
std::vector<std::string> string_list_val;
41
std::string string_val;
45
long int long_int_val;
50
* High-level interface for using libecasound functionality
52
* This class is the abstract interface. Actual implementations
53
* are done in subclasses - e.g. ECA_CONTROL and
54
* ECA_CONTROL_MT (multi-threaded).
56
* Related design patters: Facade (GoF185)
58
class ECA_CONTROL_MAIN {
62
/** @name Constructors and dtors */
65
virtual ~ECA_CONTROL_MAIN(void);
69
// -------------------------------------------------------------------
71
/** @name Runtime control */
74
virtual void engine_start(void) = 0;
75
virtual int start(void) = 0;
76
virtual void stop(void) = 0;
77
virtual void stop_on_condition(void) = 0;
78
virtual int run(bool batchmode = true) = 0;
79
virtual void quit(void) = 0;
80
virtual void quit_async(void) = 0;
82
virtual bool is_running(void) const = 0;
83
virtual bool is_connected(void) const = 0;
84
virtual bool is_selected(void) const = 0;
85
virtual bool is_finished(void) const = 0;
86
virtual bool is_valid(void) const = 0;
87
virtual bool is_engine_created(void) const = 0;
88
virtual bool is_engine_running(void) const = 0;
90
virtual const ECA_CHAINSETUP* get_connected_chainsetup(void) const = 0;
92
virtual void connect_chainsetup(struct eci_return_value *retval) = 0;
93
virtual void disconnect_chainsetup(void) = 0;
97
// -------------------------------------------------------------------
99
/** @name Execute edit objects */
102
virtual bool execute_edit_on_connected(const ECA::chainsetup_edit_t& edit) = 0;
103
virtual bool execute_edit_on_selected(const ECA::chainsetup_edit_t& edit, int index = -1) = 0;
107
/** @name Building blocks for ECI -Ecasound Control Interface */
111
* Parses and executes a string containing a single Ecasound
112
* Interactive Mode (EIAM) command and its arguments.
114
* Result of the command is stored to 'retval'.
116
virtual void command(const std::string& cmd_and_args, struct eci_return_value *retval) = 0;
119
* A special version of 'command()' which parses a command taking
120
* a single double parameter.
122
* Result of the command is stored to 'retval'.
124
virtual void command_float_arg(const std::string& cmd, double arg, struct eci_return_value *retval) = 0;
126
virtual void print_last_value(struct eci_return_value *retval) const = 0;
130
// -------------------------------------------------------------------
132
/** @name Static helper functions */
135
static std::string return_value_to_string(const struct eci_return_value *retval, int float_precision = 9);
136
static const char* return_value_type_to_string(const struct eci_return_value *retval);
137
static void clear_return_value(struct eci_return_value *retval);
141
// -------------------------------------------------------------------
145
#endif /* INCLUDED_ECA_CONTROL_MAIN_H */