Jump to content
  • Advertisement
Sign in to follow this  

Detecting the position and end of a sound

This topic is 4842 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

How do you detect when a sound has ended, and detect and set the position where it currently is? I have several tracks of background music for a game, and one track of menu music. I need to be able to pause it, record the position of the background track, e.g. 1 minute 13 seconds into the track, and when I unpause, to make the sound start playing again from the same point it stopped at. Also, when a track has ended, I need to be able to detect that it has ended, so I can play a different track.

Share this post


Link to post
Share on other sites
Advertisement
Are you using DirectSound or DirectMusic/Audio?

In DirectSound, the "IDirectSoundBuffer8" interface has the methods: GetCurrentPosition(), SetCurrentPosition(), and GetStatus(). You can get the details of the parameters from the DirectX SDK Docs or MSDN.

In DirectMusic/Audio 'IDirectMusicSegment8' and 'IDirectMusicSegmentState' have a TON of methods for accessing and setting positions and automatic loop points, and the "IDirectMusicPerformance8" interface has even more for determining the current playing state of the segements. If would be ridiculous for me to try to list all the details here, so, as before, check it out in MSDN. Or, if you still have the DirectX 8 Docs, you can find it in there.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

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

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!