A Smart Audio Player
21/09/2010 16:34This player enable you to play midi and wave files in your hard drives or floppy A or CDROM.
It allows you to change drives and search for the particular sound file that you wish to play.
In this program, you have to add a Combo box, a List Box, a Text Box, a Drive List Box,
a command button you label as "PLAY", another command button you label as "STOP", and one
more command button you label as "EXIT". You have to add in MMControl and make it invisible.
Sub Combo1_Change( )
if ListIndex=0 Then
File1.Pattern=("*.wav")
ElseIf ListIndex=1 Then
File1.Pattern=("*.mid")
Else
File1.Pattern=("*.*)
End If
End Sub
If Right(File1.Path,1) <>"\" Then
filenam=File1.Path +"\"+File1.Filename
Else
filenam=File1.Path+File1.Filename
End If
Text1.Text=filenam
End Sub
Private Sub Play_Click( )
If Combo1.ListIndex=0 Then
MMControl1.DeviceType="WaveAudio"
ElseIf Combo1.ListIndex=1 Then
MMControll.DeviceType="Sequencer"
End If
MMControl1.FileName=Text1.Text
MMControl1.Command="Open"
MMControl1.Command="Play"
End Sub
Private Sub Stop_Click( )
If MMControl1.Mode=524 Then Exit Sub
If MMControl1.Mode<>525 Then
MMControl1.Wait=True
MMControl1.Command="Close"
End Sub
Private Sub Dir1_Change( )
File1.Path=Dir1.Path
If Combo1.ListIndex=0 Then
File1.Pattern=("*.wav")
ElseIf Combo1.ListIndex=1 Then
File1.Pattern=("*.mid")
Else
File1.Pattern=("*.*)
End If
Private Sub Drive1.Change( )
Dir1.Path=Drive1.Drive
End Sub
Private Sub Form_Load( )
Top=(Screen.Height-Height)\2
Left=(Screen.Width-Width)\2
Combo1.Text="*.wav"
Combo1.AddItem "*.wav"
Combo1.AddItem "*.mid"
Combo1.AddItem "All files"
End Sub
———
Back