oscilloscope

Started by Maverick, 31 Jul '03 - 04:31

Maverick

This is a nice oscilloscope useing BASS_ChannelGetData.
If u know of one better in VB let me know.


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

Nice work!!

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

-gogman-