playing & re-playing 7 .wav files

G

Guest

Dear guys,
I have 7 .wav files in C:\ directory [named: 1.wav, 2.wav, ..., 7.wav], I'd
play them all by clicking on "cmdStart" button on a Visual Basic 2005-
Windows Application Form.

I thought I should use this segment of code to get this thing done:



Private Sub cmdStart_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles cmdStart.Click

Dim i As Integer = 1

While i < 8
My.Computer.Audio.Play("C:\" & i & ".wav",
AudioPlayMode.Background)
i += 1
End While

End Sub




But when I run the application, it ONLY plays the last .wav file (7.wav) !!
What I need is to play them all, one by one, that is, 1.wav .. then 2.wav ..
then ..etc.. until 7.wav, AND i also want to re-loop [re-play these files]
this operation ( that is, after finishing the first loop of these 7 .wav
files, the application should start over again from 1.wav ... till 7.wav ...
and so on ..) !

what code line or segment should i add to the above segment to get this done
!!
I'd highly appreciate your help guys !!

Thanx in advance !
 
G

gene kelley

Dear guys,
I have 7 .wav files in C:\ directory [named: 1.wav, 2.wav, ..., 7.wav], I'd
play them all by clicking on "cmdStart" button on a Visual Basic 2005-
Windows Application Form.

I thought I should use this segment of code to get this thing done:



Private Sub cmdStart_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles cmdStart.Click

Dim i As Integer = 1

While i < 8
My.Computer.Audio.Play("C:\" & i & ".wav",
AudioPlayMode.Background)
i += 1
End While

End Sub




But when I run the application, it ONLY plays the last .wav file (7.wav) !!
What I need is to play them all, one by one, that is, 1.wav .. then 2.wav ..
then ..etc.. until 7.wav, AND i also want to re-loop [re-play these files]
this operation ( that is, after finishing the first loop of these 7 .wav
files, the application should start over again from 1.wav ... till 7.wav ...
and so on ..) !

what code line or segment should i add to the above segment to get this done
!!
I'd highly appreciate your help guys !!

Thanx in advance !

If this is simply background sounds for the app, this will proabaly
work (air code), but you will probably need to put this in it's own
thread for best performance.

Dim i As Integer = 1

While i < 8
My.Computer.Audio.Play("C:\" & i & ".wav",
AudioPlayMode.WaitToComplete)
If i = 7 then
i = 1
Else
i += 1
End While

End Sub

Gene
 
G

Guest

thanx alot this is awesome .. i will try to use background worker for putting
it on its own thread !!

gene kelley said:
Dear guys,
I have 7 .wav files in C:\ directory [named: 1.wav, 2.wav, ..., 7.wav], I'd
play them all by clicking on "cmdStart" button on a Visual Basic 2005-
Windows Application Form.

I thought I should use this segment of code to get this thing done:



Private Sub cmdStart_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles cmdStart.Click

Dim i As Integer = 1

While i < 8
My.Computer.Audio.Play("C:\" & i & ".wav",
AudioPlayMode.Background)
i += 1
End While

End Sub




But when I run the application, it ONLY plays the last .wav file (7.wav) !!
What I need is to play them all, one by one, that is, 1.wav .. then 2.wav ..
then ..etc.. until 7.wav, AND i also want to re-loop [re-play these files]
this operation ( that is, after finishing the first loop of these 7 .wav
files, the application should start over again from 1.wav ... till 7.wav ...
and so on ..) !

what code line or segment should i add to the above segment to get this done
!!
I'd highly appreciate your help guys !!

Thanx in advance !

If this is simply background sounds for the app, this will proabaly
work (air code), but you will probably need to put this in it's own
thread for best performance.

Dim i As Integer = 1

While i < 8
My.Computer.Audio.Play("C:\" & i & ".wav",
AudioPlayMode.WaitToComplete)
If i = 7 then
i = 1
Else
i += 1
End While

End Sub

Gene
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top