1 #ifndef INCLUDED_ECA_CONTROL_INTERFACE_H
2 #define INCLUDED_ECA_CONTROL_INTERFACE_H
3 
4 /** ------------------------------------------------------------------------
5  * ecasoundc.h: C++ implementation of the Ecasound Control Interface
6  * Copyright (C) 2000-2002 Kai Vehmanen
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2.1 of the License, or (at your option) any later version.
12  *
13  * This library 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 GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with this library; if not, write to the Free Software
20  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
21  * -------------------------------------------------------------------------
22  */
23 
24 #include <string>
25 #include <vector>
26 
27 #include <ecasoundc.h>
28 
29 /**
30  * C++ implementation of the Ecasound Control Interface
31  *
32  * @author Kai Vehmanen
33  */
34 class ECA_CONTROL_INTERFACE {
35 
36  public:
37 
38   // -------------------------------------------------------------------
39   // State
40   // -------------------------------------------------------------------
41 
42   bool ready(void);
43 
44   // -------------------------------------------------------------------
45   // Issuing EIAM commands
46   // -------------------------------------------------------------------
47 
48   void command(const std::string& cmd);
49   void command_float_arg(const std::string& cmd, double arg);
50 
51   // -------------------------------------------------------------------
52   // Getting return values
53   // -------------------------------------------------------------------
54 
55   const std::vector<std::string>& last_string_list(void) const;
56   const std::string& last_string(void) const;
57   double last_float(void) const;
58   int last_integer(void) const;
59   bool last_bool(void) const;
60   long int last_long_integer(void) const;
61   const std::string& last_error(void) const;
62   const std::string& last_type(void) const;
63   bool error(void) const;
64 
65   /**
66    * Returns last_integer() interpreted as a bool.
67    */
last_boolean(void)68   bool last_boolean(void) const { return(last_integer() != 0); }
69 
70   // -------------------------------------------------------------------
71   // Events
72   // -------------------------------------------------------------------
73 
74   bool events_available(void);
75   void next_event(void);
76   const std::string& current_event(void);
77 
78   // -------------------------------------------------------------------
79   // Constructors and destructors
80   // -------------------------------------------------------------------
81 
82   ECA_CONTROL_INTERFACE(void);
83   ~ECA_CONTROL_INTERFACE(void);
84 
85  private:
86 
87   eci_handle_t eci_repp;
88   mutable std::string str_rep;
89   mutable std::vector<std::string> strlist_rep;
90 };
91 
92 #endif
93