Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Contatenating Sound Resources

Status
Not open for further replies.

gharabed

Programmer
Sep 7, 2001
251
US
Is there a way to concatenate together sound resources into a single stream (VS 2008). The way I am playing imported sound resources right now is:

Code:
My.Computer.Audio.Play(My.Resources.click, AudioPlayMode.Background)

This will play the imported resource named "click" in the background (asynchronously). However, I want to play sound1, sound2, and sound3 one right after the other. You would think you would just do it like so:

Code:
My.Computer.Audio.Play(My.Resources.Sound1, AudioPlayMode.Background)
My.Computer.Audio.Play(My.Resources.Sound2, AudioPlayMode.Background)
My.Computer.Audio.Play(My.Resources.Sound3, AudioPlayMode.Background)

However, this does not work. Since it is played asynchronously what ends up happening is the last sound ends up playing as it steps on the other two. I can play them in the foreground with the "WaitToComplete" parameter instead of the "Background" parameter. However, in this case, it locks up the user interface as it is playing syncrhonously. The resources are of type/class: System.IO.UnmanagedMemoryStream

Is there some way I can concatenate the resources programatically so that I can play the concatenated stream in a single call to "Play" in the background?

Help is really appreciated on this.

Thanks,

Greg
 
Do a Google search for something like "combine audio files" (without the quotes), find a nice free audio editor such as Audacity, combine the 3 sound files you want into one file, then play that in the background

I used to rock and roll every night and party every day. Then it was every other day. Now I'm lucky if I can find 30 minutes a week in which to get funky. - Homer Simpson

Arrrr, mateys! Ye needs ta be preparin' yerselves fer Talk Like a Pirate Day!
 
I have multiple (one hundred or so) different sounds that may be combined in any order so concatenating them together using something like Audactiy is not an option. It must be done at runtime.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top