Skip to main content
gamedev.net
🔒 Locked

playing partial sounds

Started by frogant 1 reply 200+ views
Original Post
frogant
frogant
I want to be able to play a piece of a dsound buffer, either starting play somewhere after the beginning, stopping play somewhere before the end, or both. I can do this using get/setposition() in combination with play() and stop(), or, it seems, I can do this using the direct sound notifications interface in combination with createevent(). I''m wondering what are the pros and cons of each approach, and are there other approaches. thanks.
"the many sings to us"
frogant
frogant
bump
"the many sings to us"
John Reynolds
John Reynolds
You will have to use SetPosition to set the start position of the sound. Notifications won''t really help you there. However, when checking for the end either method is fine.

If you are using GetPosition then you must accept that you are calling it yourself every frame, and as such you may be a few milliseconds out. Failing that you could call GetPosition from within a thread, which is basically how Notifications work anyway.

Cheers,
John
John ReynoldsCreative Asylum Ltdwww.creative-asylum.com

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.