HARDT - The Ham Radio DSP Toolkit
Public Member Functions | List of all members
HFftOutput< T > Class Template Reference

#include <hfftoutput.h>

Inheritance diagram for HFftOutput< T >:
Inheritance graph
[legend]
Collaboration diagram for HFftOutput< T >:
Collaboration graph
[legend]

Public Member Functions

 HFftOutput (int size, int average, int skip, HWriter< HFftResults > *writer, HWindow< T > *window, H_SAMPLE_RATE zoomRate=0, int zoomFactor=1, int zoomCenter=0)
 
 HFftOutput (int size, int average, int skip, HWriterConsumer< T > *consumer, HWindow< T > *window, H_SAMPLE_RATE zoomRate=0, int zoomFactor=1, int zoomCenter=0)
 
 HFftOutput (int size, int average, int skip, HWriter< HFftResults > *writer, HWindow< T > *window, bool isIq)
 
 HFftOutput (int size, int average, int skip, HWriterConsumer< T > *consumer, HWindow< T > *window, bool isIq)
 
 ~HFftOutput ()
 
int Output (T *src, size_t size)
 
bool Command (HCommand *command)
 
int Width ()
 
int Left ()
 
int Right ()
 
int Center ()
 
float BinSize ()
 
float BinSize (H_SAMPLE_RATE rate)
 
H_SAMPLE_RATE Rate ()
 
void SetZoom (int zoomFactor, int zoomCenter)
 
bool Start ()
 
bool Stop ()
 
- Public Member Functions inherited from HOutput< T, HFftResults >
void Ready (HFftResults *buffer, size_t blocksize)
 
void Ready (HFftResults value)
 
void Ready ()
 
bool Start ()
 
bool Stop ()
 
 HOutput ()
 
 HOutput (HWriterConsumer< T > *consumer)
 
 HOutput (std::function< void(HFftResults *, size_t)> ready)
 
 HOutput (std::function< void(HFftResults *, size_t)> ready, HWriterConsumer< T > *consumer)
 
 HOutput (std::function< void(HFftResults)> ready)
 
 HOutput (std::function< void(HFftResults)> ready, HWriterConsumer< T > *consumer)
 
 HOutput (std::function< void()> ready)
 
 HOutput (std::function< void()> ready, HWriterConsumer< T > *consumer)
 
 HOutput (HWriter< HFftResults > *writer)
 
 HOutput (HWriter< HFftResults > *writer, HWriterConsumer< T > *consumer)
 
 HOutput (int chunksize)
 
 HOutput (int chunksize, HWriterConsumer< T > *consumer)
 
 HOutput (std::function< void(HFftResults *, size_t)> ready, int chunksize)
 
 HOutput (std::function< void(HFftResults *, size_t)> ready, int chunksize, HWriterConsumer< T > *consumer)
 
 HOutput (std::function< void(HFftResults)> ready, int chunksize)
 
 HOutput (std::function< void(HFftResults)> ready, int chunksize, HWriterConsumer< T > *consumer)
 
 HOutput (std::function< void()> ready, int chunksize)
 
 HOutput (std::function< void()> ready, int chunksize, HWriterConsumer< T > *consumer)
 
 HOutput (HWriter< HFftResults > *writer, int chunksize)
 
 HOutput (HWriter< HFftResults > *writer, int chunksize, HWriterConsumer< T > *consumer)
 
int WriteChunk (T *src, size_t blocksize)
 
void SetWriter (HWriter< HFftResults > *writer)
 
- Public Member Functions inherited from HChunkWriter< T >
int Write (T *src, size_t blocksize)
 
 HChunkWriter ()
 
 HChunkWriter (int chunksize)
 
int GetChunksize ()
 
- Public Member Functions inherited from HWriter< T >
virtual ~HWriter ()=default
 
HWriter< T > * Writer ()
 
- Public Member Functions inherited from HObject
 HObject ()
 
- Public Member Functions inherited from HWriterConsumer< HFftResults >
HWriterConsumer< HFftResults > * Consumer ()
 

Detailed Description

template<class T>
class HFftOutput< T >

Calculate a number of dfft's, if applicable then average the spectrum over the number of dfft's, then write the calculated spectrum results to the given writer (usually a HCustomWRiter)

Constructor & Destructor Documentation

◆ HFftOutput() [1/4]

template<class T >
HFftOutput< T >::HFftOutput ( int  size,
int  average,
int  skip,
HWriter< HFftResults > *  writer,
HWindow< T > *  window,
H_SAMPLE_RATE  zoomRate = 0,
int  zoomFactor = 1,
int  zoomCenter = 0 
)

Create a new HFft output that writes to a writer

Parameters
sizeThe FFT size (1024 is a good choice for analytic use, 256 is recommended for realtime applications)
averageThe number of FFT's to accumulate and average before calling the result writer. Note that if you use anything but 1, you can not run your signal through the output multiple times since that would mix results in the averaging phase (say if you where zooming in)
skipTake each 'skip' sample and skip the rest
writerThe result writer (most likely a HCustomerWriter<HFftResults>*)
windowThe window to use before calculating the FFT
zoomRateThe samplerate of the input samples
zoomFactorZoom factor. If larger than 1, then the spectrum is zoomed around 'center' (in relation to 'size'). The factor must divide up into 'size' with an integer result (1024/4 = ok, 1024/3 = not-ok!).
zoomCenterThe center bin (frequency), must be in the [0-size/2] range. Use the static HFftOutput::BinAtFrequency() method if you do not already know the bin number.

