Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

DiscipleOfTorak

Playing a lot of sounds at the same time

This topic is 5801 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi. A few questions regarding DInput (I am using DX8.1) 1) Is there someway to find out the maximum amount of sounds that can be played on the same time? 2) What happens when the limit described above is passed? 3) Is there something I must consider in my code if I want to be able to play a sound (.wav-file) which is already being played (lets say that there is gunfire.wav, if many people are shooting at each other, it must be able to play the sounds simultanously, otherwise it would sound stupid, right?)?

Share this post


Link to post
Share on other sites
Advertisement
hello,

you''re not going to use DirectInput for your music/sounds needs, rather you should use DirectMusic,

as for your questions, you should use DM functions to check for the device'' capabilities like for number one, though am not sure if DM have this kind of check,

Share this post


Link to post
Share on other sites
quote:
Original post by DiscipleOfTorak
A few questions regarding DInput (I am using DX8.1)



As mentioned, you need DirectSound or DirectMusic.
DirectSound is probably what you''re looking for to play WAV files.

quote:
Original post by DiscipleOfTorak
1) Is there someway to find out the maximum amount of sounds that can be played on the same time?



The limit for the number of sounds is the amount of system memory you have (there is probably some cap in DirectSound too, but thats just there for completeness).
Each sound effect instance is just a portion of RAM containing the description of the sound.
Each instance of a sound buffer is mixed into a primary buffer before being sent to the audio card.

quote:
Original post by DiscipleOfTorak
2) What happens when the limit described above is passed?



You''ve run out of memory and probably won''t be able to create any new buffers.


quote:
Original post by DiscipleOfTorak
3) Is there something I must consider in my code if I want to be able to play a sound (.wav-file) which is already being played (lets say that there is gunfire.wav, if many people are shooting at each other, it must be able to play the sounds simultanously, otherwise it would sound stupid, right?)?



Each instance needs to have its own buffer, so if each player can only fire one shot at a time, then one buffer for each player should be okay.
Hope this helps.


Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!