CLAM-Development
1.4.0
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
src
Processing
Analysis
FFT_base.hxx
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
23
#ifndef _FFT_base_
24
#define _FFT_base_
25
26
#include <typeinfo>
// for bad_cast definition
27
#include "
Processing.hxx
"
28
#include "
AudioInPort.hxx
"
29
#include "
OutPort.hxx
"
30
#include <string>
31
#include "
FFTConfig.hxx
"
32
#include "
SpecTypeFlags.hxx
"
33
#include "
Spectrum.hxx
"
34
35
namespace
CLAM {
36
37
class
Storage;
38
class
ProcessingConfig;
39
class
Audio;
40
class
Spectrum;
41
43
class
FFT_base
:
public
Processing
44
{
45
protected
:
46
48
static
SpecTypeFlags
mComplexflags
;
49
51
Spectrum
mComplexSpectrum
;
52
54
FFTConfig
mConfig
;
56
int
mSize
;
57
58
/* FFT possible execution states.
59
*/
60
typedef
enum
{
61
sComplex
,
// We just need to write the complex array.
62
sComplexSync
,
// We write the complex array and synchronize.
63
sOther
// The complex array is not present.
64
}
FFTState
;
65
67
FFTState
mState
;
68
75
FFTState
mBackupState
;
76
77
AudioInPort
mInput
;
78
OutPort<Spectrum>
mOutput
;
79
81
TData
*
fftbuffer
;
82
83
// Control change callback function
84
void
ChangeSize
(
int
n);
85
int
GetSize
() {
return
mSize
;}
86
87
virtual
bool
ConcreteConfigure
(
const
ProcessingConfig
&) = 0;
88
89
public
:
90
91
FFT_base
();
92
virtual
~FFT_base
();
93
96
const
ProcessingConfig
&
GetConfig
()
const
{
return
mConfig
;}
97
100
virtual
bool
Do
(
void
) = 0;
101
107
virtual
bool
Do
(
const
Audio
& in,
Spectrum
&out)= 0;
108
109
// Input/Output configuration methods
110
112
bool
SetPrototypes
(
const
Audio
& in,
const
Spectrum
&out);
113
115
bool
SetPrototypes
() {
return
false
;}
116
118
bool
UnsetPrototypes
();
119
120
void
CheckTypes
(
const
Audio
& in,
const
Spectrum
&out)
const
;
121
122
123
// Enable/Disable methods. Maybe we should not be deriving
124
// these ones in FFT subclasses. (FFT implementations will
125
// probably be always memoryless.
126
127
virtual
bool
MayDisableExecution
()
const
{
return
false
;}
128
129
virtual
bool
DisableExecution
() {
return
false
;}
130
131
virtual
bool
EnableExecution
() {
return
false
;}
132
133
// Output conversions
134
135
virtual
void
ToComplex
(
Spectrum
&out) = 0;
136
137
virtual
void
ToOther
(
Spectrum
&out);
138
139
};
140
141
142
};
//namespace CLAM
143
144
145
#endif // _FFT_base_
146
Generated by
1.8.1