OgreAL crashing on shutdown

frier

04-11-2007 13:05:59

Hi,

Im getting a crash on OgreAL shutdown:

if(mSoundManager){
delete mSoundManager;
mSoundManager = 0;
}



Crashes here:

void Sound::checkError(const Ogre::String& source) const
{
int error = alGetError();

if(error != AL_NO_ERROR)
{
throw Ogre::Exception(3, "OpenAL Error: " + errorToString(error), source);
}
}


It seems to only crash when i hold a reference of a stl::Map<string,sound> of sounds in a class.

ERROR:

Unhandled exception at 0x7c812a5b in Crawlers.exe: Microsoft C++ exception: Ogre::Exception at memory location 0x0012ee74..

i know it has something to do with this reference i'm holding, but not sure why its crashing? works fine when i remove the reference.

Another Question:

I need to have separate ambient sounds through out different states in my game, how do you guys achieve this? i was thinking of making some sort of singleton class that allows me to change the background music, in any state i will be in. How else can it be done?

-FrieR

CaseyB

04-11-2007 15:58:44

Firstly, try doing an update, I have cleaned up the shutdown process a good bit, and see if you still have the crash.

Secondly, do you have a class that is responsible for the changing of gamestates? You could load the ambient sounds and then just stop or play them from the code that handles the state change. The SoundManager is already a singleton, so you could use it directly.

frier

05-11-2007 12:12:33

Hey Casey,

Still getting a crash on shutdown with new OgreAL. Though i noticed it doesnt happen on other PC's, i should double check that.

19:03:25: ********************************
19:03:25: *-*-* OgreAL Initialization
19:03:25: MovableObjectFactory for type 'OgreAL_Sound' registered.
19:03:25: MovableObjectFactory for type 'OgreAL_Listener' registered.
19:03:25: *-*-* Creating OpenAL
19:03:26: OpenAL Devices: SB X-Fi Audio [8C00], Generic Hardware, Generic Software,
19:03:26: Choosing: SB X-Fi Audio [8C00]
19:03:26: Supported Formats
19:03:26: -----------------
19:03:26: EAX 5.0 Detected

CaseyB

05-11-2007 16:33:35

So, it's only crashing on shutdown? That's odd because according to the log it's not finding any appropriate audio formats. Can you post the next couple of lines from the log as well as the part where OgreAL shuts down?

frier

06-11-2007 00:38:26

Hey Casey,

seems to work fine now, i fiddled with some stuff, (i forget what) and it doesn''t crash any more. If it comes back ill have to look at it further.

Thanks for your help!, ill be back with more questions, i'm quite liking your wrapper!

CaseyB

06-11-2007 01:24:15

Thanks for your help!, ill be back with more questions, i'm quite liking your wrapper!
Not a problem! Glad you like it!! :D

frier

06-11-2007 13:29:00

Hi Casey i'm back! :S

it seems i only get the error on my computer! other two computers i used work and shutdown fine:

00:24:29: OGRE EXCEPTION(40964:): Failed to unqueue Buffers: OpenAL Error: the requested operation is not valid in OgreAL::Sound::emptyQueues

It only errors if im accelerating and its applying pitch to the motor noise, and i hit quit at the same time. This isnt a big deal at all because players wont be quiting like that mid game, i dont think anyways. But just a heads up..

Also!

I found when i upgraded my OgreAL to the SVN, the pitch noise sounds different?

CaseyB

07-11-2007 04:37:52

Hmm, that's weird that it would only be on your machine! I have been doing a LOT of changing around over the last couple of days, so I may have fixed the problem. I don't know exactly what it might have been, but I have been focusing a lot on making everything more stable, so I hope it has gone away. I still have one more kink to work out and then I'll do a commit and post a note in the update thread.