Link to home
Start Free TrialLog in
Avatar of aftab2003
aftab2003

asked on

WAV file rewind and play

Hi,

I want to rewind a wav file and play it three or four times. How do I do that ?

The following plays only once :

MMControl1.DeviceType = WaveAudio
MMControl1.Notify = False
MMControl1.Wait = False
MMControl1.Shareable = False

MMControl1.FileName = "C:\1.WAV"
MMControl1.Command = "Open" 'app.Path & 
MMControl1.Command = "PlaY"
'WaitForEventsToFinish 100
MMControl1.Command = "Rewind"
MMControl1.Command = "PlaY"
MMControl1.Command = "Back"
MMControl1.Command = "PlaY"
Avatar of zzzzzooc
zzzzzooc

Rewind is "Prev". The below will play "c:\test.wav" and repeat it 4 times afterwards (total of 5 times).


Form1:
--------------

Private iRepeat As Integer, bExecuting As Boolean
Private Sub Form_Load()
    iRepeat = 4
    MMControl1.DeviceType = WaveAudio
    MMControl1.FileName = "c:\test.wav"
    MMControl1.Command = "Open"
    MMControl1.Command = "Play"
End Sub
Private Sub MMControl1_Done(NotifyCode As Integer)
    If NotifyCode = mciNotifySuperseded Then Exit Sub
    iRepeat = iRepeat - 1
    If iRepeat > -1 Then
        MMControl1.Command = "Prev"
        MMControl1.Command = "Play"
        Debug.Print Timer
    Else
        MMControl1.Command = "Close"
    End If
End Sub
ASKER CERTIFIED SOLUTION
Avatar of zzzzzooc
zzzzzooc

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of aftab2003

ASKER

Perfect - Thank you very much