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

« back to all changes in this revision

Viewing changes to libecasoundc/eca-control-interface.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Junichi Uekawa
  • Date: 2005-04-14 09:15:48 UTC
  • Revision ID: james.westby@ubuntu.com-20050414091548-o7kgb47z0tcunh0s
Tags: upstream-2.4.1
ImportĀ upstreamĀ versionĀ 2.4.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// ------------------------------------------------------------------------
 
2
// eca-control-interface.cpp: C++ implementation of the Ecasound
 
3
//                            Control Interface
 
4
// Copyright (C) 2000,2002 Kai Vehmanen
 
5
//
 
6
// This library is free software; you can redistribute it and/or
 
7
// modify it under the terms of the GNU Lesser General Public
 
8
// License as published by the Free Software Foundation; either
 
9
// version 2.1 of the License, or (at your option) any later version.
 
10
// 
 
11
// This program is distributed in the hope that it will be useful,
 
12
// but WITHOUT ANY WARRANTY; without even the implied warranty of
 
13
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
14
// GNU General Public License for more details.
 
15
// 
 
16
// You should have received a copy of the GNU General Public License
 
17
// along with this program; if not, write to the Free Software
 
18
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
 
19
// ------------------------------------------------------------------------
 
20
 
 
21
#include <iostream>
 
22
#include <cassert>
 
23
 
 
24
#include <ecasoundc.h>
 
25
 
 
26
#include "eca-control-interface.h"
 
27
 
 
28
using std::string;
 
29
using std::vector;
 
30
 
 
31
/**
 
32
 * Class constructor.
 
33
 */
 
34
ECA_CONTROL_INTERFACE::ECA_CONTROL_INTERFACE (void)
 
35
 
36
  eci_repp = eci_init_r();
 
37
}
 
38
 
 
39
/**
 
40
 * Desctructor.
 
41
 */
 
42
ECA_CONTROL_INTERFACE::~ECA_CONTROL_INTERFACE (void)
 
43
{
 
44
  eci_cleanup_r(eci_repp);
 
45
}
 
46
 
 
47
/**
 
48
 * Parse string mode command and act accordingly.
 
49
 */
 
50
void ECA_CONTROL_INTERFACE::command(const string& cmd)
 
51
{
 
52
  eci_command_r(eci_repp, cmd.c_str());
 
53
}
 
54
 
 
55
void ECA_CONTROL_INTERFACE::command_float_arg(const string& cmd, double arg)
 
56
{
 
57
  eci_command_float_arg_r(eci_repp, cmd.c_str(), arg);
 
58
}
 
59
 
 
60
const vector<string>& ECA_CONTROL_INTERFACE::last_string_list(void) const
 
61
{
 
62
  strlist_rep.clear();
 
63
  int count = eci_last_string_list_count_r(eci_repp);
 
64
  for(int n = 0; n < count; n++) {
 
65
    const char* next = eci_last_string_list_item_r(eci_repp, n);
 
66
    assert(next != NULL);
 
67
    strlist_rep.push_back(string(next));
 
68
  }
 
69
  
 
70
  return(strlist_rep);
 
71
}
 
72
 
 
73
const string& ECA_CONTROL_INTERFACE::last_string(void) const
 
74
{
 
75
  str_rep = string(eci_last_string_r(eci_repp));
 
76
  return(str_rep);
 
77
}
 
78
 
 
79
double ECA_CONTROL_INTERFACE::last_float(void) const
 
80
{
 
81
  return(eci_last_float_r(eci_repp));
 
82
}
 
83
 
 
84
int ECA_CONTROL_INTERFACE::last_integer(void) const
 
85
{
 
86
  return(eci_last_integer_r(eci_repp));
 
87
}
 
88
 
 
89
long int ECA_CONTROL_INTERFACE::last_long_integer(void) const
 
90
{
 
91
  return(eci_last_long_integer_r(eci_repp));
 
92
}
 
93
 
 
94
const string& ECA_CONTROL_INTERFACE::last_error(void) const
 
95
{
 
96
  str_rep = string(eci_last_error_r(eci_repp));
 
97
  return(str_rep); 
 
98
}
 
99
 
 
100
const string& ECA_CONTROL_INTERFACE::last_type(void) const
 
101
{
 
102
  str_rep = string(eci_last_type_r(eci_repp));
 
103
  return(str_rep); 
 
104
}
 
105
 
 
106
bool ECA_CONTROL_INTERFACE::error(void) const
 
107
{
 
108
  return((eci_error_r(eci_repp) != 0) ? true : false);
 
109
}
 
110
 
 
111
bool ECA_CONTROL_INTERFACE::events_available(void)
 
112
{
 
113
  return(false);
 
114
}
 
115
 
 
116
void ECA_CONTROL_INTERFACE::next_event(void)
 
117
{
 
118
}
 
119
 
 
120
const string& ECA_CONTROL_INTERFACE::current_event(void)
 
121
{
 
122
  str_rep = "";
 
123
  return(str_rep);
 
124
}