/usr/include/CLAM/WindowGenerator.hxx is in libclam-dev 1.4.0-6.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 | /*
* Copyright (c) 2001-2004 MUSIC TECHNOLOGY GROUP (MTG)
* UNIVERSITAT POMPEU FABRA
*
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#ifndef _WINDOW_GENERATOR_
#define _WINDOW_GENERATOR_
#include <typeinfo> // std::bad_cast
#include "DataTypes.hxx"
#include "GlobalEnums.hxx"
#include "Processing.hxx"
#include "InControl.hxx"
#include "Processing.hxx"
#include "WindowGeneratorConfig.hxx"
#include "Array.hxx"
#include "AudioOutPort.hxx"
namespace CLAM {
class Audio;
class Spectrum;
class Storage;
class ProcessingConfig;
/**
* This class can be used for generating Windows and for zeropadding the
* windowed data. The Do functions accept different types of data, which
* are simple Arrays, Audio and Spectrum.
* <p>
* If the window is smaller as the Data Array then the rest of the Array
* is filled with Zeroes.
* <p>
* The Size of the window can be changed via a control, the Type
* (Hamming,Kaiser, etc) is fixed.
* A configuration option is to generate the window everytime the
* Do() function is called. This is settable via the UseTable element
* of the configuration.
*
* Note: The last and the first element of the window always have the
* same value, therefore, if you want to use it for windowing an FFT,
* you have to create a window of size FFTSize+1. (if you care for correctness)
*/
/**
* This class can be used for generating Windows and for zeropadding the
* windowed data. The Do functions accept different types of data, which
* are simple Arrays, Audio and Spectrum.
* <p>
* If the window is smaller as the Data Array then the rest of the Array
* is filled with Zeroes.
* <p>
* The Size of the window can be changed via a control, the Type
* (Hamming,Kaiser, etc) is fixed.
* A configuration option is to generate the window everytime the
* Do() function is called. This is settable via the UseTable element
* of the configuration.
*
* Note: The last and the first element of the window always have the
* same value, therefore, if you want to use it for windowing an FFT,
* you have to create a window of size FFTSize+1. (if you care for correctness)
*/
class WindowGenerator: public Processing {
public:
typedef WindowGeneratorConfig Config;
private:
Config mConfig;
const char *GetClassName() const {return "WindowGenerator";}
/** Config change method
* @pre the argument should be an WindowGeneratorConfig object.
*/
bool ConcreteConfigure(const ProcessingConfig& c);
public:
WindowGenerator(const WindowGeneratorConfig &c=Config());
~WindowGenerator();
const ProcessingConfig &GetConfig() const { return mConfig;}
bool Do(void);
bool Do(DataArray& output);
bool Do(Spectrum& output);
bool Do(Audio& output);
bool MayDisableExecution() const {return true;}
void SetSize(TSize size)
{
CLAM_DEBUG_ASSERT(size%2==1,"Window size must be odd");
mSize.DoControl((TControlData)size);
}
protected:
AudioOutPort mOutput;
private:
FloatInControl mSize;
DataArray mTable;
void CreateTable(DataArray& table,EWindowType windowType,long windowsize) const;
void CreateWindowFromTable(DataArray &window) const;
double BesselFunction(double x) const;
void KaiserBessel(long size,DataArray& window,
double alpha) const;
void BlackmanHarrisX(long size,DataArray& window,
double a0,double a1,double a2,double a3 = 0.) const;
void BlackmanHarris62(long size,DataArray& window) const;
void BlackmanHarris70(long size,DataArray& window) const;
void BlackmanHarris74(long size,DataArray& window) const;
void BlackmanHarris92(long size,DataArray& window) const;
void BlackmanHarrisLike(long size,DataArray& window) const;
void Hamming(long size,DataArray& window) const;
void Triangular(long size,DataArray& window) const;
void BlackmanHarris92TransMainLobe(long size,DataArray& window) const;
void Gaussian(long size,DataArray& window) const;
void Sine(long size,DataArray& window) const;
void Square(long size,DataArray& window) const;
void InvertWindow(const DataArray& originalWindow,
DataArray& invertedWindow) const;
void InvertWindow(DataArray& window) const;
void NormalizeWindow(DataArray& window) const;
double Sinc(double x, short N) const;
};
};//namespace CLAM
#endif //_WINDOW_GENERATOR_
|