Welcome Guest ( Log In | Register )



 
Reply to this topicStart new topic
> Playing Two Wav Files Simultaneously In C#
turbopowerdmaxst...
post Aug 20 2008, 09:38 AM
Post #1


Premium Member
Group Icon

Group: [HOSTED]
Posts: 410
Joined: 16-February 06
From: Kolkata, India
Member No.: 11,322
myCENTs:82.69



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.
Go to the top of the page
 
+Quote Post
faulty.lee
post Aug 20 2008, 12:00 PM
Post #2


Super Member
Group Icon

Group: [HOSTED]
Posts: 500
Joined: 5-November 06
Member No.: 17,016
myCENTs:NEGATIVE[-20.12]



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.
Go to the top of the page
 
+Quote Post
turbopowerdmaxst...
post Aug 20 2008, 12:28 PM
Post #3


Premium Member
Group Icon

Group: [HOSTED]
Posts: 410
Joined: 16-February 06
From: Kolkata, India
Member No.: 11,322
myCENTs:82.69



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.
Go to the top of the page
 
+Quote Post
faulty.lee
post Aug 20 2008, 12:49 PM
Post #4


Super Member
Group Icon

Group: [HOSTED]
Posts: 500
Joined: 5-November 06
Member No.: 17,016
myCENTs:NEGATIVE[-20.12]



That's cool, might be useful for me as well in the future. Thanks for sharing
Go to the top of the page
 
+Quote Post
turbopowerdmaxst...
post Aug 20 2008, 02:21 PM
Post #5


Premium Member
Group Icon

Group: [HOSTED]
Posts: 410
Joined: 16-February 06
From: Kolkata, India
Member No.: 11,322
myCENTs:82.69



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.
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic

Collapse

> Similar Topics

Topics Topics
  1. Renaming collection of Pictures (files)!(15)
  2. Converting Flash Files To Gif(7)
  3. How To Hide Your Files In XP(18)
  4. What Is The Best RPG You Have Ever Played(122)
  5. How To Transfer Files From One Computer To Another(16)
  6. VB.NET: Howto Add And Delete Files(9)
  7. Sharing Files In Windows Xp Home(15)
  8. How To Play *.rm Files With Media Player(14)
  9. Man Dies From Playing World Of Warcraft(139)
  10. How Do I Chmod Files On Astahost ?(20)
  11. Help Me: Need To Transfer Files From Old Computer(18)
  12. Switch Network Settings With Batch Files(18)
  13. Renaming Files (Using Excel Spreadsheet)(22)
  14. How Can I Delete Old Files In Windows Xp ?(22)
  15. Get User Input From Vbscript For Batch Files(2)
  1. How To Embed Swf Files In Joomla ?(10)
  2. Creating Executable Jar Files(9)
  3. Any RPG (Report Program Generator) Programmers?(4)
  4. How To Open .bam Files !(5)
  5. Playing Some Gba Games Online(3)
  6. If You Have Some Private Files(17)
  7. How To Get Quick And Easy Levels In Runescape(12)
  8. Software To Concatenate Mp3 Files(8)
  9. Uploading More Than 30 Files In Less Than 10 Clicks?(5)
  10. Magic Quotes And $_files(3)
  11. Friends Can't Start The Exe Files I Send :((5)
  12. Need Some Help/advice On Lost Files.(8)
  13. Need Some Help/advice On How To Restore Lost Files(5)


 



- Lo-Fi Version Time is now: 22nd November 2008 - 11:24 PM