From 4b81398b4e1d66fece109aaa1d5a7422462ceee5 Mon Sep 17 00:00:00 2001 From: Kevin Mitchell Date: Fri, 18 Dec 2015 21:24:44 -0800 Subject: ao_wasapi: don't cast control arg to something it isn't the ao_control_vol_t cast was happening outside AOCONTROL_GET/SET_VOLUME which is the only place that would be valid --- audio/out/ao_wasapi.c | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) (limited to 'audio') diff --git a/audio/out/ao_wasapi.c b/audio/out/ao_wasapi.c index 2b2cd890c9..2fc3c0a9a7 100644 --- a/audio/out/ao_wasapi.c +++ b/audio/out/ao_wasapi.c @@ -287,7 +287,6 @@ static int init(struct ao *ao) 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; @@ -297,19 +296,22 @@ static int control(struct ao *ao, enum aocontrol cmd, void *arg) case AOCONTROL_GET_VOLUME: IAudioEndpointVolume_GetMasterVolumeLevelScalar(state->pEndpointVolumeProxy, &volume); - vol->left = vol->right = 100.0f * volume; + *(ao_control_vol_t *)arg = (ao_control_vol_t){ + .left = 100.0f * volume, + .right = 100.0f * volume, + }; return CONTROL_OK; case AOCONTROL_SET_VOLUME: - volume = vol->left / 100.f; + volume = ((ao_control_vol_t *)arg)->left / 100.f; IAudioEndpointVolume_SetMasterVolumeLevelScalar(state->pEndpointVolumeProxy, volume, NULL); return CONTROL_OK; case AOCONTROL_GET_MUTE: IAudioEndpointVolume_GetMute(state->pEndpointVolumeProxy, &mute); - *(bool*)arg = mute; + *(bool *)arg = mute; return CONTROL_OK; case AOCONTROL_SET_MUTE: - mute = *(bool*)arg; + mute = *(bool *)arg; IAudioEndpointVolume_SetMute(state->pEndpointVolumeProxy, mute, NULL); return CONTROL_OK; case AOCONTROL_HAS_PER_APP_VOLUME: @@ -321,19 +323,22 @@ static int control(struct ao *ao, enum aocontrol cmd, void *arg) case AOCONTROL_GET_VOLUME: ISimpleAudioVolume_GetMasterVolume(state->pAudioVolumeProxy, &volume); - vol->left = vol->right = 100.0f * volume; + *(ao_control_vol_t *)arg = (ao_control_vol_t){ + .left = 100.0f * volume, + .right = 100.0f * volume, + }; return CONTROL_OK; case AOCONTROL_SET_VOLUME: - volume = vol->left / 100.f; + volume = ((ao_control_vol_t *)arg)->left / 100.f; ISimpleAudioVolume_SetMasterVolume(state->pAudioVolumeProxy, volume, NULL); return CONTROL_OK; case AOCONTROL_GET_MUTE: ISimpleAudioVolume_GetMute(state->pAudioVolumeProxy, &mute); - *(bool*)arg = mute; + *(bool *)arg = mute; return CONTROL_OK; case AOCONTROL_SET_MUTE: - mute = *(bool*)arg; + mute = *(bool *)arg; ISimpleAudioVolume_SetMute(state->pAudioVolumeProxy, mute, NULL); return CONTROL_OK; case AOCONTROL_HAS_PER_APP_VOLUME: -- cgit v1.2.3