Jump to content
  • Advertisement

Archived

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

inzone

DirectXAudio question

This topic is 5939 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
Advertisement
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)
{
if(!DirectAudio->Play())
{
DirectAudio->DirectAudioRelease();
return false;
}
counter = 0;
}
counter++;

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!