Sign in to follow this  
paulecoyote

[OpenAL] Handling errors, resetting device?

Recommended Posts

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
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;
    };
}



...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.

Share this post


Link to post
Share on other sites
Hmmm do you have an example program and some code to show this problem? I've got my own little Multi-threaded OpenAL app and despite task switching around pretty quickly I havent been able to make it die at all.

It doesnt like being forced to shut down via end process however, it locks up and throws you a 'couldnt shut this program down' box, however as its a console program I'm not shocked about this and frankly if you get to that state with a program it crashing is the least of your worries [grin]

Share this post


Link to post
Share on other sites
Really? Well anyone whom really wants to see it PM me and I'll give them a link.

It's more of me learning then anything else, so it's not code I'm particularly proud of to show and post to the general public.

I'd be interested in any implementations of a free-to-use-no-matter-what openal framework thats already out there... this one I'm building I plan to taylor specifically for ogre.

What I really wanted to know is what happens when OpenAL looses its device for whatever reason - what code if fired and how you handle it.

Share this post


Link to post
Share on other sites
Well, the problem is, I've never managed to make it lose the context... I've got this app streaming two oggs (one per thread) and even with Winamp playing its all pretty solid (if not brain breaking as I try to listen to 3 songs at once, heh), so I'm a bit confused as to how you even lose the context, never mind how to deal with it [grin]

As for a free OpenAL framework, well I'll probably do a sound system based on it at some point under zlib but its a little way off as yet [grin]

Anyways, I'll drop ya a pm and have a shifty at the code...

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this