~ubuntu-branches/ubuntu/saucy/ecasound2.2/saucy

« back to all changes in this revision

Viewing changes to libecasound/eca-control-main.h

  • Committer: Bazaar Package Importer
  • Author(s): Junichi Uekawa
  • Date: 2009-11-02 18:22:35 UTC
  • mfrom: (5.1.2 sid)
  • Revision ID: james.westby@ubuntu.com-20091102182235-4ngh7699dmkgonyu
Tags: 2.7.0-1
* New upstream release.
* Depend on libreadline-dev instead of libreadline5-dev by request of
  Mattias Klose. It's now libreadline6-dev. (closes: #553748)
* Update menu file to use section Applications/ instead of Apps/.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// ------------------------------------------------------------------------
 
2
// eca-control-main.h: ECA_CONTROL_MAIN class
 
3
// Copyright (C) 2009 Kai Vehmanen
 
4
//
 
5
// Attributes:
 
6
//     eca-style-version: 3
 
7
//
 
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.
 
12
// 
 
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.
 
17
// 
 
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
// ------------------------------------------------------------------------
 
21
 
 
22
#ifndef INCLUDED_ECA_CONTROL_MAIN_H
 
23
#define INCLUDED_ECA_CONTROL_MAIN_H
 
24
 
 
25
#include <string>
 
26
#include <vector>
 
27
 
 
28
#include "eca-chainsetup-edit.h"
 
29
 
 
30
struct eci_return_value {
 
31
  enum { 
 
32
    retval_none = 0,
 
33
    retval_string_list,
 
34
    retval_string,
 
35
    retval_float,
 
36
    retval_integer,
 
37
    retval_long_integer,
 
38
    retval_error
 
39
  } type;
 
40
  std::vector<std::string> string_list_val;
 
41
  std::string string_val;
 
42
  union {
 
43
    double float_val;
 
44
    int int_val;
 
45
    long int long_int_val;
 
46
  } m;
 
47
};
 
48
  
 
49
/**
 
50
 * High-level interface for using libecasound functionality
 
51
 *
 
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).
 
55
 *
 
56
 * Related design patters: Facade (GoF185)
 
57
 */
 
58
class ECA_CONTROL_MAIN {
 
59
  
 
60
public:
 
61
 
 
62
  /** @name Constructors and dtors */
 
63
  /*@{*/
 
64
 
 
65
  virtual ~ECA_CONTROL_MAIN(void);
 
66
 
 
67
  /*@}*/
 
68
 
 
69
  // -------------------------------------------------------------------
 
70
 
 
71
  /** @name Runtime control */
 
72
  /*@{*/
 
73
 
 
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;
 
81
 
 
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;
 
89
 
 
90
  virtual const ECA_CHAINSETUP* get_connected_chainsetup(void) const = 0;
 
91
 
 
92
  virtual void connect_chainsetup(struct eci_return_value *retval) = 0;
 
93
  virtual void disconnect_chainsetup(void) = 0;
 
94
 
 
95
  /*@}*/
 
96
 
 
97
  // -------------------------------------------------------------------
 
98
 
 
99
  /** @name Execute edit objects */
 
100
  /*@{*/
 
101
 
 
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;
 
104
 
 
105
  /*@}*/
 
106
 
 
107
  /** @name Building blocks for ECI -Ecasound Control Interface */
 
108
  /*@{*/
 
109
 
 
110
  /**
 
111
   * Parses and executes a string containing a single Ecasound 
 
112
   * Interactive Mode (EIAM) command and its arguments.
 
113
   *
 
114
   * Result of the command is stored to 'retval'.
 
115
   */
 
116
  virtual void command(const std::string& cmd_and_args, struct eci_return_value *retval) = 0;
 
117
 
 
118
  /**
 
119
   * A special version of 'command()' which parses a command taking 
 
120
   * a single double parameter.
 
121
   *
 
122
   * Result of the command is stored to 'retval'.
 
123
   */
 
124
  virtual void command_float_arg(const std::string& cmd, double arg, struct eci_return_value *retval) = 0;
 
125
 
 
126
  virtual void print_last_value(struct eci_return_value *retval) const = 0;
 
127
 
 
128
  /*@}*/
 
129
 
 
130
  // -------------------------------------------------------------------
 
131
 
 
132
  /** @name Static helper functions  */
 
133
  /*@{*/
 
134
 
 
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);
 
138
 
 
139
  /*@}*/
 
140
 
 
141
  // -------------------------------------------------------------------
 
142
 
 
143
};
 
144
 
 
145
#endif /*  INCLUDED_ECA_CONTROL_MAIN_H */