Page 1 of 1

PlaySound weird slowdown issue?

Posted: Mon Jun 08, 2009 5:57 am
by dracflamloc
Hey guys. I've not been here in a while but I've started messing with a new project in Pb. I've been having an issue with my game not working right once a sound is played.

Could someone confirm for me that they experience the same result with this program:
http://www.dracsoft.com/zips/2ds.zip

Run the game, use WSAD to move around. Note the speed you move. Now left-click to fire, or right-click to reload and thus cause a sound effect to play. The sound plays fine, but all of a sudden the movement speed is practically zero.

The yellow AI players stop moving at the right speed too.

This does *not* happen when I change:

Code: Select all

Procedure PlaySFX(sfx.l, loop.b = 0)
  If IsSound(sfx)
    If loop=1
      PlaySound(sfx,#PB_Sound_Loop)
    Else
      PlaySound(sfx)
    EndIf 
  EndIf 
EndProcedure
To this:

Code: Select all

Procedure PlaySFX(sfx.l, loop.b = 0)
  If IsSound(sfx)
    If loop=1
      ;PlaySound(sfx,#PB_Sound_Loop)
    Else
      ;PlaySound(sfx)
    EndIf 
  EndIf 
EndProcedure
With those two lines commented out, the player does not slow down, and all is normal, (except no sounds).

Posted: Mon Jun 08, 2009 8:24 am
by djes
Had this with VIA chipset. Be sure to use the correct frequency of your sound (generally 44100Hz), and not more.

Posted: Mon Jun 08, 2009 12:50 pm
by Demivec
@dracflamloc: there is no delay when a sound is played for me. Win XP SP3 (x86) Realtek AC'97 audio .

Posted: Mon Jun 08, 2009 1:09 pm
by djes
It was an old chipset ;)
It's a known bug, I hang around some days to find it...

Posted: Mon Jun 08, 2009 2:00 pm
by dracflamloc
Thanks guys, I'll try that out