Here is a VB code snipplet that could tell you how to accomplish this:
Private Type Rect
Left As Long
Top As Long
Right As Long
Bottom As Long
Private Declare Function CreateSolidBrush Lib "gdi32" (ByVal crColor As Long) As Long
Private Declare Function FillRect Lib "user32" (ByVal hDC As Long, lpRect As Rect, ByVal hBrush As Long) As Long
Private Sub vis_DisplaySpectrum()
'This calculates and displays 'the Spectrum Dim rct As Rect 'For clearing Dim hDC As Long 'The spectrum data Static src_Spec(512) As Single 'The handle for the spectrum loop Dim Y As Integer 'Get the spectrum from FMOD Call GetSpectrum(src_Spec) 'First set the rectangle for clearing rct.Bottom = picSpectrum.Height rct.Left = 0 rct.Right = picSpectrum.Width rct.Top = 0 'Set the HDC of the picturebox hDC = picSpectrum.hDC 'Clear the picturebox FillRect hDC, rct, CreateSolidBrush(&HBB5E00) 'Loop through the Spectrum and plot 'each line rct.Bottom = picSpectrum.ScaleHeight For Y = 0 To 512 'Set the rectangles rct.Left = (Y*3) + 1 rct.Top = rct.Bottom - src_Spec(Y) * rct.Bottom rct.Right = Y * 3 + 3 'Print each bar FillRect hDC, rct, CreateSolidBrush(&HFD7E00) Next Y 'Refresh the picturebox for good quality picSpectrum.Refresh DoEvents
I hope you meant VB and not Delphi!
That should work though, just put it in a timer.
- Paranoid_Android answered 15 years ago
Please login first to submit.