CLAM-Development
1.4.0
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
src
Processing
Analysis
WindowGenerator.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 _WINDOW_GENERATOR_
23
#define _WINDOW_GENERATOR_
24
25
#include <typeinfo>
// std::bad_cast
26
#include "
DataTypes.hxx
"
27
#include "
GlobalEnums.hxx
"
28
#include "
Processing.hxx
"
29
#include "
InControl.hxx
"
30
#include "
Processing.hxx
"
31
#include "
WindowGeneratorConfig.hxx
"
32
#include "
Array.hxx
"
33
#include "
AudioOutPort.hxx
"
34
35
namespace
CLAM {
36
37
class
Audio;
38
class
Spectrum;
39
class
Storage;
40
class
ProcessingConfig;
41
80
class
WindowGenerator
:
public
Processing
{
81
public
:
82
typedef
WindowGeneratorConfig
Config
;
83
private
:
84
Config
mConfig;
85
86
const
char
*GetClassName()
const
{
return
"WindowGenerator"
;}
87
91
bool
ConcreteConfigure(
const
ProcessingConfig
& c);
92
93
public
:
94
WindowGenerator
(
const
WindowGeneratorConfig
&c=
Config
());
95
96
~WindowGenerator
();
97
98
const
ProcessingConfig
&
GetConfig
()
const
{
return
mConfig;}
99
100
bool
Do
(
void
);
101
102
bool
Do
(
DataArray
& output);
103
bool
Do
(
Spectrum
& output);
104
bool
Do
(
Audio
& output);
105
106
bool
MayDisableExecution
()
const
{
return
true
;}
107
108
void
SetSize
(
TSize
size)
109
{
110
CLAM_DEBUG_ASSERT
(size%2==1,
"Window size must be odd"
);
111
mSize.
DoControl
((
TControlData
)size);
112
}
113
114
protected
:
115
AudioOutPort
mOutput
;
116
117
private
:
118
FloatInControl
mSize;
119
DataArray
mTable;
120
121
void
CreateTable(
DataArray
& table,
EWindowType
windowType,
long
windowsize)
const
;
122
void
CreateWindowFromTable(
DataArray
&window)
const
;
123
double
BesselFunction(
double
x)
const
;
124
void
KaiserBessel(
long
size,
DataArray
& window,
125
double
alpha)
const
;
126
void
BlackmanHarrisX(
long
size,
DataArray
& window,
127
double
a0,
double
a1,
double
a2,
double
a3 = 0.)
const
;
128
void
BlackmanHarris62(
long
size,
DataArray
& window)
const
;
129
void
BlackmanHarris70(
long
size,
DataArray
& window)
const
;
130
void
BlackmanHarris74(
long
size,
DataArray
& window)
const
;
131
void
BlackmanHarris92(
long
size,
DataArray
& window)
const
;
132
void
BlackmanHarrisLike(
long
size,
DataArray
& window)
const
;
133
void
Hamming(
long
size,
DataArray
& window)
const
;
134
void
Triangular(
long
size,
DataArray
& window)
const
;
135
void
BlackmanHarris92TransMainLobe(
long
size,
DataArray
& window)
const
;
136
void
Gaussian(
long
size,
DataArray
& window)
const
;
137
void
Sine(
long
size,
DataArray
& window)
const
;
138
void
Square
(
long
size,
DataArray
& window)
const
;
139
140
void
InvertWindow(
const
DataArray
& originalWindow,
141
DataArray
& invertedWindow)
const
;
142
void
InvertWindow(
DataArray
& window)
const
;
143
void
NormalizeWindow(
DataArray
& window)
const
;
144
double
Sinc(
double
x,
short
N)
const
;
145
146
};
147
148
};
//namespace CLAM
149
150
#endif //_WINDOW_GENERATOR_
151
Generated by
1.8.1