dsound: Small fixes to IDirectSoundCaptureBuffer

Andrew Eikum aeikum at codeweavers.com
Mon Feb 27 07:58:58 CST 2012


This patch looks sane and fixes the tests on my machine, but causes no
changes to dsound capture behavior in Audacity. I don't have much of
an opinion on if it should go in for 1.4.

On Tue, Feb 21, 2012 at 05:33:35PM +0100, Maarten Lankhorst wrote:
> ---
> I suspect a lot more AUDCLNT_E_* calls will have to be mapped
> correctly, but at least this is enough to pass the dsound:capture
> tests again on wine.
> 
>  dlls/dsound/capture.c       |    8 +++++---
>  dlls/dsound/tests/capture.c |   24 +++++++++++++++---------
>  2 files changed, 20 insertions(+), 12 deletions(-)
> 
> diff --git a/dlls/dsound/capture.c b/dlls/dsound/capture.c
> index 90cddb7..7ceddfc 100644
> --- a/dlls/dsound/capture.c
> +++ b/dlls/dsound/capture.c
> @@ -456,13 +456,14 @@ static HRESULT WINAPI IDirectSoundCaptureBufferImpl_Start(IDirectSoundCaptureBuf
>  
>      EnterCriticalSection(&(This->device->lock));
>  
> -    This->flags = dwFlags;
> -    TRACE("old This->device->state=%s\n",captureStateString[This->device->state]);
>      if (This->device->state == STATE_STOPPED)
>          This->device->state = STATE_STARTING;
>      else if (This->device->state == STATE_STOPPING)
>          This->device->state = STATE_CAPTURING;
> +    else
> +        goto out;
>      TRACE("new This->device->state=%s\n",captureStateString[This->device->state]);
> +    This->flags = dwFlags;
>  
>      if (This->device->buffer)
>          FillMemory(This->device->buffer, This->device->buflen, (This->device->pwfx->wBitsPerSample == 8) ? 128 : 0);
> @@ -474,6 +475,7 @@ static HRESULT WINAPI IDirectSoundCaptureBufferImpl_Start(IDirectSoundCaptureBuf
>          return hres;
>      }
>  
> +out:
>      LeaveCriticalSection(&This->device->lock);
>  
>      TRACE("returning DS_OK\n");
> @@ -705,7 +707,7 @@ static HRESULT IDirectSoundCaptureBufferImpl_Create(
>              HeapFree(GetProcessHeap(), 0, This->pdscbd);
>              This->device->capture_buffer = 0;
>              HeapFree( GetProcessHeap(), 0, This );
> -            return err;
> +            return err == AUDCLNT_E_UNSUPPORTED_FORMAT ? DSERR_BADFORMAT : err;
>          }
>  
>          err = IAudioClient_GetService(device->client, &IID_IAudioCaptureClient,
> diff --git a/dlls/dsound/tests/capture.c b/dlls/dsound/tests/capture.c
> index 96fb417..2040f3f 100644
> --- a/dlls/dsound/tests/capture.c
> +++ b/dlls/dsound/tests/capture.c
> @@ -393,15 +393,18 @@ static void test_capture_buffer(LPDIRECTSOUNDCAPTURE dsco,
>      ok(ref==0,"IDirectSoundNotify_Release(): has %d references, should have "
>         "0\n",ref);
>  
> -    if (record) {
> -	rc=IDirectSoundCaptureBuffer_Start(dscbo,DSCBSTART_LOOPING);
> -	ok(rc==DS_OK,"IDirectSoundCaptureBuffer_Start() failed: %08x\n", rc);
> +    rc=IDirectSoundCaptureBuffer_Start(dscbo,DSCBSTART_LOOPING);
> +    ok(rc==DS_OK,"IDirectSoundCaptureBuffer_Start() failed: %08x\n", rc);
> +
> +    rc=IDirectSoundCaptureBuffer_Start(dscbo,0);
> +    ok(rc==DS_OK,"IDirectSoundCaptureBuffer_Start() failed: %08x\n", rc);
>  
> -	rc=IDirectSoundCaptureBuffer_GetStatus(dscbo,&status);
> -	ok(rc==DS_OK,"IDirectSoundCaptureBuffer_GetStatus() failed: %08x\n", rc);
> -	ok(status==(DSCBSTATUS_CAPTURING|DSCBSTATUS_LOOPING),
> -           "GetStatus: bad status: %x\n",status);
> +    rc=IDirectSoundCaptureBuffer_GetStatus(dscbo,&status);
> +    ok(rc==DS_OK,"IDirectSoundCaptureBuffer_GetStatus() failed: %08x\n", rc);
> +    ok(status==(DSCBSTATUS_CAPTURING|DSCBSTATUS_LOOPING),
> +       "GetStatus: bad status: %x\n",status);
>  
> +    if (record) {
>  	/* wait for the notifications */
>  	for (i = 0; i < (NOTIFICATIONS * 2); i++) {
>  	    rc=WaitForMultipleObjects(NOTIFICATIONS,state.event,FALSE,3000);
> @@ -416,9 +419,12 @@ static void test_capture_buffer(LPDIRECTSOUNDCAPTURE dsco,
>  		break;
>  	}
>  
> -	rc=IDirectSoundCaptureBuffer_Stop(dscbo);
> -	ok(rc==DS_OK,"IDirectSoundCaptureBuffer_Stop() failed: %08x\n", rc);
>      }
> +    rc=IDirectSoundCaptureBuffer_Stop(dscbo);
> +    ok(rc==DS_OK,"IDirectSoundCaptureBuffer_Stop() failed: %08x\n", rc);
> +
> +    rc=IDirectSoundCaptureBuffer_Stop(dscbo);
> +    ok(rc==DS_OK,"IDirectSoundCaptureBuffer_Stop() failed: %08x\n", rc);
>  }
>  
>  static BOOL WINAPI dscenum_callback(LPGUID lpGuid, LPCSTR lpcstrDescription,
> -- 
> 1.7.7.6
> 
> 
> 
> 
> 



More information about the wine-devel mailing list