OpenAL volume control

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@21586 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
reimar 2006-12-10 22:45:32 +00:00
parent f13de61088
commit cbb2590c88
1 changed files with 14 additions and 0 deletions

View File

@ -51,6 +51,20 @@ static int16_t *tmpbuf;
static int control(int cmd, void *arg) { 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; return CONTROL_UNKNOWN;
} }