Original Post
Hi there, I've been looking through and adapting tutorials from http://www.devmaster.net/articles.php?catID=6 but they do not seem to be very, erm, robust. Lesson 8 I'm using to stream an ogg file, as the OpenAL ogg extension refuses to believe it is present - but that's a whole different issue - don't let that distract from the rest of the post. I can consistantly make examples as is, and my stuff throw exceptions by ctrl+alt+del and running task manager (win 2k) - but I imagine there are other ways of doing it. I believe it's because OpenAL is loosing control of the device - and that things probably have to be reinitalised and stuff - just as if you loose a graphics device with directx or whatever. From http://www.devmaster.net/articles/openal-tutorials/lesson6.php ...is kind of helpful but it just starts spitting out AL_INVALID_VALUE on creating that error, which is not that helpful. I think I've also made it cause other exceptions without error codes by screwing about with ctl+alt+del and other unfriendly activities (rapidly switching between apps, etc). What I want to know is, from people with experience with this - is there a good way of reacting to an error - eg tearing things down and putting them up again as you would a directx device? And which error do you do that on? To others please respect my platform choice... yes I know FMOD is out there but I don't like the licence, I might consider DirectSound but would prefer to try and keep things easily ported across platforms - hence OpenAL - because everything else in this game project thus far is. Though I am willing to other consider free to use for any purpose stuff.
string GetALErrorString(ALenum err)
{
switch(err)
{
case AL_NO_ERROR:
return string("AL_NO_ERROR");
break;
case AL_INVALID_NAME:
return string("AL_INVALID_NAME");
break;
case AL_INVALID_ENUM:
return string("AL_INVALID_ENUM");
break;
case AL_INVALID_VALUE:
return string("AL_INVALID_VALUE");
break;
case AL_INVALID_OPERATION:
return string("AL_INVALID_OPERATION");
break;
case AL_OUT_OF_MEMORY:
return string("AL_OUT_OF_MEMORY");
break;
};
}