x
|
#include <quickspec.h>
Public Member Functions | |
__fastcall | TQuickSpectrogram (void *AParent, int AnId, bool Ausex, bool Auseph, GetBuf G) |
QSPEC_FORMAT *__fastcall | A (int fr) |
accesses amplitude spectrogram at frame fr More... | |
void | FreeBuffers () |
discards all computed frames and free memory More... | |
int | Invalidate (int From, int To) |
discards computed frames More... | |
QSPEC_FORMAT *__fastcall | Ph (int fr) |
accesses phase spectrogram at frame fr More... | |
void | SetFrCapacity (int AnFrCapacity) |
cmplx< QSPEC_FORMAT > *__fastcall | Spec (int fr) |
accesses complex spectrogram at frame fr More... | |
Data Fields | |
int | Id |
an identifier given at create time, used as argument for calling GetFFTBuffers() | |
void * | Parent |
a pointer used as argument for calling GetFFTBuffers() | |
GetBuf | GetFFTBuffers |
if specified, this supplies FFT buffers | |
int | Capacity |
size of $Frame[] and &Valid[], usually set to the total number of frames of the data | |
int * | Frame |
indices to individual frames in internal storage | |
int * | Valid |
validity tags to individual frames in internal storage | |
WindowType | WinType |
window type for computing spectrogram | |
double | WinParam |
additional parameter specifying certain window types (Gaussian, Kaiser, etc.) | |
void * | Data |
pointer to waveform audio | |
int | DataLength |
length of waveform audio, in samples | |
int | BytesPerSample |
bytes per sample of waveform audio | |
int | Offst |
frame offset | |
int | Wid |
frame size, the same as window size | |
Detailed Description
TQuickSpectrogram is a spectrogram class the handles the computation and storage of a spectrogram.
Using TQuickSpectrogram:
TQuickSpectrogram provides read-only access to the spectrogram of a given waveform. The spectrogram contains a sequence of windowed Fourier transforms, computed from uniformly placed frames. The 0th frame starts at 0 (inclusive) and finishes at Wid (exclusive). Each spectrum has Wid/2+1 entries.
Follow these steps:
- create a QuickSpectrogram, specifying usex and useph, and optionally, external buffer provide G and its arguments Id and Parent;
- set Data, DataLength and BytesPerSample;
- set frame size and hop size Wid and Offst;
- if G is not specified, set window type (optional extra parameter) for computing spectra;
- access the spectrogram via A(fr), Spec(fr) (optional) and Ph(fr) (optional). Steps 2~4 do not have to follow the given order.
Call Invalidate() to notify the object of changes of waveform content. Call FreeBuffers() to return the object to the initial state before step 2.
Constructor & Destructor Documentation
__fastcall TQuickSpectrogram::TQuickSpectrogram | ( | void * | AParent, |
int | AnId, | ||
bool | Ausex, | ||
bool | Auseph, | ||
GetBuf | G | ||
) |
method TQuickSpectrogram::TQuickSpectrogram:
In: AParent: pointer argument for calling G, if G is specified AnId: integer argument for calling G, if G is specified G: pointer to a function that supplies buffers used for FFT, 0 by default Ausex: set if complete complex spectrogram is to be buffered and accessible Auseph: set if phase spectrogram is to be buffered and accessible
Member Function Documentation
QSPEC_FORMAT *__fastcall TQuickSpectrogram::A | ( | int | fr | ) |
accesses amplitude spectrogram at frame fr
method TQuickSpectrogram::A: accesses amplitude spectrogram by frame
In: fr: frame index, 0-based
Returns pointer to amplitude spectrum of the fr'th frame, NULL if N/A
void TQuickSpectrogram::FreeBuffers | ( | ) |
discards all computed frames and free memory
method TQuickSpectrogram::FreeBuffers: discards all computed spectra and free all internal buffers. This returns the TQuickSpectrogram to its initial state before any frame is accessed. After calling FreeBuffers() all frames will be recomputed when they are accessed.
int TQuickSpectrogram::Invalidate | ( | int | From, |
int | To | ||
) |
discards computed frames
method TQuickSpectrogram::Invalidate: renders all frames that have overlap with interval [From, To], measured in samples, as invalid. Invalid frames are recomputed when they are accessed again.
In: [From, To]: an interval spectrogram over which needs to be updated.
Returns the number of allocated frames affected, no matter if they were valid.
QSPEC_FORMAT *__fastcall TQuickSpectrogram::Ph | ( | int | fr | ) |
accesses phase spectrogram at frame fr
method TQuickSpectrogram::Ph: accesses phase spectrogram by frame
In: fr: frame index, 0-based
Returns pointer to phase spectrum of the fr'th frame, NULL if N/A
void TQuickSpectrogram::SetFrCapacity | ( | int | AnFrCapacity | ) |
method TQuickSpectrogram::SetFrCapacity: sets the capacity, i.e. the maximal number of frames handled by this TQuickSpectrogram.
In: AnFrCapacity: the new Capacity, in frames
This method should not be called to set Capacity to a smaller value.
cmplx< QSPEC_FORMAT > *__fastcall TQuickSpectrogram::Spec | ( | int | fr | ) |
accesses complex spectrogram at frame fr
method TQuickSpectrogram::Ph: accesses complex spectrogram by frame
In: fr: frame index, 0-based
Returns pointer to complex spectrum of the fr'th frame, NULL if N/A
The documentation for this class was generated from the following files:
- quickspec.h
- quickspec.cpp
Generated on Fri Dec 27 2024 07:09:12 for x by 1.8.11