Module: wine Branch: master Commit: 6a6296562f536ed10d221f0df43ef30bbd674cb2 URL: https://source.winehq.org/git/wine.git/?a=commit;h=6a6296562f536ed10d221f0df...
Author: Jacek Caban jacek@codeweavers.com Date: Mon May 24 18:22:02 2021 +0200
winepulse: Simplify IAudioStreamVolume::SetChannelVolume implementation.
Signed-off-by: Jacek Caban jacek@codeweavers.com Signed-off-by: Andrew Eikum aeikum@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
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(