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

reimar subversion at mplayerhq.hu
Sun Dec 10 23:45:32 CET 2006


Author: reimar
Date: Sun Dec 10 23:45:32 2006
New Revision: 21586

Modified:
   trunk/libao2/ao_openal.c

Log:
OpenAL volume control


Modified: trunk/libao2/ao_openal.c
==============================================================================
--- trunk/libao2/ao_openal.c	(original)
+++ trunk/libao2/ao_openal.c	Sun Dec 10 23:45:32 2006
@@ -51,6 +51,20 @@
 
 
 static int control(int cmd, void *arg) {
+  switch (cmd) {
+    case AOCONTROL_GET_VOLUME:
+    case AOCONTROL_SET_VOLUME: {
+      ALfloat volume;
+      ao_control_vol_t *vol = (ao_control_vol_t *)arg;
+      if (cmd == AOCONTROL_SET_VOLUME) {
+        volume = (vol->left + vol->right) / 200.0;
+        alListenerf(AL_GAIN, volume);
+      }
+      alGetListenerf(AL_GAIN, &volume);
+      vol->left = vol->right = volume * 100;
+      return CONTROL_TRUE;
+    }
+  }
   return CONTROL_UNKNOWN;
 }
 



More information about the MPlayer-cvslog mailing list