# include <AL/alut.h>
#endif
+#define AUDIOFILE SRC_DIR"/jet.wav"
+
#include <simgear/debug/logstream.hxx>
static void print_openal_error( ALuint error ) {
ALsizei size;
ALvoid* data;
ALsizei freq;
- ALboolean loop;
+ ALboolean loop = false;
source_pos[0] = 0.0; source_pos[1] = 0.0; source_pos[2] = 0.0;
source_vel[0] = 0.0; source_vel[1] = 0.0; source_vel[2] = 0.0;
}
// Load the sample file
-#if defined (__APPLE__)
- alutLoadWAVFile( (ALbyte *)"jet.wav", &format, &data, &size, &freq );
+#if defined(ALUT_API_MAJOR_VERSION) && ALUT_API_MAJOR_VERSION >= 1
+
+ buffer = alutCreateBufferFromFile(AUDIOFILE);
+ if (buffer == AL_NONE) {
+ SG_LOG( SG_GENERAL, SG_ALERT, "Failed to buffer data.");
+ }
+
#else
- alutLoadWAVFile( (ALbyte *)"jet.wav", &format, &data, &size, &freq, &loop );
-#endif
+# if defined (__APPLE__)
+ alutLoadWAVFile( (ALbyte *)AUDIOFILE, &format, &data, &size, &freq );
+# else
+ alutLoadWAVFile( (ALbyte *)AUDIOFILE, &format, &data, &size, &freq, &loop );
+# endif
if (alGetError() != AL_NO_ERROR) {
SG_LOG( SG_GENERAL, SG_ALERT, "Failed to load wav file.");
}
}
alutUnloadWAV( format, data, size, freq );
+#endif
alGenSources(1, &source);
if (alGetError() != AL_NO_ERROR) {