mirror of
https://github.com/mpv-player/mpv
synced 2024-12-18 21:06:00 +00:00
ao/openal: Add hardware mute support
While the volume is set on the listener, mute is set on the sound source. Seemed easier that way.
This commit is contained in:
parent
c59ebbe399
commit
abaab930f0
@ -89,6 +89,18 @@ static int control(struct ao *ao, enum aocontrol cmd, void *arg)
|
||||
vol->left = vol->right = volume * 100;
|
||||
return CONTROL_TRUE;
|
||||
}
|
||||
case AOCONTROL_GET_MUTE:
|
||||
case AOCONTROL_SET_MUTE: {
|
||||
bool mute = *(bool *)arg;
|
||||
ALfloat al_mute = (ALfloat)(!mute);
|
||||
if (cmd == AOCONTROL_SET_MUTE) {
|
||||
alSourcef(source, AL_GAIN, al_mute);
|
||||
}
|
||||
alGetSourcef(source, AL_GAIN, &al_mute);
|
||||
*(bool *)arg = !((bool)al_mute);
|
||||
return CONTROL_TRUE;
|
||||
}
|
||||
|
||||
case AOCONTROL_HAS_SOFT_VOLUME:
|
||||
return CONTROL_TRUE;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user