winepulse: Store channel count directly in ACImpl.

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-11 18:30:28 +02:00 committed by Alexandre Julliard
parent 8df72bade5
commit fa097243e0
1 changed files with 10 additions and 9 deletions

View File

@ -148,6 +148,7 @@ struct ACImpl {
LONG ref; LONG ref;
EDataFlow dataflow; EDataFlow dataflow;
UINT32 channel_count;
DWORD flags; DWORD flags;
AUDCLNT_SHAREMODE share; AUDCLNT_SHAREMODE share;
HANDLE event, timer; HANDLE event, timer;
@ -1170,7 +1171,7 @@ static HRESULT pulse_spec_from_waveformat(ACImpl *This, const WAVEFORMATEX *fmt)
WARN("Unhandled tag %x\n", fmt->wFormatTag); WARN("Unhandled tag %x\n", fmt->wFormatTag);
return AUDCLNT_E_UNSUPPORTED_FORMAT; return AUDCLNT_E_UNSUPPORTED_FORMAT;
} }
This->ss.channels = This->map.channels; This->channel_count = This->ss.channels = This->map.channels;
if (!pa_channel_map_valid(&This->map) || This->ss.format == PA_SAMPLE_INVALID) { if (!pa_channel_map_valid(&This->map) || This->ss.format == PA_SAMPLE_INVALID) {
ERR("Invalid format! Channel spec valid: %i, format: %i\n", pa_channel_map_valid(&This->map), This->ss.format); ERR("Invalid format! Channel spec valid: %i, format: %i\n", pa_channel_map_valid(&This->map), This->ss.format);
return AUDCLNT_E_UNSUPPORTED_FORMAT; return AUDCLNT_E_UNSUPPORTED_FORMAT;
@ -2470,7 +2471,7 @@ static HRESULT WINAPI AudioStreamVolume_GetChannelCount(
if (!out) if (!out)
return E_POINTER; return E_POINTER;
*out = This->ss.channels; *out = This->channel_count;
return S_OK; return S_OK;
} }
@ -2492,7 +2493,7 @@ static HRESULT WINAPI AudioStreamVolume_SetAllVolumes(
if (!levels) if (!levels)
return E_POINTER; return E_POINTER;
if (count != This->ss.channels) if (count != This->channel_count)
return E_INVALIDARG; return E_INVALIDARG;
pulse->lock(); pulse->lock();
@ -2520,7 +2521,7 @@ static HRESULT WINAPI AudioStreamVolume_GetAllVolumes(
if (!levels) if (!levels)
return E_POINTER; return E_POINTER;
if (count != This->ss.channels) if (count != This->channel_count)
return E_INVALIDARG; return E_INVALIDARG;
pulse->lock(); pulse->lock();
@ -2548,13 +2549,13 @@ static HRESULT WINAPI AudioStreamVolume_SetChannelVolume(
if (level < 0.f || level > 1.f) if (level < 0.f || level > 1.f)
return E_INVALIDARG; return E_INVALIDARG;
if (index >= This->ss.channels) if (index >= This->channel_count)
return E_INVALIDARG; return E_INVALIDARG;
hr = AudioStreamVolume_GetAllVolumes(iface, This->ss.channels, volumes); hr = AudioStreamVolume_GetAllVolumes(iface, This->channel_count, volumes);
volumes[index] = level; volumes[index] = level;
if (SUCCEEDED(hr)) if (SUCCEEDED(hr))
hr = AudioStreamVolume_SetAllVolumes(iface, This->ss.channels, volumes); hr = AudioStreamVolume_SetAllVolumes(iface, This->channel_count, volumes);
return hr; return hr;
} }
@ -2570,10 +2571,10 @@ static HRESULT WINAPI AudioStreamVolume_GetChannelVolume(
if (!level) if (!level)
return E_POINTER; return E_POINTER;
if (index >= This->ss.channels) if (index >= This->channel_count)
return E_INVALIDARG; return E_INVALIDARG;
hr = AudioStreamVolume_GetAllVolumes(iface, This->ss.channels, volumes); hr = AudioStreamVolume_GetAllVolumes(iface, This->channel_count, volumes);
if (SUCCEEDED(hr)) if (SUCCEEDED(hr))
*level = volumes[index]; *level = volumes[index];
return hr; return hr;