Re: playing & re-playing 7 .wav files

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



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

"gene kelley" wrote:

On Thu, 25 May 2006 06:52:02 -0700, Mr. Murad Jamal
<MrMuradJamal@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:

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

.



Relevant Pages

  • Re: playing & re-playing 7 .wav files
    ... 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, ... Dim i As Integer = 1 ...
    (microsoft.public.dotnet.languages.vb)
  • Reading UDTs out of a byte array (CopyMemory vs Get on a disk file)
    ... contiguously on disk and then some number of 64 byte "segment records" ... Public Sub LoadBuffer ... Dim hFile As Integer ... Get #hfile calls on the file to fill in my UDTs. ...
    (microsoft.public.vb.winapi)
  • Re: Umm.... How to pass a sub into a class......
    ... So rather than create a separate dialog for each task I created a class that displays a dialog and fires off a background worker, what I can't seem to do is pass a dowork handler sub into the class. ... I can happily pass string and other variables in to the class but when I create a new instance of ProgressBox I need to be able to pass worksub into it and have it added as the handler of the backgroundworkers DoWork function. ...
    (microsoft.public.dotnet.languages.vb)
  • Umm.... How to pass a sub into a class......
    ... I'm writing a program where I need to do a lot of different background worker tasks and display the progress in a dialog box. ... So rather than create a separate dialog for each task I created a class that displays a dialog and fires off a background worker, what I can't seem to do is pass a dowork handler sub into the class. ... I can happily pass string and other variables in to the class but when I create a new instance of ProgressBox I need to be able to pass worksub into it and have it added as the handler of the backgroundworkers DoWork function. ...
    (microsoft.public.dotnet.languages.vb)
  • RE: Formula in given via input box
    ... Dim segment As String ... Dim formula As String ... End Sub ...
    (microsoft.public.excel.programming)