]> git.mxchange.org Git - simgear.git/blobdiff - simgear/sound/openal_test1.cxx
Rename update() to update_late() for the sound manager to be able to initialize it...
[simgear.git] / simgear / sound / openal_test1.cxx
index 25d551adfef54b04ae9bfc0dad1bae844756c49c..5342ddf199623e1eb00b61b718d92fd81d6de03f 100644 (file)
@@ -20,6 +20,8 @@ static unsigned int sleep(unsigned int secs) { return 0; }
 # include <AL/alut.h>
 #endif
 
+#define AUDIOFILE      SRC_DIR"/jet.wav"
+
 #include <simgear/debug/logstream.hxx>
 
 static void print_openal_error( ALuint error ) {
@@ -95,11 +97,11 @@ int main( int argc, char *argv[] ) {
     ALfloat source_vel[3];
 
     // configuration values
-    ALenum format;
-    ALsizei size;
-    ALvoid* data;
-    ALsizei freq;
-    ALboolean loop;
+//    ALenum format;
+//    ALsizei size;
+//    ALvoid* data;
+//    ALsizei freq;
+    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;
@@ -117,16 +119,16 @@ int main( int argc, char *argv[] ) {
     // Load the sample file
 #if defined(ALUT_API_MAJOR_VERSION) && ALUT_API_MAJOR_VERSION >= 1
 
-  buffer = alutCreateBufferFromFile("jet.wav");
+  buffer = alutCreateBufferFromFile(AUDIOFILE);
   if (buffer == AL_NONE) {
     SG_LOG( SG_GENERAL, SG_ALERT, "Failed to buffer data.");
   }
 
 #else
 # if defined (__APPLE__)
-    alutLoadWAVFile( (ALbyte *)"jet.wav", &format, &data, &size, &freq );
+    alutLoadWAVFile( (ALbyte *)AUDIOFILE, &format, &data, &size, &freq );
 # else
-    alutLoadWAVFile( (ALbyte *)"jet.wav", &format, &data, &size, &freq, &loop );
+    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.");