Get FFT data for currently playing samples.
__stdcall __declspec(dllimport) int zplay_GetFFTData(ZPLAY_HANDLE handle, int nFFTPoints, TFFTWindow nFFTWindow, int * pnHarmonicNumber, int * pnHarmonicFreq, int * pnLeftAmplitude, int * pnRightAmplitude, int * pnLeftPhase, int * pnRightPhase);
Parameters |
Description |
ZPLAY_HANDLE handle |
ZPLAY handle. Get this handle with zplay_CreateZPlay. |
int nFFTPoints |
Set this value to specify FFT size. This value must be power of 2. |
TFFTWindow nFFTWindow |
Set this value to specify FFT window. |
int * pnHarmonicNumber |
Pointer to variable receiving number of harmonics returned from FFT analysis. NumberOfHarmonics = (nFFTPoints/2 + 1) |
int * pnHarmonicFreq |
Pointer to integer array receiving frequency of each harmonic. User must to allocate memory for this array. Use returned pnHarmonicNumber value to get number of harmonics. If you don't need this information, set this parameter to NULL. |
int * pnLeftAmplitude |
Pointer to integer array receiving amplitude of each harmonic for left channel. Amplitude range is from 0 to about 120 dB. User needs to allocate memory for this array. If you don't need this information, set this parameter to NULL. |
int * pnRightAmplitude |
Pointer to integer array receiving amplitude of each harmonic for right channel. Amplitude range is from 0 to about 120 dB. User needs to allocate memory for this array. If you don't need this information, set this parameter to NULL. |
int * pnLeftPhase |
Pointer to integer array receiving phase of each harmonic for left channel. Phase range is from -90 to 90 degrees. User needs to allocate memory for this array. If you don't need this information, set this parameter to NULL. |
int * pnRightPhase |
Pointer to integer array receiving phase of each harmonic for right channel. Phase range is from -90 to 90 degrees. User needs to allocate memory for this array. If you don't need this information, set this parameter to NULL. |
Return Values |
Description |
1 |
All OK. |
0 |
Error. To get error message read here. |
nFFTPoints parameter specifies number of samples for FFT algorithm. This parameter must be power of 2. Larger value produces more harmonics and better frequency resolution. But this needs more processor power to calculate FFT algorithm.
Note: NumOfHarmnics = NumOfFFTPoints/2 + 1
Note: FFT data are fully synchronized with audio data from wave buffer.
Get amplitude values for left channel using 512 FFT points and triangular window.
int nLeftAmplitude[257]; // we are using 512 FFT points: number of harmonics is 512/2 + 1 = 257 instance->GetFFTValues(512, fwTriangular, 0, 0,nLeftAmplitude, 0, 0, 0);
int nLeftAmplitude[257]; // we are using 512 FFT points: number of harmonics is 512/2 + 1 = 257 zplay_GetFFTValues(instance, 512, fwTriangular, 0, 0,nLeftAmplitude, 0, 0, 0);
Copyright (c) 2010. Zoran Cindori - All rights reserved.
Web: http://libzplay.sourceforge.net/ Email: zcindori@inet.hr |