Gamma  0.9.5
Generic Synthesis Library
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator
DFT Class Reference

Discrete Fourier transform. More...

#include <DFT.h>

Inheritance diagram for DFT:
DFTBase< float > Synced Node2< Synced > STFT

List of all members.

Public Member Functions

 DFT (uint32_t winSize=1024, uint32_t padSize=0, SpectralType specType=COMPLEX, uint32_t numAux=0)
 Constructor.
DFTspectrumType (SpectralType v)
 Set format of spectrum data.
DFTprecise (bool whether)
 Set whether to use precise (but slower) for converting to polar.
void resize (uint32_t windowSize, uint32_t padSize)
 Set size parameters of transform.
float freqRes () const
 Get frequency resolution of analysis.
float overlap () const
 Get transform overlap factor.
bool overlapping () const
 Whether the transform is overlapping.
uint32_t sizeHop () const
 Get size of hop.
uint32_t sizePad () const
 Get size of zero-padding.
uint32_t sizeWin () const
 Get size of window.
SyncsyncHop ()
 Hop rate synchronizer.
bool operator() (float input)
 Reads next sample in for a forward transform.
float operator() ()
 Returns next sample from inverse transform.
void forward (const float *src)
 Performs forward transform on a window of samples.
virtual void inverse (float *dst)
 Performs inverse transform on internal spectrum.
bool inverseOnNext ()
 Returns true if next call to inverse() will perform the inverse transform.
void zero ()
 Zeroes internal frequency bins.
void zeroEnds ()
 Zeroes DC and Nyquist bins.
virtual void onResync (double r)
 Called by my Sync reference after it changes its value.
float * aux (uint32_t num)
 Get pointer to an auxiliary buffer.
Complex< float > * bins () const
 Get pointer to bin data.
Complex< float > & bin (uint32_t k)
 Get reference to bin value.
const Complex< float > & bin (uint32_t k) const
 Get read-only reference to bin value.
double binFreq () const
 Get width of frequency bins.
uint32_t numBins () const
 Get number of frequency bins.
uint32_t sizeDFT () const
 Get size of forward transform.
SyncsyncFreq ()
 Get frequency domain synchronizer.
void numAux (uint32_t num)
 Sets number of auxilliary buffers, each of size numBins()
double scaleSPU () const
 Returns ratio of my SPU to my Sync's SPU.
void scaleSPU (double v)
 Scales samples/unit by factor.
double spu () const
 Returns local samples/unit.
void spu (double v)
 Set local samples/unit.
double ups () const
 Returns local units/sample.
void ups (double v)
 Set local units/sample.
const Syncsync () const
 Returns reference to my Sync.
void sync (Sync &src)
 Set absolute Sync source.
void scaleUPS (double v)
 Scales units/sample by factor.
void nodeInsertL (Synced &node)
 Insert myself to left of node.
void nodeInsertR (Synced &node)
 Insert myself to right of node.
void nodeRemove ()
 Remove myself from linked list.

Public Attributes

SyncednodeL
 Pointer to left node.
SyncednodeR
 Pointer to right node.

Protected Member Functions

void initSynced ()
 To be called from the constructor(s) of derived classes.

Detailed Description

Discrete Fourier transform.


Constructor & Destructor Documentation

DFT ( uint32_t  winSize = 1024,
uint32_t  padSize = 0,
SpectralType  specType = COMPLEX,
uint32_t  numAux = 0 
)

Constructor.

Parameters:
[in]winSizeNumber of samples in window
[in]padSizeNumber of zeros to append to window
[in]specTypeFormat of spectrum data
[in]numAuxNumber of auxilliary buffers of size numBins() to create

Member Function Documentation

void forward ( const float *  src)

Performs forward transform on a window of samples.

'src' must have at least sizeWin() number of elements.

Reimplemented in STFT.

void inverse ( float *  dst) [virtual]

Performs inverse transform on internal spectrum.

The resynthesized samples are copied into 'dst'. The destination array must have room for at least sizeDFT() number of elements. If 'dst' equals 0, then the resynthesized samples are not copied, but instead held in the internal transform buffer.

Reimplemented in STFT.

bool inverseOnNext ( )

Returns true if next call to inverse() will perform the inverse transform.

This method is used for doing inverse-only transforms. Basically, it tells you when you should set the frequency samples.

void onResync ( double  ratioSPU) [virtual]

Called by my Sync reference after it changes its value.

Any instance state that depends on the sampling length should be updated here.

Reimplemented from DFTBase< float >.

bool operator() ( float  input)

Reads next sample in for a forward transform.

Returns true when sizeDFT() samples are read in and, subsequently, the forward DFT is performed. Returns false otherwise.

Reimplemented in STFT.

float operator() ( )

Returns next sample from inverse transform.

The inverse transform is performed every sizeWin() samples.


The documentation for this class was generated from the following files: