libZPlay documentation (Win32)
IndexReferenceHome
PreviousUpNext
ZPlay.DrawFFTGraphOnHDC Method

Draw FFT graph on window control using window handle.

Visual Basic
Public Function DrawFFTGraphOnHDC(ByVal hdc As System.IntPtr, ByVal X As Integer, ByVal Y As Integer, ByVal Width As Integer, ByVal Height As Integer) As Boolean
Parameters 
Description 
ByVal hdc As System.IntPtr 
Handle to device context. 
ByVal X As Integer 
Specifies the logical x-coordinate of the upper-left corner of the destination rectangle. 
ByVal Y As Integer 
Specifies the logical y-coordinate of the upper-left corner of the destination rectangle. 
ByVal Width As Integer 
Specifies the logical width of the source and destination rectangles.
Caution: There is minimal width value. See TFFTGraphSize
ByVal Height As Integer 
Specifies the logical height of the source and the destination rectangles.
Caution: There is minimal height value. See TFFTGraphSize
Return Values 
Description 
True 
All OK. 
False 
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. 

Private Sub PictureBox1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles PictureBox1.Paint
  Dim MyDeviceContext As IntPtr = e.Graphics.GetHdc()
  player.DrawFFTGraphOnHDC(MyDeviceContext, 0, 0, PictureBox1.Width, PictureBox1.Height)
  e.Graphics.ReleaseHdc(MyDeviceContext)
End Sub

 

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

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

Email: zcindori@inet.hr