[MPlayer-cvslog] r21543 - trunk/libao2/ao_openal.c

reimar subversion at mplayerhq.hu
Sat Dec 9 12:45:42 CET 2006


Author: reimar
Date: Sat Dec  9 12:45:41 2006
New Revision: 21543

Modified:
   trunk/libao2/ao_openal.c

Log:
Half-properly set up OpenAL position stuff


Modified: trunk/libao2/ao_openal.c
==============================================================================
--- trunk/libao2/ao_openal.c	(original)
+++ trunk/libao2/ao_openal.c	Sat Dec  9 12:45:41 2006
@@ -60,6 +60,14 @@
 }
 
 static int init(int rate, int channels, int format, int flags) {
+  float position[3] = {0, 0, 0};
+  float direction[6] = {0, 0, 1, 0, 1, 0};
+  float sppos[6][3] = {
+    {-1, 0, 1}, {1, 0, 1},
+    {-1, 0, -1}, {1, 0, -1},
+    {0, 0, 0},
+    {0, 0, 0}
+  };
   ALCdevice *dev = NULL;
   ALCcontext *ctx = NULL;
   ALint bufrate;
@@ -82,13 +90,16 @@
   }
   ctx = alcCreateContext(dev, NULL);
   alcMakeContextCurrent(ctx);
+  alListenerfv(AL_POSITION, position);
+  alListenerfv(AL_ORIENTATION, direction);
+  alGenSources(channels, sources);
   for (i = 0; i < channels; i++) {
     cur_buf[i] = 0;
     unqueue_buf[i] = 0;
     alGenBuffers(NUM_BUF, buffers[i]);
+    alSourcefv(sources[i], AL_POSITION, sppos[i]);
+    alSource3f(sources[i], AL_VELOCITY, 0, 0, 0);
   }
-  alGenSources(channels, sources);
-  alSource3f(sources[0], AL_POSITION, 0, 0, 10);
   ao_data.channels = channels;
   alGetBufferi(buffers[0][0], AL_FREQUENCY, &bufrate);
   ao_data.samplerate = rate = bufrate;



More information about the MPlayer-cvslog mailing list