473,395 Members | 1,454 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

playing & re-playing 7 .wav files

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 !
May 25 '06 #1
2 1357
On Thu, 25 May 2006 06:52:02 -0700, Mr. Murad Jamal
<Mr**********@discussions.microsoft.com> 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
May 25 '06 #2
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
<Mr**********@discussions.microsoft.com> 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

May 27 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Collin VanDyck | last post by:
I have a basic understanding of this, so forgive me if I am overly simplistic in my explanation of my problem.. I am trying to get a Java/Xalan transform to pass through a numeric character...
1
by: DrTebi | last post by:
Hello, I have the following problem: I used to "encode" my email address within links, in order to avoid (most) email spiders. So I had a link like this: <a...
0
by: Thomas Scheffler | last post by:
Hi, I runned in trouble using XALAN for XSL-Transformation. The following snipplet show what I mean: <a href="http://blah.com/?test=test&amp;test2=test2">Test1&amp;</a> <a...
12
by: Sammy | last post by:
Hi, my mind is going crazy. I have tried everything I can think of to no avail. I have tried Disable Output Escaping. I tried to think of a way of enclosing the attribute data in a CDATA...
0
by: James Thurley | last post by:
I'm creating an XmlDocument manually, adding content using the Xml classes such as XmlElement and XmlText, and I then write it out as as "text/xml" to the HttpResponse.Output TextWriter object...
11
by: Jeremy | last post by:
How can one stop a browser from converting &amp; to & ? We have a textarea in our system wehre a user can type in some html code and have it saved to the database. When the data is retireved...
14
by: Arne | last post by:
A lot of Firefox users I know, says they have problems with validation where the ampersand sign has to be written as &amp; to be valid. I don't have Firefox my self and don't wont to install it only...
12
by: InvalidLastName | last post by:
We have been used XslTransform. .NET 1.1, for transform XML document, Dataset with xsl to HTML. Some of these html contents contain javascript and links. For example: // javascript if (a &gt; b)...
0
by: Mudiya Dissa | last post by:
Hi, I have some code on my application like the following <% redirectUrl = "mypage.asp?type=100&id=something&view=10 'some more asp code
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.