changeset 21527:9b228834e07b

Half-properly set up OpenAL position stuff
author reimar
date Sat, 09 Dec 2006 11:45:41 +0000
parents 60a39d71e247
children 370b8d95356b
files libao2/ao_openal.c
diffstat 1 files changed, 13 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/libao2/ao_openal.c	Sat Dec 09 10:34:27 2006 +0000
+++ b/libao2/ao_openal.c	Sat Dec 09 11:45:41 2006 +0000
@@ -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;