[PATCH v2 5/7] winepulse: Simplify IAudioStreamVolume::GetChannelVolume implementation.

Andrew Eikum aeikum at codeweavers.com
Tue May 25 11:53:39 CDT 2021


Signed-off-by: Andrew Eikum <aeikum at codeweavers.com>

On Mon, May 24, 2021 at 06:22:10PM +0200, Jacek Caban wrote:
> 
> Signed-off-by: Jacek Caban <jacek at codeweavers.com>
> ---
>  dlls/winepulse.drv/mmdevdrv.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
> 
> 

> diff --git a/dlls/winepulse.drv/mmdevdrv.c b/dlls/winepulse.drv/mmdevdrv.c
> index 84ab5b6adec..df38bb594c7 100644
> --- a/dlls/winepulse.drv/mmdevdrv.c
> +++ b/dlls/winepulse.drv/mmdevdrv.c
> @@ -1494,21 +1494,21 @@ static HRESULT WINAPI AudioStreamVolume_GetChannelVolume(
>          IAudioStreamVolume *iface, UINT32 index, float *level)
>  {
>      ACImpl *This = impl_from_IAudioStreamVolume(iface);
> -    float volumes[PA_CHANNELS_MAX];
> -    HRESULT hr;
>  
>      TRACE("(%p)->(%d, %p)\n", This, index, level);
>  
>      if (!level)
>          return E_POINTER;
>  
> +    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);
> -    if (SUCCEEDED(hr))
> -        *level = volumes[index];
> -    return hr;
> +    pulse->lock();
> +    *level = This->vol[index];
> +    pulse->unlock();
> +    return S_OK;
>  }
>  
>  static const IAudioStreamVolumeVtbl AudioStreamVolume_Vtbl =
> 




More information about the wine-devel mailing list