summaryrefslogtreecommitdiffstats
path: root/libao2/ao_openal.c
diff options
context:
space:
mode:
authorreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2006-12-10 22:45:32 +0000
committerreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2006-12-10 22:45:32 +0000
commitcbb2590c883ed93f0b26885d840572dbadb2fbd1 (patch)
tree9109d3a8a5779c72fd80b336d60480c6b7fb5b56 /libao2/ao_openal.c
parentf13de610886b6c89e996742b5374389925c32af3 (diff)
downloadmpv-cbb2590c883ed93f0b26885d840572dbadb2fbd1.tar.bz2
mpv-cbb2590c883ed93f0b26885d840572dbadb2fbd1.tar.xz
OpenAL volume control
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@21586 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libao2/ao_openal.c')
-rw-r--r--libao2/ao_openal.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/libao2/ao_openal.c b/libao2/ao_openal.c
index bc2219c1ea..9319a5f005 100644
--- a/libao2/ao_openal.c
+++ b/libao2/ao_openal.c
@@ -51,6 +51,20 @@ static int16_t *tmpbuf;
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;
}