If you intend to use scaling, you must initialize the HFftOutput with a samplerate. You can set the factor to 1 initially to disable zooming. But if you have not provided zoomRate != 0, zooming will not be setup and be available.!

◆ HFftOutput() [2/4]

template<class T >
HFftOutput< T >::HFftOutput ( int  size,
int  average,
int  skip,
HWriterConsumer< T > *  consumer,
HWindow< T > *  window,
H_SAMPLE_RATE  zoomRate = 0,
int  zoomFactor = 1,
int  zoomCenter = 0 
)

Create a new HFft output that registers with an upstream writer

Parameters
sizeThe FFT size (1024 is a good choice for analytic use, 256 is recommended for realtime applications)
averageThe number of FFT's to accumulate and average before calling the result writer. Note that if you use anything but 1, you can not run your signal through the output multiple times since that would mix results in the averaging phase (say if you where zooming in)
skipTake each 'skip' sample and skip the rest
consumerThe upstream writer that should write to this component
windowThe window to use before calculating the FFT
zoomRateThe samplerate of the input samples
zoomFactorZoom factor. If larger than 1, then the spectrum is zoomed around 'center' (in relation to 'size'). The factor must divide up into 'size' with an integer result (1024/4 = ok, 1024/3 = not-ok!).
zoomCenterThe center bin (frequency), must be in the [0-size/2] range. Use the static HFftOutput::BinAtFrequency() method if you do not already know the bin number.

If you intend to use scaling, you must initialize the HFftOutput with a samplerate. You can set the factor to 1 initially to disable zooming. But if you have not provided zoomRate != 0, zooming will not be setup and be available.!

◆ HFftOutput() [3/4]

template<class T >
HFftOutput< T >::HFftOutput ( int  size,
int  average,
int  skip,
HWriter< HFftResults > *  writer,
HWindow< T > *  window,
bool  isIq 
)

Create a new HFft output that writes to a writer

Parameters
sizeThe FFT size (1024 is a good choice for analytic use, 256 is recommended for realtime applications)
averageThe number of FFT's to accumulate and average before calling the result writer.
skipTake each 'skip' sample and skip the rest
writerThe result writer (most likely a HCustomerWriter<HFftResults>*)
windowThe window to use before calculating the FFT
isIqIf set to true then the input must be IQ data and the returned spectrum then contains negative as well as positive frequencies. If you intend to use scaling, you must initialize the HFftOutput with a samplerate. You can set the factor to 1 initially to disable zooming. But if you have not provided zoomRate != 0, zooming will not be setup and be available.!

◆ HFftOutput() [4/4]

template<class T >
HFftOutput< T >::HFftOutput ( int  size,
int  average,
int  skip,
HWriterConsumer< T > *  consumer,
HWindow< T > *  window,
bool  isIq 
)

Create a new HFft output that writes to a writer

Parameters
sizeThe FFT size (1024 is a good choice for analytic use, 256 is recommended for realtime applications)
averageThe number of FFT's to accumulate and average before calling the result writer.
skipTake each 'skip' sample and skip the rest
consumerThe upstream writer that should write to this component
windowThe window to use before calculating the FFT
isIqIf set to true then the input must be IQ data and the returned spectrum then contains negative as well as positive frequencies. If you intend to use scaling, you must initialize the HFftOutput with a samplerate. You can set the factor to 1 initially to disable zooming. But if you have not provided zoomRate != 0, zooming will not be setup and be available.!

◆ ~HFftOutput()

template<class T >
HFftOutput< T >::~HFftOutput ( )
inline

Default destructor

Member Function Documentation

◆ BinSize() [1/2]

template<class T >
float HFftOutput< T >::BinSize ( )
inline

Return the number of frequencies per bin

◆ BinSize() [2/2]

template<class T >
float HFftOutput< T >::BinSize ( H_SAMPLE_RATE  rate)
inline

Given a samplerate, return the number of frequencies per bin

◆ Center()

template<class T >
int HFftOutput< T >::Center ( )
inline

Get the center FFT frequency

◆ Command()

template<class T >
bool HFftOutput< T >::Command ( HCommand command)
inlinevirtual

Execute or carry through a command

Implements HChunkWriter< T >.

◆ Left()

template<class T >
int HFftOutput< T >::Left ( )
inline

Get the leftmost frequency of the selected fft window

◆ Output()

template<class T >
int HFftOutput< T >::Output ( T *  src,
size_t  size 
)
virtual

Process a block of samples

Implements HOutput< T, HFftResults >.

◆ Rate()

template<class T >
H_SAMPLE_RATE HFftOutput< T >::Rate ( )
inline

Return the output sample rate after resampling

◆ Right()

template<class T >
int HFftOutput< T >::Right ( )
inline

Get the rightmost frequency of the selected fft window

◆ SetZoom()

template<class T >
void HFftOutput< T >::SetZoom ( int  zoomFactor,
int  zoomCenter 
)

Change zoom factor and center

◆ Start()

template<class T >
bool HFftOutput< T >::Start ( )
inlinevirtual

Initialize before first read/write

Reimplemented from HWriter< T >.

◆ Stop()

template<class T >
bool HFftOutput< T >::Stop ( )
inlinevirtual

Cleanup after last read/write

Reimplemented from HWriter< T >.

◆ Width()

template<class T >
int HFftOutput< T >::Width ( )
inline

Get the width of the FFT spectrum (how many frequencies is covered)


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