r/visualbasic • u/[deleted] • Jan 06 '14
Vb.net playing multiple sounds at once problem
I'm trying to make a program that will play multiple sounds at once. I have looked into multiple threading but it seems like it's over my head without an actual person there to show me the ropes. I have tried changing the format and location of these two sounds and just about everything else I could think of. After three weeks I gave up saying it would come to me. After six months of on and off searching it hasn't. Does anybody have any ideas? EDIT: i was trying to do this for a game but the game got deleted by mistake. So now i am just trying to play 2 sounds at the same time with two different buttons to start them
1
u/hdsrob Jan 07 '14
You should look into the BackgroundWorker.
It basically lets you call a routine in a background thread without having to handle all of the details of threading.
So after adding a BackgroundWorker to your form .....
button_click()
backgroundWorker.RunWorkerAsync
end sub
BackgroundWorker_DoWork() ...
'Play file here
end sub You'd have to use a separate BGW for each file you wanted to play.
1
1
u/krznpsk Jan 07 '14
One simple approach that might work is creating several timers and playing the sounds in their tick event handler(s).