0
0

How can i the spectrum? please, help me! 😥

  • You must to post comments
0
0
  • You must to post comments
0
0

Here is a VB code snipplet that could tell you how to accomplish this:

[code:m9qt4qux]

Private Type Rect
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type

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

End Sub

[/code:m9qt4qux]

I hope you meant VB and not Delphi!
That should work though, just put it in a timer.

  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.