CLAM-Development
1.4.0
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
src
Processing
ArithOps
SpectrumAdder2.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
#ifndef _SPECTRUM_ADDER2_
23
#define _SPECTRUM_ADDER2_
24
25
#include "
Processing.hxx
"
26
#include "
DynamicType.hxx
"
27
#include "
InPort.hxx
"
28
#include "
OutPort.hxx
"
29
#include "
Spectrum.hxx
"
30
31
namespace
CLAM {
32
33
34
class
SpecAdder2Config
:
public
ProcessingConfig
35
{
36
public
:
37
DYNAMIC_TYPE_USING_INTERFACE
(
SpecAdder2Config
, 0,
ProcessingConfig
);
38
};
39
73
class
SpectrumAdder2
:
public
Processing
{
74
SpecAdder2Config
mConfig;
75
77
int
mSize;
78
79
InPort<Spectrum>
mIn1;
80
InPort<Spectrum>
mIn2;
81
OutPort<Spectrum>
mOut;
82
84
typedef
enum
{
85
// Type states in with the same attribute is used for all
86
// of the inputs and the outputs (it may or may not be
87
// present; in the second case it will be added at Do(...)
88
// time.
89
SMagPhase, SComplex, SPolar,
90
91
// BPF output sum
92
SBPF,
93
94
// Type states with only a BPF attribute in one of the
95
// inputs, other type in the other input and the
96
// output. The non-BPF attribute may or may not be
97
// instantiated. In the second case it will be added at
98
// Do(...) time.
99
100
SBPFMagPhase, SBPFComplex, SBPFPolar, SMagPhaseBPF,
101
SComplexBPF, SPolarBPF,
102
103
// State in which nothing is known about prototypes.
104
SOther
105
} PrototypeState;
106
108
typedef
enum
{ Slinlin, Sloglog, Slinlog, Sloglin} ScaleState;
109
111
PrototypeState mProtoState;
113
ScaleState mScaleState;
114
115
117
std::string NewUniqueName();
118
119
const
char
*GetClassName()
const
{
return
"SpectrumAdder2"
;}
120
121
125
bool
ConcreteConfigure(
const
ProcessingConfig
&);
126
127
public
:
128
SpectrumAdder2
();
129
130
SpectrumAdder2
(
const
SpecAdder2Config
&c);
131
132
~SpectrumAdder2
() {};
133
134
const
ProcessingConfig
&
GetConfig
()
const
{
return
mConfig;}
135
136
bool
Do
(
void
);
137
138
bool
Do
(
Spectrum
& in1,
Spectrum
& in2,
Spectrum
& out);
139
140
// Port interfaces.
141
148
bool
SetPrototypes
(
const
Spectrum
& in1,
const
Spectrum
& in2,
const
Spectrum
& out);
149
150
bool
SetPrototypes
();
151
152
bool
UnsetPrototypes
();
153
154
bool
MayDisableExecution
()
const
{
return
true
;}
155
156
private
:
157
161
inline
void
Add
(
Spectrum
& in1,
Spectrum
& in2,
Spectrum
& out);
162
163
// Adder methods for optimized configurations of the inputs/output
164
165
// Direct sums
166
inline
void
AddMagPhase(
Spectrum
& in1,
Spectrum
& in2,
Spectrum
& out);
167
inline
void
AddMagPhaseLin(
Spectrum
& in1,
Spectrum
& in2,
Spectrum
& out);
168
inline
void
AddMagPhaseLog(
Spectrum
& in1,
Spectrum
& in2,
Spectrum
& out);
169
inline
void
AddMagPhaseLinLog(
Spectrum
& in1,
Spectrum
& in2,
Spectrum
& out);
170
inline
void
AddComplex(
Spectrum
& in1,
Spectrum
& in2,
Spectrum
& out);
171
inline
void
AddComplexLin(
Spectrum
& in1,
Spectrum
& in2,
Spectrum
& out);
172
inline
void
AddComplexLog(
Spectrum
& in1,
Spectrum
& in2,
Spectrum
& out);
173
inline
void
AddComplexLinLog(
Spectrum
& in1,
Spectrum
& in2,
Spectrum
& out);
174
inline
void
AddPolar(
Spectrum
& in1,
Spectrum
& in2,
Spectrum
& out);
175
inline
void
AddPolarLin(
Spectrum
& in1,
Spectrum
& in2,
Spectrum
& out);
176
inline
void
AddPolarLog(
Spectrum
& in1,
Spectrum
& in2,
Spectrum
& out);
177
inline
void
AddPolarLinLog(
Spectrum
& in1,
Spectrum
& in2,
Spectrum
& out);
178
// BPF Adder
179
inline
void
AddBPF(
Spectrum
& in1,
Spectrum
& in2,
Spectrum
& out);
180
// Adding BPFs to non-BPFs.
181
inline
void
AddBPFLin(
Spectrum
& in1,
Spectrum
& in2,
Spectrum
& out);
182
inline
void
AddBPFLog(
Spectrum
& in1,
Spectrum
& in2,
Spectrum
& out);
183
inline
void
AddBPFLinLog(
Spectrum
& in1,
Spectrum
& in2,
Spectrum
& out);
184
inline
void
AddBPFMagPhase(
Spectrum
& in1,
Spectrum
& in2,
Spectrum
& out);
185
inline
void
AddMagPhaseBPF(
Spectrum
& in1,
Spectrum
& in2,
Spectrum
& out);
186
inline
void
AddBPFMagPhaseLin(
Spectrum
& in1,
Spectrum
& in2,
Spectrum
& out);
187
inline
void
AddBPFMagPhaseLog(
Spectrum
& in1,
Spectrum
& in2,
Spectrum
& out);
188
inline
void
AddBPFMagPhaseLinLog(
Spectrum
& in1,
Spectrum
& in2,
Spectrum
& out);
189
inline
void
AddBPFMagPhaseLogLin(
Spectrum
& in1,
Spectrum
& in2,
Spectrum
& out);
190
inline
void
AddBPFComplex(
Spectrum
& in1,
Spectrum
& in2,
Spectrum
& out);
191
inline
void
AddComplexBPF(
Spectrum
& in1,
Spectrum
& in2,
Spectrum
& out);
192
inline
void
AddBPFComplexLin(
Spectrum
& in1,
Spectrum
& in2,
Spectrum
& out);
193
inline
void
AddBPFComplexLog(
Spectrum
& in1,
Spectrum
& in2,
Spectrum
& out);
194
inline
void
AddBPFComplexLinLog(
Spectrum
& in1,
Spectrum
& in2,
Spectrum
& out);
195
inline
void
AddBPFComplexLogLin(
Spectrum
& in1,
Spectrum
& in2,
Spectrum
& out);
196
inline
void
AddBPFPolar(
Spectrum
& in1,
Spectrum
& in2,
Spectrum
& out);
197
inline
void
AddPolarBPF(
Spectrum
& in1,
Spectrum
& in2,
Spectrum
& out);
198
inline
void
AddBPFPolarLin(
Spectrum
& in1,
Spectrum
& in2,
Spectrum
& out);
199
inline
void
AddBPFPolarLog(
Spectrum
& in1,
Spectrum
& in2,
Spectrum
& out);
200
inline
void
AddBPFPolarLinLog(
Spectrum
& in1,
Spectrum
& in2,
Spectrum
& out);
201
inline
void
AddBPFPolarLogLin(
Spectrum
& in1,
Spectrum
& in2,
Spectrum
& out);
202
203
};
204
205
}
206
207
#endif // _SPECTRUM_ADDER_
208
Generated by
1.8.1