summaryrefslogtreecommitdiffstats
path: root/audio/out/ao_wasapi.c
diff options
context:
space:
mode:
authorKevin Mitchell <kevmitch@gmail.com>2015-12-18 21:11:42 -0800
committerKevin Mitchell <kevmitch@gmail.com>2015-12-20 03:30:28 -0800
commitd1cbff37be885108808c27311d79422dc0cb4a7f (patch)
treed87fef09e7d0f8cf9e5e77acea8c43995302b093 /audio/out/ao_wasapi.c
parentaa5f04c7a0b1f809f47a3aef48654a9b8788e8cb (diff)
downloadmpv-d1cbff37be885108808c27311d79422dc0cb4a7f.tar.bz2
mpv-d1cbff37be885108808c27311d79422dc0cb4a7f.tar.xz
ao_wasapi: remove volume "restore" on exit
It was complicated and not even very intuitive to the user. If you are controlling the master volume, you just have to be prepared to deal with the consequences.
Diffstat (limited to 'audio/out/ao_wasapi.c')
-rw-r--r--audio/out/ao_wasapi.c37
1 files changed, 9 insertions, 28 deletions
diff --git a/audio/out/ao_wasapi.c b/audio/out/ao_wasapi.c
index 5b4cb20335..2b2cd890c9 100644
--- a/audio/out/ao_wasapi.c
+++ b/audio/out/ao_wasapi.c
@@ -288,6 +288,7 @@ static int control(struct ao *ao, enum aocontrol cmd, void *arg)
{
struct wasapi_state *state = ao->priv;
ao_control_vol_t *vol = arg;
+ float volume;
BOOL mute;
if (state->opt_exclusive) {
@@ -295,22 +296,13 @@ static int control(struct ao *ao, enum aocontrol cmd, void *arg)
switch (cmd) {
case AOCONTROL_GET_VOLUME:
IAudioEndpointVolume_GetMasterVolumeLevelScalar(state->pEndpointVolumeProxy,
- &state->audio_volume);
- /* check to see if user manually changed volume through mixer;
- this information is used in exclusive mode for restoring the mixer volume on uninit */
- if (state->audio_volume != state->previous_volume) {
- MP_VERBOSE(state, "Mixer difference: %.2g now, expected %.2g\n",
- state->audio_volume, state->previous_volume);
- state->initial_volume = state->audio_volume;
- }
-
- vol->left = vol->right = 100.0f * state->audio_volume;
+ &volume);
+ vol->left = vol->right = 100.0f * volume;
return CONTROL_OK;
case AOCONTROL_SET_VOLUME:
- state->audio_volume = vol->left / 100.f;
+ volume = vol->left / 100.f;
IAudioEndpointVolume_SetMasterVolumeLevelScalar(state->pEndpointVolumeProxy,
- state->audio_volume, NULL);
- state->previous_volume = state->audio_volume;
+ volume, NULL);
return CONTROL_OK;
case AOCONTROL_GET_MUTE:
IAudioEndpointVolume_GetMute(state->pEndpointVolumeProxy, &mute);
@@ -328,24 +320,13 @@ static int control(struct ao *ao, enum aocontrol cmd, void *arg)
switch (cmd) {
case AOCONTROL_GET_VOLUME:
ISimpleAudioVolume_GetMasterVolume(state->pAudioVolumeProxy,
- &state->audio_volume);
-
- /* check to see if user manually changed volume through mixer;
- this information is used in exclusive mode for restoring the mixer volume on uninit */
- if (state->audio_volume != state->previous_volume) {
- MP_VERBOSE(state, "Mixer difference: %.2g now, expected %.2g\n",
- state->audio_volume, state->previous_volume);
- state->initial_volume = state->audio_volume;
- }
-
- vol->left = vol->right = 100.0f * state->audio_volume;
+ &volume);
+ vol->left = vol->right = 100.0f * volume;
return CONTROL_OK;
case AOCONTROL_SET_VOLUME:
- state->audio_volume = vol->left / 100.f;
+ volume = vol->left / 100.f;
ISimpleAudioVolume_SetMasterVolume(state->pAudioVolumeProxy,
- state->audio_volume, NULL);
-
- state->previous_volume = state->audio_volume;
+ volume, NULL);
return CONTROL_OK;
case AOCONTROL_GET_MUTE:
ISimpleAudioVolume_GetMute(state->pAudioVolumeProxy, &mute);