Mercurial > mplayer.hg
changeset 21570:a29ae9b13a50
OpenAL volume control
author | reimar |
---|---|
date | Sun, 10 Dec 2006 22:45:32 +0000 |
parents | 685b7a8e6992 |
children | f6881c789312 |
files | libao2/ao_openal.c |
diffstat | 1 files changed, 14 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/libao2/ao_openal.c Sun Dec 10 22:12:48 2006 +0000 +++ b/libao2/ao_openal.c Sun Dec 10 22:45:32 2006 +0000 @@ -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; }