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

« back to all changes in this revision

Viewing changes to libecasound/audioio-typeselect.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Junichi Uekawa
  • Date: 2008-09-26 09:58:52 UTC
  • mfrom: (1.1.6 upstream)
  • Revision ID: james.westby@ubuntu.com-20080926095852-k3v9ewhmxpaltusw
Tags: 2.5.2-3
yodl 2.13.1 removed --unique-output option. Remove --unique-output
accordingly.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
// ------------------------------------------------------------------------
2
2
// audioio-typeselect.cpp: A proxy class for overriding default keyword
3
3
//                         and filename associations.
4
 
// Copyright (C) 2001,2002 Kai Vehmanen
 
4
// Copyright (C) 2001,2002,2008 Kai Vehmanen
 
5
//
 
6
// Attributes:
 
7
//     eca-style-version: 3
5
8
//
6
9
// This program is free software; you can redistribute it and/or modify
7
10
// it under the terms of the GNU General Public License as published by
26
29
/**
27
30
 * Constructor.
28
31
 */
29
 
AUDIO_IO_TYPESELECT::AUDIO_IO_TYPESELECT (void) { 
30
 
 
31
 
  //  ECA_LOG_MSG(ECA_LOGGER::user_objects, "(audioio-typeselect) constructor " + label() + ".");  
 
32
AUDIO_IO_TYPESELECT::AUDIO_IO_TYPESELECT (void)
 
33
{
 
34
  //  ECA_LOG_MSG(ECA_LOGGER::user_objects, "constructor " + label() + ".");  
32
35
  init_rep = false;
33
36
}
34
37
 
37
40
 */
38
41
AUDIO_IO_TYPESELECT::~AUDIO_IO_TYPESELECT (void)
39
42
{
40
 
  //  ECA_LOG_MSG(ECA_LOGGER::user_objects, "(audioio-typeselect) destructor " + label() + ".");  
 
43
  //  ECA_LOG_MSG(ECA_LOGGER::user_objects, "destructor " + label() + ".");  
41
44
}
42
45
 
43
46
AUDIO_IO_TYPESELECT* AUDIO_IO_TYPESELECT::clone(void) const
46
49
  for(int n = 0; n < number_of_params(); n++) {
47
50
    target->set_parameter(n + 1, get_parameter(n + 1));
48
51
  }
49
 
  return(target);
 
52
  return target;
50
53
}
51
54
 
52
55
void AUDIO_IO_TYPESELECT::open(void) throw(AUDIO_IO::SETUP_ERROR&)
53
56
{
54
 
  ECA_LOG_MSG(ECA_LOGGER::user_objects, "(audioio-typeselect) open " + label() + ".");  
 
57
  ECA_LOG_MSG(ECA_LOGGER::user_objects, "open " + label() + ".");  
55
58
 
56
59
  if (init_rep != true) {
57
 
    AUDIO_IO* tmp = 0;
58
 
    if (params_rep.size() > 1) {
59
 
      string& type = params_rep[1];
60
 
      if (type.size() > 0) {
61
 
        //  cerr << "typeselect: " << type << endl;
62
 
        tmp = ECA_OBJECT_FACTORY::create_audio_object(type);
63
 
      }
64
 
    }
 
60
    AUDIO_IO* tmp = 
 
61
      ECA_OBJECT_FACTORY::create_audio_object(child_params_as_string(2, &params_rep));
65
62
 
66
63
    if (tmp != 0) {
67
64
      set_child(tmp);
70
67
    int numparams = child()->number_of_params();
71
68
    for(int n = 0; n < numparams; n++) {
72
69
      child()->set_parameter(n + 1, get_parameter(n + 3));
73
 
      numparams = child()->number_of_params(); // in case 'n_o_p()' varies
 
70
      if (child()->variable_params())
 
71
        numparams = child()->number_of_params(); 
74
72
    }
75
73
 
76
74
    init_rep = true; /* must be set after dyn. parameters */
101
99
 
102
100
string AUDIO_IO_TYPESELECT::parameter_names(void) const
103
101
104
 
  return(string("typeselect,format,") + child()->parameter_names()); 
 
102
  return string("typeselect,format,") + child()->parameter_names(); 
105
103
}
106
104
 
107
105
void AUDIO_IO_TYPESELECT::set_parameter(int param, string value)
108
106
109
107
  ECA_LOG_MSG(ECA_LOGGER::user_objects, 
110
 
                "(audioio-typeselect) set_parameter "
 
108
                "set_parameter "
111
109
                + label() + ".");  
112
110
 
113
111
  if (param > static_cast<int>(params_rep.size())) params_rep.resize(param);
125
123
string AUDIO_IO_TYPESELECT::get_parameter(int param) const
126
124
{
127
125
  ECA_LOG_MSG(ECA_LOGGER::user_objects, 
128
 
                "(audioio-typeselect) get_parameter "
 
126
                "get_parameter "
129
127
                + label() + ".");  
130
128
 
131
129
  if (param > 0 && param < static_cast<int>(params_rep.size()) + 1) {
133
131
        init_rep == true) {
134
132
      params_rep[param - 1] = child()->get_parameter(param - 2);
135
133
    }
136
 
    return(params_rep[param - 1]);
 
134
    return params_rep[param - 1];
137
135
  }
138
136
 
139
 
  return(""); 
 
137
  return "";
140
138
}