On my AMD64 system (ubuntu), including the attached patch enabled
vegastrike to load, and play OpenAL sounds. The functions that have
been removed are deprecated in the new version of FreeALUT. I did not
examine the MP3 loading code: changes only to the WAV file handling
was sufficient for me to return to play.
--
Emmet HIKORY
diff -ruN vegastrike-0.4.3.dist/src/aldrv/al_init.cpp vegastrike-0.4.3/src/aldrv/al_init.cpp
--- vegastrike-0.4.3.dist/src/aldrv/al_init.cpp 2006-05-13 21:50:52.000000000 +0900
+++ vegastrike-0.4.3/src/aldrv/al_init.cpp 2006-05-14 00:25:24.000000000 +0900
@@ -168,6 +168,7 @@
}
/* Initialize ALUT. */
+ alutInitWithoutContext ( 0, NULL);
context_id = alcCreateContext( dev, attrlist );
if(context_id == NULL) {
alcCloseDevice( dev );
diff -ruN vegastrike-0.4.3.dist/src/aldrv/al_sound.cpp vegastrike-0.4.3/src/aldrv/al_sound.cpp
--- vegastrike-0.4.3.dist/src/aldrv/al_sound.cpp 2005-01-08 10:25:32.000000000 +0900
+++ vegastrike-0.4.3/src/aldrv/al_sound.cpp 2006-05-14 00:25:24.000000000 +0900
@@ -315,43 +315,12 @@
#ifdef SOUND_DEBUG
printf ("Sound %s created with and alBuffer %d\n",s.c_str(),*wavbuf);
#endif
- ALsizei size;
- ALsizei freq;
- void *wave;
- ALboolean looping;
- ALboolean err=AL_TRUE;
- vector <char> dat;
- dat.resize(f.Size());
- f.Read( &dat[0], f.Size());
- ConvertFormat(dat);
- if (dat.size()==0)//conversion messed up
- return -1;
-#ifndef WIN32
-#ifdef __APPLE__
- ALint format;
- // MAC OS X
- err = false;
- if( error<=Ok)
- err=MacFixedLoadWAVFile( &dat[0], &format, &wave, &size, &freq);
-#else
- // LINUX
- ALsizei format;
- alutLoadWAVMemory((ALbyte *)&dat[0], &format, &wave, &size, &freq, &looping);
-#endif
-#else
- ALint format;
- // WIN32
- alutLoadWAVMemory(&dat[0], (int*)&format, &wave, &size, &freq, &looping);
-#endif
+ char* WAVdata = (char *)malloc (f.Size());
+ int WAVsize = f.Read( WAVdata, f.Size());
+
+ *wavbuf = alutCreateBufferFromFileImage(WAVdata, WAVsize);
+ free (WAVdata);
- if(err == AL_FALSE)
- {
- alDeleteBuffers (1,wavbuf);
- free (wavbuf);
- return -1;
- }
- alBufferData( *wavbuf, format, wave, size, freq );
- alutUnloadWAV(format,wave,size,freq);
if (!music)
{
soundHash.Put (hashname,wavbuf);