Hi Stuart,
Re: OpenAL sound library
>> (AL_INVALID_VALUE): constructor (alBufferData)>> Fatal error: Failed to
>> buffer data.
I think the ONLY reason you would get this not very helpful specific message is
that the FG/SG is compiled against an ALUT previous to version 1, if it still
exists?, or the header alut.h has NOT been included - see CVS
simgear\sound\sample_openal.cxx, around line 147 and above for later code ...
I had this error and problem, when switching to using OpenAL SDK in native
WIN32, which no longer places the al.h in an AL folder, thus I had to modify
the OpenAL includes, and accidentally also left out <AL/alut.h>, which remains
in an AL folder in the now separate alut source - Simgear library appears to
compile fine without it in this file, but ...
In fact it is maybe better to totally remove this '#else' code completely, and
an #error to abort the compilation. By now several other sub-systems depend in
the sound manager initializing ALUT in the constructor, such that this
'alternate' pre version 1 code no longer works at all, even if you add an
alutInit(), which will get past this particular error, but causes many others
...
Been there, done that ;=))
Attached below is a patch that REMOVES the code trying to support alut earlier
than 1. As can be see it also effects simgear\sound\soundmgr_openal.cxx. The
_FULL_ patch file for my last build, containing this OpenAL patch, is
http://geoffair.net/fg/txt/fgfs-047.patch.txt ...
This patch, extracted from the above full patch, also contains my NEW switch -
USE_OPENAL_SDK - in a few other files as well, to account for the 'new'
location of al.h in the OpenAL SDK, if used.
Hope this helps ...
Regards,
Geoff.
site: http://geoffair.net/fg/ - dedicated to building FG in WIN32
<alut_patch>
diff -ur CVS\SimGear\source\simgear\sound\sample_openal.cxx
Simgear\simgear\sound\sample_openal.cxx
--- CVS\SimGear\source\simgear\sound\sample_openal.cxx Fri Oct 31 15:14:15
2008
+++ Simgear\simgear\sound\sample_openal.cxx Wed Dec 03 13:35:03 2008
@@ -30,7 +30,11 @@
# include <OpenAL/al.h>
# include <OpenAL/alut.h>
#else
+#ifdef USE_OPENAL_SDK
+# include <al.h>
+#else
# include <AL/al.h>
+#endif
# include <AL/alut.h>
#endif
@@ -136,19 +140,8 @@
}
#else
- //
- // pre 1.0 alut version
- //
- ALvoid* data = load_file(path, file);
-
- // Copy data to the internal OpenAL buffer
- alBufferData( buffer, format, data, size, freq );
-
- if ( print_openal_error("constructor (alBufferData)") ) {
- throw sg_exception("Failed to buffer data.");
- }
-
- alutUnloadWAV( format, data, size, freq );
+#pragma message("ERROR: ALUT_API_MAJOR_VERSION not defined, or less than 1!
Has alut.h been included?")
+#error Earlier versions of alut no longer supported by FlightGear
#endif
print_openal_error("constructor return");
diff -ur CVS\SimGear\source\simgear\sound\sample_openal.hxx
Simgear\simgear\sound\sample_openal.hxx
--- CVS\SimGear\source\simgear\sound\sample_openal.hxx Fri Oct 31 15:14:15
2008
+++ Simgear\simgear\sound\sample_openal.hxx Sun Nov 02 16:06:38 2008
@@ -48,8 +48,12 @@
# include <OpenAL/al.h>
# include <OpenAL/alut.h>
#else
+#ifdef USE_OPENAL_SDK
+# include <al.h>
+#else
# include <AL/al.h>
# include <AL/alut.h>
+#endif
#endif
#ifndef HAVE_WINDOWS_H
diff -ur CVS\SimGear\source\simgear\sound\soundmgr_openal.cxx
Simgear\simgear\sound\soundmgr_openal.cxx
--- CVS\SimGear\source\simgear\sound\soundmgr_openal.cxx Wed Sep 10 11:29:08
2008
+++ Simgear\simgear\sound\soundmgr_openal.cxx Wed Dec 03 13:53:28 2008
@@ -33,9 +33,14 @@
# include <OpenAL/al.h>
# include <OpenAL/alc.h>
#else
+#ifdef USE_OPENAL_SDK
+# include <al.h>
+# include <AL/alut.h>
+#else
# include <AL/al.h>
# include <AL/alc.h>
#endif
+#endif
#if defined (__APPLE__)
# ifdef __GNUC__
@@ -104,15 +109,8 @@
context = alcGetCurrentContext();
}
#else
- if ( (dev = alcOpenDevice( NULL )) != NULL
- && ( context = alcCreateContext( dev, NULL )) != NULL ) {
- working = true;
- alcMakeContextCurrent( context );
- } else {
- working = false;
- context = 0;
- SG_LOG( SG_GENERAL, SG_ALERT, "Audio initialization failed!" );
- }
+#pragma message("WARNING: ALUT_API_MAJOR_VERSION not set or less that 1! Has
alut.h been included?")
+#error Earlier versions of alut no longer supported by FlightGear
#endif
listener_pos[0] = 0.0;
diff -ur CVS\SimGear\source\simgear\sound\soundmgr_openal.hxx
Simgear\simgear\sound\soundmgr_openal.hxx
--- CVS\SimGear\source\simgear\sound\soundmgr_openal.hxx Fri Oct 31 15:14:15
2008
+++ Simgear\simgear\sound\soundmgr_openal.hxx Sun Nov 02 16:06:38 2008
@@ -46,8 +46,13 @@
# include <OpenAL/al.h>
# include <OpenAL/alc.h>
#else
+#ifdef USE_OPENAL_SDK
+# include <al.h>
+# include <alc.h>
+#else
# include <AL/al.h>
# include <AL/alc.h>
+#endif
#endif
#include "sample_openal.hxx"
</alut_patch>
full patch: http://geoffair.net/fg/txt/fgfs-047.patch.txt
EOF - alut-01.doc
_________________________________________________________________
Connect to the next generation of MSN Messenger
http://imagine-msn.com/messenger/launch80/default.aspx?locale=en-us&source=wlmailtagline
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel