Jump to content
  • Advertisement


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


DirectXAudio question

This topic is 5850 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, I''m just starting out with putting some sounds into my 1st game. I''m familiar with the SDK DXAudio tutorial 1 so have a basic set up and can play a wav file sound but can anyone tell me how I play a sound in a game loop? just a quick sound , not continuous music. I seem to get a constant playing of the first note rather than the whole sound, as though it plays that first note every single frame. thanks

Share this post

Link to post
Share on other sites
I've messed around with this on the assumption that the play function musn't be called in subsequent frames and did it on a frame counter basis, this works fine.
Code in game loop plays the sound every 200 frames-

static int counter = 0;
if (counter == 200)
return false;
counter = 0;

I'll try a similar approach to play sounds when required like gunshots/crashes explosions etc.
Any thoughts welcome.

[edited by - inzone on September 13, 2002 4:40:40 AM]

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!