ISound error on 2D sounds

Post your questions, suggestions and experiences regarding game design, integration of external libraries here. For irrEdit, irrXML and irrKlang, see the
ambiera forums
Post Reply
TheC
Posts: 93
Joined: Fri May 05, 2006 7:50 am

ISound error on 2D sounds

Post 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
lonesock
Posts: 9
Joined: Sun Jan 14, 2007 12:54 am
Contact:

Re: ISound error on 2D sounds

Post 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);
lonesock
Piranha are people too.
TheC
Posts: 93
Joined: Fri May 05, 2006 7:50 am

Post by TheC »

Its working now, thanks very much!
Post Reply