[PATCH v2 4/7] winepulse: Simplify IAudioStreamVolume::SetChannelVolume implementation.
Andrew Eikum
aeikum at codeweavers.com
Tue May 25 11:53:27 CDT 2021
Signed-off-by: Andrew Eikum <aeikum at codeweavers.com>
On Mon, May 24, 2021 at 06:22:02PM +0200, Jacek Caban wrote:
>
> Signed-off-by: Jacek Caban <jacek at codeweavers.com>
> ---
> dlls/winepulse.drv/mmdevdrv.c | 14 +++++++-------
> 1 file changed, 7 insertions(+), 7 deletions(-)
>
>
> diff --git a/dlls/winepulse.drv/mmdevdrv.c b/dlls/winepulse.drv/mmdevdrv.c
> index cac169567ea..84ab5b6adec 100644
> --- a/dlls/winepulse.drv/mmdevdrv.c
> +++ b/dlls/winepulse.drv/mmdevdrv.c
> @@ -1472,22 +1472,22 @@ static HRESULT WINAPI AudioStreamVolume_SetChannelVolume(
> IAudioStreamVolume *iface, UINT32 index, float level)
> {
> ACImpl *This = impl_from_IAudioStreamVolume(iface);
> - HRESULT hr;
> - float volumes[PA_CHANNELS_MAX];
>
> TRACE("(%p)->(%d, %f)\n", This, index, level);
>
> if (level < 0.f || level > 1.f)
> return E_INVALIDARG;
>
> + if (!This->pulse_stream)
> + return AUDCLNT_E_NOT_INITIALIZED;
> if (index >= This->channel_count)
> return E_INVALIDARG;
>
> - hr = AudioStreamVolume_GetAllVolumes(iface, This->channel_count, volumes);
> - volumes[index] = level;
> - if (SUCCEEDED(hr))
> - hr = AudioStreamVolume_SetAllVolumes(iface, This->channel_count, volumes);
> - return hr;
> + pulse->lock();
> + This->vol[index] = level;
> + set_stream_volumes(This);
> + pulse->unlock();
> + return S_OK;
> }
>
> static HRESULT WINAPI AudioStreamVolume_GetChannelVolume(
>
More information about the wine-devel
mailing list