alGetError() at start of program behavior differs between Windows and Linux

Dan Kegel <[email protected]> Sat, 18 Jun 2011 17:20:36 -0700
Newsgroups gmane.comp.lib.openal
Message-ID <[email protected]>
What should the following program output?

#include <stdio.h>
#include <AL/al.h>
int main(int argc, char **argv)
{
    printf("alGetError() returns %x\n", alGetError());
}

On Linux, it outputs "alGetError() returns a004" (using system gcc and openal).
On Windows, this outputs "alGetError() returns 0".
(I built with cygwin, using the "sdk" at
http://wiki.flightgear.org/index.php?title=MinGW/cross-compiler )

This matters because a closed-source Windows game I'm
trying to run has no sound on Wine unless I hack linux's openal's
alGetError() to return AL_NO_ERROR instead of
AL_INVALID_OPERATION when called with no context set.

Presumably the game does
  alcOpenDevice()
  if (alGetError())
      give up on sound;
and this is clearly against the openal spec, so it's a game bug...

I guess the thing to do is to fudge wine's alGetError() to return
AL_NO_ERROR instead of AL_INVALID_OPERATION,
and/or report the bug to the game developer
and/or report the bug to the developer of Windows OpenAL (whoever they are).
Right?
Or should the Linux OpenAL change to follow the behavior of the Windows one?

Thanks,
Dan

p.s. Here's the hack to Linux's openal that makes the game work on Wine:

--- openal-soft-1.12.854/OpenAL32/alError.c.orig        2011-06-18
16:12:08.499554742 -0700
+++ openal-soft-1.12.854/OpenAL32/alError.c     2011-06-18
16:12:19.163554739 -0700
@@ -30,7 +30,7 @@
    ALenum errorCode;

    Context = GetContextSuspended();
-    if(!Context) return AL_INVALID_OPERATION;
+    if(!Context) return AL_NO_ERROR;

    errorCode = Context->LastError;
    Context->LastError = AL_NO_ERROR;
_______________________________________________
Openal mailing list
[email protected]
http://opensource.creative.com/mailman/listinfo/openal