CLAM-Development
1.4.0
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
src
Processing
AudioIO
AudioIn.cxx
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2001-2004 MUSIC TECHNOLOGY GROUP (MTG)
3
* UNIVERSITAT POMPEU FABRA
4
*
5
*
6
* This program is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation; either version 2 of the License, or
9
* (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
22
#include "
AudioIn.hxx
"
23
#include "
AudioManager.hxx
"
24
#include "
ProcessingFactory.hxx
"
25
26
27
namespace
CLAM
28
{
29
30
namespace
Hidden
31
{
32
static
const
char
*
metadata
[] = {
33
"key"
,
"AudioIn"
,
34
// "category", "Audio I/O",
35
// "description", "AudioIn",
36
0
37
};
38
static
FactoryRegistrator<ProcessingFactory, AudioIn>
reg
=
metadata
;
39
}
40
41
42
bool
AudioIn::ConcreteConfigure
(
const
ProcessingConfig
& c)
43
{
44
CopyAsConcreteConfig
(mConfig, c);
45
46
if
(mpDevice)
47
mpDevice->
Unregister
(*
this
);
48
49
AudioManager
*m;
50
51
try
{
52
m = &(
AudioManager::Current
());
53
}
54
catch
(
Err
&e) {
55
ErrProcessingObj
ne(
"AudioIn::ConcreteConfigure(): No AudioManager found."
,
this
);
56
ne.
Embed
(e);
57
throw
(ne);
58
}
59
60
bool
res;
61
try
{
62
res = m->
Register
(*
this
);
63
}
64
catch
(
Err
&e) {
65
AddConfigErrorMessage
( e.
what
() );
66
res =
false
;
67
}
68
69
if
(res ==
false
)
70
AddConfigErrorMessage
(
"AudioIn::ConcreteConfigure(): Failed to register in AudioManager."
);
71
72
mOutput
.
SetSize
(mConfig.GetFrameSize());
73
74
return
res;
75
}
76
77
bool
AudioIn::ConcreteStart
(
void
)
78
{
79
if
(!mpDevice)
80
throw
(
Err
(
"AudioIn::ConcreteStart(): No Device found!"
));
81
mpDevice->
Start
();
82
return
true
;
83
}
84
85
void
AudioIn::GetDeviceInfo
(
AudioDevice::TInfo
&info)
const
86
{
87
if
(mpDevice)
88
mpDevice->
GetInfo
(info);
89
else
90
info.
Reset
();
91
}
92
93
bool
AudioIn::Do
()
94
{
95
bool
res =
Do
(
mOutput
.
GetAudio
());
96
mOutput
.
Produce
();
97
return
res;
98
}
99
100
}
101
Generated by
1.8.1