winepulse: Simplify IAudioStreamVolume::GetChannelVolume 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>
This commit is contained in:
Jacek Caban 2021-05-24 18:22:10 +02:00 committed by Alexandre Julliard
parent 6a6296562f
commit 4432b66e37
1 changed files with 6 additions and 6 deletions

View File

@ -1494,21 +1494,21 @@ static HRESULT WINAPI AudioStreamVolume_GetChannelVolume(
IAudioStreamVolume *iface, UINT32 index, float *level) IAudioStreamVolume *iface, UINT32 index, float *level)
{ {
ACImpl *This = impl_from_IAudioStreamVolume(iface); ACImpl *This = impl_from_IAudioStreamVolume(iface);
float volumes[PA_CHANNELS_MAX];
HRESULT hr;
TRACE("(%p)->(%d, %p)\n", This, index, level); TRACE("(%p)->(%d, %p)\n", This, index, level);
if (!level) if (!level)
return E_POINTER; return E_POINTER;
if (!This->pulse_stream)
return AUDCLNT_E_NOT_INITIALIZED;
if (index >= This->channel_count) if (index >= This->channel_count)
return E_INVALIDARG; return E_INVALIDARG;
hr = AudioStreamVolume_GetAllVolumes(iface, This->channel_count, volumes); pulse->lock();
if (SUCCEEDED(hr)) *level = This->vol[index];
*level = volumes[index]; pulse->unlock();
return hr; return S_OK;
} }
static const IAudioStreamVolumeVtbl AudioStreamVolume_Vtbl = static const IAudioStreamVolumeVtbl AudioStreamVolume_Vtbl =