Page 1 of 1

ISound error on 2D sounds

Posted: Tue Mar 06, 2007 10:23 pm
by TheC
Hi,

If I use the following code:

Code: Select all

ISound* S = engine->play2D(MySoundSource);
S->setIsPaused(true);
My application crashes (corrupt pointer style). The value returned is actually 0.

You can replicate this by just using one of the examples. It doesn't seem to happen with 3D sounds

Re: ISound error on 2D sounds

Posted: Wed Mar 07, 2007 1:11 am
by lonesock
unless you start the sound paused or specify that you want to track it, no pointer is returned (this is so you don't have to worry about sounds if you don't want to). So your code should look like:

Code: Select all

ISound* S = engine->play2D(MySoundSource, false, true);
S->setIsPaused(true);
note that this will start your sound paused already. If you want to start right away, but still want to track it, do the following:

Code: Select all

ISound* S = engine->play2D(MySoundSource, false, false, true);
S->setIsPaused(true);

Posted: Wed Mar 07, 2007 7:07 pm
by TheC
Its working now, thanks very much!