[solved]Sound playing delayed

deshan

12-12-2010 14:43:28

Hi sticky/all,

I found a problem of delay in sound play.
Previously it played just after i call play.

And now I enabled boost and it takes time to play. The delay is around 2 seconds.

Have you faced similar kind of issue? If yes, any solution?

Thanks

~deshan

stickymango

13-12-2010 10:23:38

Hi deshan,

This is by design, are you trying to create a static sound as that seems a long delay?

I'd suggest preloading your sounds rather then creating and playing immediately, otherwise you could try using a streaming sound, that should be pretty instant..

If you still need to do things this way you should be able to use a listener callback to track when the sound has loaded then continue your main loop..

HTH

deshan

16-12-2010 15:46:25

Sorry for the late reply.

Thanks for the reply sticky,

If you still need to do things this way you should be able to use a listener callback to track when the sound has loaded then continue your main loop..

Above way seems to be convinient at the moment

BTW I didn't manage to find lister callback way. So what I have done is this.
while(true)
{
if(menuStateSound->getMenuStateBackGroundSound()->isPlaying())
break;
}


Any other way of doing this?

Thanks

deshan

stickymango

16-12-2010 16:01:26

Hi deshan,

derive a class from OgreOggISound::SoundListener and override either soundLoaded() / soundPlayed() functions to be notified of said events, attach your listener using OgreOggISound::setListener().

deshan

17-12-2010 18:19:24

Hi Sticky,

Solution works like a charm.

Thank you very much.

deshan