Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Playsound problem

I'm using MS Visual C++. I play several sounds in series using the playsound function. The length of series vary--about 4 to 11 seconds. My problem is that if I play a shorter series of sounds following a longer series, after the shorter one completes then some trailing sounds from the longer series are played. It's as if the short series overwrites the beginning of the longer series but leaves anything longer in the buffer. Does anybody know how I can prevent this or clear out the sound buffer (wherever that is) before starting a new set of sounds?

I call playsound in a loop to play a series of files from a list. My playsound call looks like this:

PlaySound(FilePathName, NULL, SND_SYNC | SND_FILENAME | SND_NODEFAULT)

Comments

  • MT2002MT2002 Member Posts: 1,444
    Have you tried stopping the songs when they complete?

    I don't think the sound buffer is the problem. It just sounds like you are hearing the longer songs continue playing after the short song does...

    [hr][size=1][leftbr].:EvolutionEngine[rightbr][leftbr].:MicroOS Operating System[rightbr][leftbr][link=http://www.mt2002.sitesled.com]Website :: OS Development Series[rightbr][/link][/size]
  • katmankatman Member Posts: 24
    Thanks. Hrmm, since I'm playing syncronous, pgm waits until the sound stops (on its own). I maybe could try computing the duration and then SND_PURGE when my intended sound is done, but that's not a pretty solution :-)

    I agree in that I don't think it makes any sense that it's a buffer problem. So I'm scratching my head. I created some pure-tone wave files. I don't see the problem with them. So I'm going to try a variety of these and other sound files and try some debugging to get a better handle on what's going on. Any other suggestions would be appreciated.

    : Have you tried stopping the songs when they complete?
    :
    : I don't think the sound buffer is the problem. It just sounds like
    : you are hearing the longer songs continue playing after the short
    : song does...
    :
    : [hr][size=1][leftbr].:EvolutionEngine[rightbr][leftbr].:MicroOS
    : Operating
    : System[rightbr][leftbr][link=http://www.mt2002.sitesled.com]Website
    : :: OS Development Series[rightbr][/link][/size]
    :
Sign In or Register to comment.