From b9a66b1bc364c316249a4c11e5499c1c5c29e7a7 Mon Sep 17 00:00:00 2001 From: Andrew Eikum Date: Fri, 6 May 2011 10:34:31 -0500 Subject: [PATCH] winecoreaudio.drv: Store the PropertyScope in ACImpl. --- dlls/winecoreaudio.drv/mmdevdrv.c | 35 +++++++++++++---------------------- 1 file changed, 13 insertions(+), 22 deletions(-) diff --git a/dlls/winecoreaudio.drv/mmdevdrv.c b/dlls/winecoreaudio.drv/mmdevdrv.c index 503b983b647..d5c064dc317 100644 --- a/dlls/winecoreaudio.drv/mmdevdrv.c +++ b/dlls/winecoreaudio.drv/mmdevdrv.c @@ -112,6 +112,7 @@ struct ACImpl { AudioDeviceID adevid; AudioQueueRef aqueue; + AudioObjectPropertyScope scope; HANDLE timer; UINT32 period_ms, bufsize_frames, inbuf_frames, written_frames; UINT64 last_time; @@ -402,6 +403,15 @@ HRESULT WINAPI AUDDRV_GetAudioEndpoint(AudioDeviceID *adevid, IMMDevice *dev, This->dataflow = dataflow; + if(dataflow == eRender) + This->scope = kAudioDevicePropertyScopeOutput; + else if(dataflow == eCapture) + This->scope = kAudioDevicePropertyScopeInput; + else{ + HeapFree(GetProcessHeap(), 0, This); + return E_INVALIDARG; + } + This->lock = 0; This->parent = dev; @@ -872,12 +882,7 @@ static HRESULT ca_get_max_stream_latency(ACImpl *This, UInt32 *max) OSStatus sc; int nstreams, i; - if(This->dataflow == eRender) - addr.mScope = kAudioDevicePropertyScopeOutput; - else if(This->dataflow == eCapture) - addr.mScope = kAudioDevicePropertyScopeInput; - else - return E_UNEXPECTED; + addr.mScope = This->scope; addr.mElement = 0; addr.mSelector = kAudioDevicePropertyStreams; @@ -944,14 +949,7 @@ static HRESULT WINAPI AudioClient_GetStreamLatency(IAudioClient *iface, return AUDCLNT_E_NOT_INITIALIZED; } - if(This->dataflow == eRender) - addr.mScope = kAudioDevicePropertyScopeOutput; - else if(This->dataflow == eCapture) - addr.mScope = kAudioDevicePropertyScopeInput; - else{ - OSSpinLockUnlock(&This->lock); - return E_UNEXPECTED; - } + addr.mScope = This->scope; addr.mSelector = kAudioDevicePropertyLatency; addr.mElement = 0; @@ -1077,14 +1075,7 @@ static HRESULT WINAPI AudioClient_GetMixFormat(IAudioClient *iface, fmt->Format.wFormatTag = WAVE_FORMAT_EXTENSIBLE; - if(This->dataflow == eRender) - addr.mScope = kAudioDevicePropertyScopeOutput; - else if(This->dataflow == eCapture) - addr.mScope = kAudioDevicePropertyScopeInput; - else{ - OSSpinLockUnlock(&This->lock); - return E_UNEXPECTED; - } + addr.mScope = This->scope; addr.mElement = 0; addr.mSelector = kAudioDevicePropertyStreamConfiguration; -- 2.11.4.GIT