Nov 22, 2009

Playing Two Wav Files Simultaneously In C#

free web hosting
Open Discussion & Free Web Hosting > Computers & Tech > Programming > Programming General > C# .NET

Playing Two Wav Files Simultaneously In C#

turbopowerdmaxsteel
I have reached a dead-end, in trying to code the Audio Engine for the game - Bomber Man. The current engine uses the native functions(waveOutOpen, waveOutWrite, etc) declared in Winmm.dll file. While this allows me to play two sounds together (the Background music and the sound effects), it causes frequent memory corruptions. For instance, it changes the value of an integer variable located in a different and unrelated class. I spent hours trying to find out why the value was constantly changing. When I disabled all the sounds, the problem didn't occur. I used a modifed version of the code given in this example. The problem is not due to these modifications because it does not occur in a Console Application.

Is there a library for .NET that I can use for playing two or more sounds simultaneously? Also, the above example does a lot of low level handling, which I do not require. All I need is the ability to play WAV files.

 

 

 


Comment/Reply (w/o sign-up)

faulty.lee
QUOTE(turbopowerdmaxsteel @ Aug 20 2008, 05:38 PM) *
I have reached a dead-end, in trying to code the Audio Engine for the game - Bomber Man. The current engine uses the native functions(waveOutOpen, waveOutWrite, etc) declared in Winmm.dll file. While this allows me to play two sounds together (the Background music and the sound effects), it causes frequent memory corruptions. For instance, it changes the value of an integer variable located in a different and unrelated class. I spent hours trying to find out why the value was constantly changing. When I disabled all the sounds, the problem didn't occur. I used a modifed version of the code given in this example. The problem is not due to these modifications because it does not occur in a Console Application.

Is there a library for .NET that I can use for playing two or more sounds simultaneously? Also, the above example does a lot of low level handling, which I do not require. All I need is the ability to play WAV files.

I've 2 suggestion.

1. DirectSound - it's meant for game and microsoft has a managed version for directx 9.0c called MDX 1.1. It's written with .Net 1.1. It's quite old but serve the purpose. It can run on .Net 2.0 also. You can look into their documentation. I'm currently using that too for my mutltimedia project. MDX 2.0 was in beta but never release and microsoft moved over to XNA. It's too bulky if you just want to play sound. Btw, what engine did you use for your graphic/sprite?

2. Quick and easy exe - Look for commandline wav player online. Then simply issue "Process.Start()" to have it play your wav files. Normal wav player should allow playing of multiple wav at the same time.

 

 

 


Comment/Reply (w/o sign-up)

turbopowerdmaxsteel
I am building the game for a contest. More info. Initially, I was going through a tutorial of Managed DirectX at Coding4Fun. In my opinion, using DirectX would be unfair against the likes of the other languages in the contest (J2ME & Flash).

I did think about using an external program. The game being entirely rendered in GDI+, executing such processes would further deteriorate the performance. Although, I haven't given it a try.

Thankfully though, I came across an excellent library named irrKlang for playing 2D/3D sounds. It also supports MP3 which is a major plus point because the final project must be zipped within 2 MBs.

Comment/Reply (w/o sign-up)

faulty.lee
That's cool, might be useful for me as well in the future. Thanks for sharing

Comment/Reply (w/o sign-up)

turbopowerdmaxsteel
QUOTE(faulty.lee @ Aug 20 2008, 06:19 PM) *
That's cool, might be useful for me as well in the future. Thanks for sharing


No problem, thats what we are here for!

I would appreciate it if anybody would review my game in progress. It can be downloaded from http://maxotek.net/scripts/php-ajax/winExplorerImpersonator/ under The Bomber Man directory.

Comment/Reply (w/o sign-up)


Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

This textarea will convert to Rich-Text automatically (IE, Firefox, Chrome)

Similar Topics

Keywords : Playing Wav Files Simultaneously


    Looking for playing, wav, files, simultaneously, c,

See Also,

*SIMILAR VIDEOS*
Searching Video's for playing, wav, files, simultaneously, c,
advertisement



Playing Two Wav Files Simultaneously In C#

Affordable Web Hosting, Low cost Web Hosting - ComputingHost.com