'Thank you for Downloading MattPlayer. This program has been
'created as an experiment with FFT (Fast Fourier Transforms) to
'visualize sound. This application is a little rough around the
'edges but is fun to use and watch.
'NOTE: The visualization will not work unless either the Wave OUT Mixer, or CDPlayer
'is selected in the volume control under the Recording Control.
'Please email me any bug fixes or enhancements at sco_stinks@yahoo.com
'
'Enjoy
'Matt Gillmore
'Kudos to Murphy McCauley for his FFT algorithm
Option Explicit
Private Type BGRQuad
b As Byte
g As Byte
R As Byte
Empty As Byte
End Type
Private Type BITMAPINFOHEADER
biSize As Long
biWidth As Long
biHeight As Long
biPlanes As Integer
biBitCount As Integer
biCompression As Long
biSizeImage As Long
biXPelsPerMeter As Long
biYPelsPerMeter As Long
biClrUsed As Long
biClrImportant As Long
End Type
Private Declare Function MoveToEx Lib "gdi32" (ByVal hdc As Long, ByVal X As Long, ByVal Y As Long, D@) As Long
Private Declare Function LineTo Lib "gdi32" (ByVal hdc As Long, ByVal X As Long, ByVal Y As Long) As Long
Private Declare Function Rectangle Lib "gdi32" (ByVal hdc As Long, ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long
Private Declare Function StretchDIBits Lib "gdi32" (ByVal hdc As Long, ByVal X As Long, ByVal Y As Long, ByVal dx As Long, ByVal dy As Long, ByVal srcx As Long, ByVal srcy As Long, ByVal wSrcWidth As Long, ByVal wSrcHeight As Long, lpBits As Any, lpBitsInfo As BITMAPINFOHEADER, ByVal wUsage As Long, ByVal dwRop As Long) As Long
'Mixer-Vars
Dim hMixer&, SrcArr(20) As MIXERCONTROL, DstArr(20) As MIXERCONTROL
'WaveIn-Vars
Dim DevHandle&, RBuf(29) As WavBuf, RIdx&, FNr&, FSize&
Dim WithEvents xt As XTimer, pArr() As BGRQuad, MaxL&, MaxR&
Attribute xt.VB_VarHelpID = -1
Dim status As Boolean
Dim Num_Tracks As Long
Dim curTrack As Integer
Dim Cd_Open As Boolean
Dim gX As Long
Dim gY As Long
Dim offset As Integer
Private Sub cmdEject_Click()
Dim lRet As Long
If Not Cd_Open Then
lRet = mciSendString("set cd door open", 0, 0, 0)
Cd_Open = True
Else
lRet = mciSendString("set cd door closed", 0, 0, 0)
Cd_Open = False
End If
End Sub
Private Sub cmdExit_Click()
Unload Me
End Sub
Private Sub cmdNext_Click()
Dim lRet As Long
curTrack = GetCurTrack()
curTrack = curTrack + 1
If curTrack <> GetNumTracks Then
If CheckIfPlaying = 1 Then
mciSendString "play cd from " & CStr(curTrack), 0, 0, 0
Else
mciSendString "seek cd to " & CStr(curTrack), 0, 0, 0
End If
End If
End Sub
Private Sub cmdPlay_Click()
Dim lRet As Long
Dim sPos As String * 30
Dim nCurrentTrack As Integer
lRet = mciSendString("play cd", 0&, 0, 0)
nCurrentTrack = 1
lRet = mciSendString("play cd from" & Str(nCurrentTrack), 0&, 0, 0)
End Sub
Private Sub cmdPrev_Click()
Dim lRet As Long
If curTrack = 1 Then
'
Else
curTrack = curTrack - 1
If CheckIfPlaying = 1 Then
lRet = mciSendString("play cd from" & Str(curTrack), 0&, 0, 0)
Else
mciSendString "seek cd to " & CStr(curTrack), 0, 0, 0