Results 1 to 40 of 181

Thread: Sugestions or Comments about my Sound Tutorial

Threaded View

  1. #39
    Frenzied Member
    Join Date
    Oct 2008
    Posts
    1,238

    Re: Sugestions or Comments about my Sound Tutorial

    Now I'm having another problem. When I stop my sound buffer from playing, and then I later start it up again, with different data, it for a fraction of a second continues playing the previous data, before it reads the new data. I assume that's because when I stopped it, I stopped it before it had finished playing the previous segment of the buffer. So to fix that, I just made sure to load an empty array like this

    Code:
    DSB.Stop
    If ResetBuffer Then
        DSB.SetCurrentPosition 0
        ReDim EmptyBuffer(BuffSize * 2 - 1)
        ' The *2 accounts for the entire buffer size, not just the half-buffer size that is stored in the BuffSize variable.
        DSB.WriteBuffer 0, 0, EmptyBuffer(0), DSBLOCK_ENTIREBUFFER
    End If
    DSB is the name I gave the DirectSound Buffer object. By stopping the playback, and then clearing the entire buffer, it should make it so that it completely overwrites the content of the buffer. Unfortunately, this only MOSTLY works. It leaves a tiny amount at the start of the buffer that appears that it can't be overwritten. The next time I start the buffer playing, there is a VERY brief "click" sound at the beginning (about 100 samples or so I would guess, remained untouched by my overwriting the buffer with blank data it seems), and then for about a tenth of a second there's silence (where the buffer was successfully overwritten) and then it starts playing the desired sound.

    Why are a few samples at the start of the buffer untouched by the write operation that I use to try to clear the buffer?
    Last edited by Ben321; Sep 19th, 2015 at 05:41 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width