summaryrefslogtreecommitdiffstats
path: root/audio
diff options
context:
space:
mode:
Diffstat (limited to 'audio')
-rw-r--r--audio/out/ao_wasapi.c37
-rwxr-xr-xaudio/out/ao_wasapi.h3
-rwxr-xr-xaudio/out/ao_wasapi_utils.c18
3 files changed, 10 insertions, 48 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);
diff --git a/audio/out/ao_wasapi.h b/audio/out/ao_wasapi.h
index 2fbd2d5a9c..c61ba8e4d3 100755
--- a/audio/out/ao_wasapi.h
+++ b/audio/out/ao_wasapi.h
@@ -59,9 +59,6 @@ typedef struct wasapi_state {
/* volume control */
DWORD vol_hw_support;
- float audio_volume;
- float previous_volume;
- float initial_volume;
/* WASAPI handles, owned by audio thread */
IMMDevice *pDevice;
diff --git a/audio/out/ao_wasapi_utils.c b/audio/out/ao_wasapi_utils.c
index 2ffaa31c17..20729b2348 100755
--- a/audio/out/ao_wasapi_utils.c
+++ b/audio/out/ao_wasapi_utils.c
@@ -1057,8 +1057,7 @@ HRESULT wasapi_thread_init(struct ao *ao)
struct wasapi_state *state = ao->priv;
MP_DBG(ao, "Init wasapi thread\n");
int64_t retry_wait = 1;
-retry:
- state->initial_volume = -1.0;
+retry: ;
HRESULT hr = CoCreateInstance(&CLSID_MMDeviceEnumerator, NULL, CLSCTX_ALL,
&IID_IMMDeviceEnumerator, (void **)&state->pEnumerator);
@@ -1122,16 +1121,6 @@ retry:
hr = create_proxies(state);
EXIT_ON_ERROR(hr);
- MP_DBG(ao, "Read volume levels\n");
- if (state->opt_exclusive) {
- IAudioEndpointVolume_GetMasterVolumeLevelScalar(state->pEndpointVolume,
- &state->initial_volume);
- } else {
- ISimpleAudioVolume_GetMasterVolume(state->pAudioVolume,
- &state->initial_volume);
- }
- state->previous_volume = state->initial_volume;
-
wasapi_change_init(ao, false);
MP_DBG(ao, "Init wasapi thread done\n");
@@ -1151,11 +1140,6 @@ void wasapi_thread_uninit(struct ao *ao)
IAudioClient_Stop(state->pAudioClient);
wasapi_change_uninit(ao);
-
- if (state->opt_exclusive && state->pEndpointVolume && state->initial_volume > 0 ) {
- IAudioEndpointVolume_SetMasterVolumeLevelScalar(state->pEndpointVolume,
- state->initial_volume, NULL);
- }
destroy_proxies(state);
SAFE_RELEASE(state->pRenderClient, IAudioRenderClient_Release(state->pRenderClient));