Author Topic: oscilloscope  (Read 5561 times)

Maverick

  • Posts: 3
oscilloscope
« on: 31 Jul '03 - 04:31 »
This is a nice oscilloscope useing BASS_ChannelGetData.
If u know of one better in VB let me know.

Code: [Select]


Dim x, i, h As Long
Dim SampleData(1000) As Integer, nDataSize As Integer

nDataSize = 1000
BASS_ChannelGetData chan, SampleData(0), nDataSize
PicSpectrum1.Cls
     'left channel
For i = 0 To 499 Step 1
       h = ((SampleData(i) + 32768) / 65535 * PicSpectrum1.ScaleHeight)
       x = (PicSpectrum1.ScaleWidth * i * 2) / nDataSize
       If i = 0 Then PicSpectrum1.PSet (0, h)
       PicSpectrum1.Line -(x, h), Color1L 'insert colorcode here or reference to one
     Next
     'right channel
     For i = 1 To 499 Step 2
       h = ((SampleData(i) + 32768) / 65535 * PicSpectrum1.ScaleHeight)
       x = (PicSpectrum1.ScaleWidth * i) / 500
       If i = 1 Then PicSpectrum1.PSet (0, h)
       PicSpectrum1.Line -(x, h), Color1R 'insert colorcode here or reference to one
     Next

gogman

  • Posts: 5
Re: oscilloscope
« Reply #1 on: 1 Aug '03 - 11:14 »
Nice work!!

I'll see if I can refine it a bit and post the results.

-gogman-