libZPlay documentation (Win32)
IndexReferenceHome
PreviousUpNext
ZPlay::DrawFFTGraphOnHDC Method

Draw FFT graph on window control using window handle.

C++
virtual __stdcall int DrawFFTGraphOnHDC(void* hdc, int nX, int nY, int nWidth, int nHeight) = 0;
Parameters 
Description 
void* hdc 
handle to device context. 
int nX 
Specifies the logical x-coordinate of the upper-left corner of the destination rectangle. 
int nY 
Specifies the logical y-coordinate of the upper-left corner of the destination rectangle. 
int nWidth 
Specifies the logical width of the source and destination rectangles.
Caution: There is minimal width value. See TFFTGraphSize
int nHeight 
Specifies the logical height of the source and the destination rectangles.
Caution: There is minimal height value. See TFFTGraphSize
Return Values 
Description 
All OK. 
Error. To get error message read here

Function will use window handle to get device context of specified window and then draw graph on this device context. Drawing data are fully synchronized with audio data from wave buffer. All you need is to call this function when you need to refresh displayed graph data. To get smooth animation effect, call this function 10 - 20 times per second. You can create another thread to do this job.  

Note: This function must perform FFT analysis on audio data and this takes some time if you set too big gpFFTPoints value. If you set fast refresh interval, this can take too much proccessor time. Be careful. 

Draw FFT graph on specified window 20 times per second. 

ZPlay C++ Class interface  

while(fDrawind)
{
  // draw graph on window control, starting in upper left corner, size of graph is 400 x 200 pixel
  instance->DrawFFTGraphOnHDC(myDC, 0, 0, 400, 200);
  
  // wait 50 ms
  Sleep(50);
}

C Style interface

while(fDrawing)
{
  // draw graph on window control, starting in upper left corner, size of graph is 400 x 200 pixel
  zplay_DrawFFTGraphOnHDC(instance, myDC, 0, 0, 400, 200);
  
  // wait 50 ms
  Sleep(50);
}

 

Copyright (c) 2010. Zoran Cindori - All rights reserved.

Web: http://libzplay.sourceforge.net/

Email: zcindori@inet.hr