~ubuntu-branches/ubuntu/wily/ecasound/wily-proposed

« back to all changes in this revision

Viewing changes to libecasound/plugins/audioio_alsa_named.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Alessandro Ghedini
  • Date: 2011-05-12 17:58:03 UTC
  • Revision ID: james.westby@ubuntu.com-20110512175803-zy3lodjecabt9r3v
Tags: upstream-2.8.0
ImportĀ upstreamĀ versionĀ 2.8.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// ------------------------------------------------------------------------
 
2
// audioio_alsa_named.cpp: ALSA 0.9.x named PCM-device input/output.
 
3
// Copyright (C) 2001-2002 Kai Vehmanen
 
4
// This program is free software; you can redistribute it and/or modify
 
5
// it under the terms of the GNU General Public License as published by
 
6
// the Free Software Foundation; either version 2 of the License, or
 
7
// (at your option) any later version.
 
8
// 
 
9
// This program is distributed in the hope that it will be useful,
 
10
// but WITHOUT ANY WARRANTY; without even the implied warranty of
 
11
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
12
// GNU General Public License for more details.
 
13
// 
 
14
// You should have received a copy of the GNU General Public License
 
15
// along with this program; if not, write to the Free Software
 
16
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
 
17
// ------------------------------------------------------------------------
 
18
 
 
19
#include <string>
 
20
#include <unistd.h>
 
21
 
 
22
#include <kvu_message_item.h>
 
23
#include <kvu_numtostr.h>
 
24
 
 
25
#include <alsa/asoundlib.h>
 
26
 
 
27
#include "audioio_alsa_named.h"
 
28
#include "eca-error.h"
 
29
#include "eca-logger.h"
 
30
#include "eca-version.h"
 
31
 
 
32
#ifdef ECA_ENABLE_AUDIOIO_PLUGINS
 
33
static const char* audio_io_keyword_const = "alsa_09";
 
34
static const char* audio_io_keyword_regex_const = "^alsa_09$";
 
35
 
 
36
const char* audio_io_keyword(void){return(audio_io_keyword_const); }
 
37
const char* audio_io_keyword_regex(void){return(audio_io_keyword_regex_const); }
 
38
AUDIO_IO* audio_io_descriptor(void) { return(new AUDIO_IO_ALSA_PCM_NAMED()); }
 
39
int audio_io_interface_version(void) { return(ecasound_library_version_current); }
 
40
#endif
 
41
 
 
42
AUDIO_IO_ALSA_PCM_NAMED::AUDIO_IO_ALSA_PCM_NAMED (void)
 
43
{
 
44
  set_pcm_device_name("");
 
45
}
 
46
 
 
47
AUDIO_IO_ALSA_PCM_NAMED::~AUDIO_IO_ALSA_PCM_NAMED(void)
 
48
{
 
49
}
 
50
 
 
51
AUDIO_IO_ALSA_PCM_NAMED* AUDIO_IO_ALSA_PCM_NAMED::clone(void) const
 
52
{
 
53
  AUDIO_IO_ALSA_PCM_NAMED* target = new AUDIO_IO_ALSA_PCM_NAMED();
 
54
  for(int n = 0; n < number_of_params(); n++) {
 
55
    target->set_parameter(n + 1, get_parameter(n + 1));
 
56
  }
 
57
  return(target);
 
58
}
 
59
 
 
60
void AUDIO_IO_ALSA_PCM_NAMED::set_parameter(int param, 
 
61
                                            string value)
 
62
{
 
63
  switch (param) {
 
64
  case 1: 
 
65
    set_label(value);
 
66
    break;
 
67
 
 
68
  case 2: 
 
69
    set_pcm_device_name(value);
 
70
    break;
 
71
  }
 
72
}
 
73
 
 
74
string AUDIO_IO_ALSA_PCM_NAMED::get_parameter(int param) const
 
75
{
 
76
  switch (param) {
 
77
  case 1: 
 
78
    return(label());
 
79
 
 
80
  case 2: 
 
81
    return(pcm_device_name());
 
82
  }
 
83
  return("");
 
84
}