Thread: DirectSound help

  1. #1
    Carnivore ('-'v) Hunter2's Avatar
    Join Date
    May 2002
    Posts
    2,879

    Unhappy DirectSound help

    Hi everyone,

    Just a question, is it possible to use a single sound buffer and have it stop and play again right away before it is finished? I've tried this:
    Code:
    void gameMain()
    {
    	static DWORD last = GetTickCount();
    	if(GetTickCount() - last >= 100)
    	{
    		lpdsb->Stop();
    		lpdsb->Play(0,0,0);
    		last = GetTickCount();
    	}
    }
    That didn't work, it just started giving me a buzzing noise or something (I can't remember exactly, I've tried about 10 different things and each did something else uniquely wrong ). I know you can achieve the effect somehow, from playing games like Counter-Strike where rapidly-repeating sounds like gunshots just cut off and restart if the sound is played again before it is finished. I've managed to *sort of* do this using 2 sound buffers, but is it possible to do it with only 1?

    **EDIT**
    Just figured out, it doesn't reset the position when you Stop() it
    Last edited by Hunter2; 06-09-2003 at 02:49 PM.
    Just Google It. √

    (\ /)
    ( . .)
    c(")(") This is bunny. Copy and paste bunny into your signature to help him gain world domination.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. DirectSound header issues
    By dxfoo in forum C++ Programming
    Replies: 0
    Last Post: 03-19-2006, 07:16 PM
  2. DirectSound - multiple sounds
    By Magos in forum Game Programming
    Replies: 9
    Last Post: 03-03-2004, 04:33 PM
  3. DirectSound vs DirectMusic
    By Trauts in forum Windows Programming
    Replies: 3
    Last Post: 10-05-2003, 05:49 PM
  4. DirectSound vs. DirectMusic
    By Hunter2 in forum Game Programming
    Replies: 3
    Last Post: 06-05-2003, 04:30 PM
  5. DirectSound
    By headexplodes in forum Game Programming
    Replies: 2
    Last Post: 12-04-2001, 08:15 AM