Jump to content
  • Advertisement
Sign in to follow this  
playerwing

Play and stop in DirectSound

This topic is 4516 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! When I often call Stop() method (IDirectSoundBuffer interface) and then Play() method sound plays with strange sound. It is because playing recommences from end of last part (repeating small part of sound). I can't correct this. Plaese, help me!

Share this post


Link to post
Share on other sites
Advertisement
It's been a while since I've done any DS development, but I'm pretty sure you have to "rewind" the buffer if you want to start from the beginning again. Unlike in software such as Media Player where Stop resets it to the start, in DS the stop operation is more like a pause command [smile]

Sadly I forget the details - but the various samples in the SDK should cover it (the PlaySound one is good for this stuff)...

hth
Jack

Share this post


Link to post
Share on other sites
Are you using a streaming buffer? If so, you must refill your buffer with the beginning of the sound. If not, DS is supposed to rewind the sound when you call Stop().

Share this post


Link to post
Share on other sites
Quote:

Are you using a streaming buffer? If so, you must refill your buffer with the beginning of the sound. If not, DS is supposed to rewind the sound when you call Stop().

That happens with a primary buffer, not a streaming buffer. Secondary buffers will effectively begin playing at the same spot they stopped.

From msdn:
Quote:

For secondary sound buffers, IDirectSoundBuffer8::Stop sets the play cursor to the sample that follows the last sample played. This means that when the Play method is next called on the buffer, it will continue playing where it left off.

Share this post


Link to post
Share on other sites
Thanks for your relies.

I am learning DX SDK Sample( DXSDK\sample\Multimedia\DirectSound\StreamData ),
so I am sure that I called SetCurrentPosition(0) before calling Play(...).

My steps:

1: I open a wave file.
2: I click 'play' button to play sound.
3: Before finish playing, I click 'stop' button to break it.
4: I click 'play' button to play sound once again. In this step, problem occured that small part of last played sound be played before I play right sound! Why? How to solve it! Help me please!

In additonal, I never modified any code of this sample.

( T_T , My english is not good, sorry! )

[Edited by - playerwing on April 5, 2006 9:50:23 PM]

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.

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!