Click here to Skip to main content
15,881,757 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
in Windows forms application, play sounds simultaneously
Posted
Comments
Thanks7872 31-Dec-14 7:50am    
And what is the question?
Sergey Alexandrovich Kryukov 31-Dec-14 18:59pm    
Why? You won't be able to perfectly synchronize them. Instead, you should better merge two or more audio fragments, using one or another function, and play the result. With proper effort, you could do it even on the fly...
—SA

 
Share this answer
 
Comments
john1990_1 31-Dec-14 7:03am    
thx but these play from URI, i want from program resources stream
Snesh Prajapati 31-Dec-14 7:32am    
Have a look for different resource scenario here:
http://stackoverflow.com/questions/1900707/how-to-play-audio-from-resource
john1990_1 31-Dec-14 7:48am    
i can solve it another way, how to link URI to a sound in my resources called hh.wav? in windows forms application
Snesh Prajapati 31-Dec-14 7:58am    
I am not sure...need to look for it. Thanks.
john1990_1 31-Dec-14 8:09am    
forget path to resources, how to play sound from stream simultaneoulsy?
Hi,
You sound like you could use the Windows Media Player ActiveX control.
Follow this msdn tutorial on how to add this to the designer:
http://msdn.microsoft.com/en-us/library/dd564585(v=vs.85).aspx[^]
http://msdn.microsoft.com/en-us/library/dd562851%28v=vs.85%29.aspx[^]

and if you want to add a media player programitacly read this link:
http://msdn.microsoft.com/en-us/library/dd562692(v=vs.85).aspx[^]

Now add a button to your form and add this to the button click event method:
Note: when you change the URL property of the media player it will automatically start playing the file located at the new URL location.
C#
this.YourFirstMediaPlayerNameHere.URL = @"C:\Users\Public\Music\Sample Music\Sleep Away.mp3";
this.YourSecondMediaPlayerNameHere.URL = @"C:\Users\Public\Music\Sample Music\Maid with the Flaxen Hair.mp3";

I hope this helps,
MasterCodeon
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900