dsound: IDirectSoundNotify is only available when DSBCAPS_CTRLPOSITIONNOTIFY is specified.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=45473
Signed-off-by: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Signed-off-by: Andrew Eikum <aeikum@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
stable
Alistair Leslie-Hughes 2019-02-13 01:56:16 +00:00 committed by Alexandre Julliard
parent 6925fb0bb6
commit 9a258c5dd7
2 changed files with 20 additions and 2 deletions

View File

@ -923,11 +923,16 @@ static HRESULT WINAPI IDirectSoundBufferImpl_QueryInterface(IDirectSoundBuffer8
return S_OK;
}
if ( IsEqualGUID( &IID_IDirectSoundNotify, riid ) ) {
if ( IsEqualGUID( &IID_IDirectSoundNotify, riid ) ) {
if(This->dsbd.dwFlags & DSBCAPS_CTRLPOSITIONNOTIFY) {
IDirectSoundNotify_AddRef(&This->IDirectSoundNotify_iface);
*ppobj = &This->IDirectSoundNotify_iface;
return S_OK;
}
}
TRACE( "App requested IDirectSoundNotify without DSBCAPS_CTRLPOSITIONNOTIFY flag.\n");
return E_NOINTERFACE;
}
if ( IsEqualGUID( &IID_IDirectSound3DBuffer, riid ) ) {
if(This->dsbd.dwFlags & DSBCAPS_CTRL3D){

View File

@ -1561,6 +1561,19 @@ static void test_notifications(LPGUID lpGuid)
wfx.nAvgBytesPerSec = wfx.nSamplesPerSec * wfx.nBlockAlign;
wfx.cbSize = 0;
ZeroMemory(&bufdesc, sizeof(bufdesc));
bufdesc.dwSize = sizeof(bufdesc);
bufdesc.dwFlags = DSBCAPS_GETCURRENTPOSITION2;
bufdesc.dwBufferBytes = wfx.nSamplesPerSec * wfx.nBlockAlign / 2; /* 0.5s */
bufdesc.lpwfxFormat = &wfx;
rc = IDirectSound_CreateSoundBuffer(dso, &bufdesc, &buf, NULL);
ok(rc == DS_OK && buf != NULL, "IDirectSound_CreateSoundBuffer() failed "
"to create a buffer %08x\n", rc);
rc = IDirectSoundBuffer_QueryInterface(buf, &IID_IDirectSoundNotify, (void**)&buf_notif);
ok(rc == E_NOINTERFACE, "QueryInterface(IID_IDirectSoundNotify): %08x\n", rc);
IDirectSoundBuffer_Release(buf);
ZeroMemory(&bufdesc, sizeof(bufdesc));
bufdesc.dwSize = sizeof(bufdesc);
bufdesc.dwFlags = DSBCAPS_CTRLPOSITIONNOTIFY;