mmdevapi: Add initial audioclient stub.

This commit is contained in:
Maarten Lankhorst 2010-04-19 11:52:47 +02:00 committed by Alexandre Julliard
parent f9293dc977
commit fa202c52c3
6 changed files with 391 additions and 56 deletions

View File

@ -7,6 +7,7 @@ IMPORTS = uuid ole32 oleaut32 user32 advapi32 kernel32 ntdll
EXTRALIBS = @FRAMEWORK_OPENAL@ EXTRALIBS = @FRAMEWORK_OPENAL@
C_SRCS = \ C_SRCS = \
audio.c \
devenum.c \ devenum.c \
main.c \ main.c \
regsvr.c regsvr.c

318
dlls/mmdevapi/audio.c Normal file
View File

@ -0,0 +1,318 @@
/*
* Copyright 2010 Maarten Lankhorst for Codeweavers
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#define NONAMELESSUNION
#define CINTERFACE
#define COBJMACROS
#include "config.h"
#include <stdarg.h>
#ifdef HAVE_AL_AL_H
#include <AL/al.h>
#include <AL/alc.h>
#elif defined(HAVE_OPENAL_AL_H)
#include <OpenAL/al.h>
#include <OpenAL/alc.h>
#endif
#include "windef.h"
#include "winbase.h"
#include "winnls.h"
#include "winreg.h"
#include "wine/debug.h"
#include "wine/unicode.h"
#include "ole2.h"
#include "mmdeviceapi.h"
#include "dshow.h"
#include "dsound.h"
#include "audioclient.h"
#include "endpointvolume.h"
#include "audiopolicy.h"
#include "mmdevapi.h"
WINE_DEFAULT_DEBUG_CHANNEL(mmdevapi);
#ifdef HAVE_OPENAL
typedef struct ACRender ACRender;
typedef struct ACCapture ACCapture;
typedef struct ACSession ACSession;
typedef struct ASVolume ASVolume;
typedef struct AClock AClock;
typedef struct ACImpl {
const IAudioClientVtbl *lpVtbl;
LONG ref;
MMDevice *parent;
CRITICAL_SECTION *crst;
DWORD init;
} ACImpl;
static const IAudioClientVtbl ACImpl_Vtbl;
HRESULT AudioClient_Create(MMDevice *parent, IAudioClient **ppv)
{
ACImpl *This = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*This));
*ppv = (IAudioClient*)This;
if (!*ppv)
return E_OUTOFMEMORY;
This->crst = &parent->crst;
This->lpVtbl = &ACImpl_Vtbl;
This->ref = 1;
This->parent = parent;
return S_OK;
}
static void AudioClient_Destroy(ACImpl *This)
{
HeapFree(GetProcessHeap(), 0, This);
}
static HRESULT WINAPI AC_QueryInterface(IAudioClient *iface, REFIID riid, void **ppv)
{
TRACE("(%p)->(%s,%p)\n", iface, debugstr_guid(riid), ppv);
if (!ppv)
return E_POINTER;
*ppv = NULL;
if (IsEqualIID(riid, &IID_IUnknown)
|| IsEqualIID(riid, &IID_IAudioClient))
*ppv = iface;
if (*ppv) {
IUnknown_AddRef((IUnknown*)*ppv);
return S_OK;
}
WARN("Unknown interface %s\n", debugstr_guid(riid));
return E_NOINTERFACE;
}
static ULONG WINAPI AC_AddRef(IAudioClient *iface)
{
ACImpl *This = (ACImpl*)iface;
ULONG ref;
ref = InterlockedIncrement(&This->ref);
TRACE("Refcount now %i\n", ref);
return ref;
}
static ULONG WINAPI AC_Release(IAudioClient *iface)
{
ACImpl *This = (ACImpl*)iface;
ULONG ref;
ref = InterlockedDecrement(&This->ref);
TRACE("Refcount now %i\n", ref);
if (!ref)
AudioClient_Destroy(This);
return ref;
}
static HRESULT WINAPI AC_Initialize(IAudioClient *iface, AUDCLNT_SHAREMODE mode, DWORD flags, REFERENCE_TIME duration, REFERENCE_TIME period, const WAVEFORMATEX *pwfx, const GUID *sessionguid)
{
ACImpl *This = (ACImpl*)iface;
TRACE("(%p)->(%x,%x,%u,%u,%p,%s)\n", This, mode, flags, (int)duration, (int)period, pwfx, debugstr_guid(sessionguid));
FIXME("stub\n");
return E_NOTIMPL;
}
static HRESULT WINAPI AC_GetBufferSize(IAudioClient *iface, UINT32 *frames)
{
ACImpl *This = (ACImpl*)iface;
TRACE("(%p)->(%p)\n", This, frames);
if (!This->init)
return AUDCLNT_E_NOT_INITIALIZED;
if (!frames)
return E_POINTER;
FIXME("stub\n");
return E_NOTIMPL;
}
static HRESULT WINAPI AC_GetStreamLatency(IAudioClient *iface, REFERENCE_TIME *latency)
{
ACImpl *This = (ACImpl*)iface;
TRACE("(%p)->(%p)\n", This, latency);
if (!This->init)
return AUDCLNT_E_NOT_INITIALIZED;
return IAudioClient_GetDevicePeriod(iface, latency, NULL);
}
static HRESULT WINAPI AC_GetCurrentPadding(IAudioClient *iface, UINT32 *numpad)
{
ACImpl *This = (ACImpl*)iface;
TRACE("(%p)->(%p)\n", This, numpad);
if (!This->init)
return AUDCLNT_E_NOT_INITIALIZED;
if (!numpad)
return E_POINTER;
FIXME("stub\n");
return E_NOTIMPL;
}
static HRESULT WINAPI AC_IsFormatSupported(IAudioClient *iface, AUDCLNT_SHAREMODE mode, const WAVEFORMATEX *pwfx, WAVEFORMATEX **outpwfx)
{
ACImpl *This = (ACImpl*)iface;
TRACE("(%p)->(%x,%p,%p)\n", This, mode, pwfx, outpwfx);
if (!pwfx)
return E_POINTER;
if (mode == AUDCLNT_SHAREMODE_SHARED && !outpwfx)
return E_POINTER;
if (mode != AUDCLNT_SHAREMODE_SHARED
&& mode != AUDCLNT_SHAREMODE_EXCLUSIVE) {
WARN("Unknown mode %x\n", mode);
return E_INVALIDARG;
}
if (pwfx->wFormatTag != WAVE_FORMAT_EXTENSIBLE
&& pwfx->wFormatTag != WAVE_FORMAT_PCM)
return AUDCLNT_E_UNSUPPORTED_FORMAT;
if (pwfx->nSamplesPerSec < 8000
|| pwfx->nSamplesPerSec > 192000)
return AUDCLNT_E_UNSUPPORTED_FORMAT;
if (pwfx->wFormatTag != WAVE_FORMAT_EXTENSIBLE
|| !IsEqualIID(&((WAVEFORMATEXTENSIBLE*)pwfx)->SubFormat, &KSDATAFORMAT_SUBTYPE_IEEE_FLOAT)) {
if (pwfx->wBitsPerSample > 16)
return AUDCLNT_E_UNSUPPORTED_FORMAT;
}
if (outpwfx)
*outpwfx = NULL;
return S_OK;
}
static HRESULT WINAPI AC_GetMixFormat(IAudioClient *iface, WAVEFORMATEX **pwfx)
{
ACImpl *This = (ACImpl*)iface;
TRACE("(%p)->(%p)\n", This, pwfx);
if (!pwfx)
return E_POINTER;
FIXME("stub\n");
return E_NOTIMPL;
}
static HRESULT WINAPI AC_GetDevicePeriod(IAudioClient *iface, REFERENCE_TIME *defperiod, REFERENCE_TIME *minperiod)
{
ACImpl *This = (ACImpl*)iface;
TRACE("(%p)->(%p)\n", This, minperiod);
if (!defperiod && !minperiod)
return E_POINTER;
FIXME("stub\n");
return E_NOTIMPL;
}
static HRESULT WINAPI AC_Start(IAudioClient *iface)
{
ACImpl *This = (ACImpl*)iface;
TRACE("(%p)\n", This);
if (!This->init)
return AUDCLNT_E_NOT_INITIALIZED;
FIXME("stub\n");
return E_NOTIMPL;
}
static HRESULT WINAPI AC_Stop(IAudioClient *iface)
{
ACImpl *This = (ACImpl*)iface;
TRACE("(%p)\n", This);
if (!This->init)
return AUDCLNT_E_NOT_INITIALIZED;
FIXME("stub\n");
return E_NOTIMPL;
}
static HRESULT WINAPI AC_Reset(IAudioClient *iface)
{
ACImpl *This = (ACImpl*)iface;
TRACE("(%p)\n", This);
if (!This->init)
return AUDCLNT_E_NOT_INITIALIZED;
FIXME("stub\n");
return E_NOTIMPL;
}
static HRESULT WINAPI AC_SetEventHandle(IAudioClient *iface, HANDLE handle)
{
ACImpl *This = (ACImpl*)iface;
TRACE("(%p)\n", This);
if (!This->init)
return AUDCLNT_E_NOT_INITIALIZED;
if (!handle)
return E_INVALIDARG;
FIXME("stub\n");
return E_NOTIMPL;
}
static HRESULT WINAPI AC_GetService(IAudioClient *iface, REFIID riid, void **ppv)
{
ACImpl *This = (ACImpl*)iface;
HRESULT hr = S_OK;
TRACE("(%p)->(%s,%p)\n", This, debugstr_guid(riid), ppv);
if (!This->init)
return AUDCLNT_E_NOT_INITIALIZED;
if (!ppv)
return E_POINTER;
*ppv = NULL;
if (FAILED(hr))
return hr;
if (*ppv) {
IUnknown_AddRef((IUnknown*)*ppv);
return S_OK;
}
FIXME("stub %s\n", debugstr_guid(riid));
return E_NOINTERFACE;
}
static const IAudioClientVtbl ACImpl_Vtbl =
{
AC_QueryInterface,
AC_AddRef,
AC_Release,
AC_Initialize,
AC_GetBufferSize,
AC_GetStreamLatency,
AC_GetCurrentPadding,
AC_IsFormatSupported,
AC_GetMixFormat,
AC_GetDevicePeriod,
AC_Start,
AC_Stop,
AC_Reset,
AC_SetEventHandle,
AC_GetService
};
#endif

View File

@ -158,6 +158,7 @@ static void MMDevice_Create(MMDevice **dev, WCHAR *name, GUID *id, EDataFlow flo
cur->crst.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": MMDevice.crst"); cur->crst.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": MMDevice.crst");
cur->flow = flow; cur->flow = flow;
cur->state = state; cur->state = state;
cur->device = NULL;
if (!id) if (!id)
{ {
id = &cur->devguid; id = &cur->devguid;
@ -215,6 +216,10 @@ static void MMDevice_Destroy(MMDevice *This)
break; break;
} }
} }
#ifdef HAVE_OPENAL
if (This->device)
palcCloseDevice(This->device);
#endif
This->crst.DebugInfo->Spare[0] = 0; This->crst.DebugInfo->Spare[0] = 0;
DeleteCriticalSection(&This->crst); DeleteCriticalSection(&This->crst);
HeapFree(GetProcessHeap(), 0, This->alname); HeapFree(GetProcessHeap(), 0, This->alname);
@ -267,14 +272,22 @@ static HRESULT WINAPI MMDevice_Activate(IMMDevice *iface, REFIID riid, DWORD cls
{ {
MMDevice *This = (MMDevice *)iface; MMDevice *This = (MMDevice *)iface;
HRESULT hr = E_NOINTERFACE; HRESULT hr = E_NOINTERFACE;
TRACE("(%p)->(%p,%x,%p,%p)\n", This, riid, clsctx, params, ppv); TRACE("(%p)->(%p,%x,%p,%p)\n", iface, riid, clsctx, params, ppv);
if (!ppv) if (!ppv)
return E_POINTER; return E_POINTER;
if (IsEqualIID(riid, &IID_IAudioClient)) if (IsEqualIID(riid, &IID_IAudioClient))
{ {
FIXME("IID_IAudioClient unsupported\n"); #ifdef HAVE_OPENAL
if (openal_loaded)
hr = AudioClient_Create(This, (IAudioClient**)ppv);
else
#endif
{
ERR("Trying to open a device with openal not available\n");
hr = AUDCLNT_E_SERVICE_NOT_RUNNING;
}
} }
else if (IsEqualIID(riid, &IID_IAudioEndpointVolume)) else if (IsEqualIID(riid, &IID_IAudioEndpointVolume))
{ {

View File

@ -37,8 +37,11 @@ typedef struct MMDevice {
DWORD state; DWORD state;
GUID devguid; GUID devguid;
WCHAR *alname; WCHAR *alname;
void *device, *ctx;
} MMDevice; } MMDevice;
extern HRESULT AudioClient_Create(MMDevice *parent, IAudioClient **ppv);
#ifdef HAVE_OPENAL #ifdef HAVE_OPENAL
#include "alext.h" #include "alext.h"

View File

@ -174,13 +174,13 @@ static void test_audioclient(IAudioClient *ac)
ok(hr == E_POINTER, "Invalid GetDevicePeriod call returns %08x\n", hr); ok(hr == E_POINTER, "Invalid GetDevicePeriod call returns %08x\n", hr);
hr = IAudioClient_GetDevicePeriod(ac, &t1, NULL); hr = IAudioClient_GetDevicePeriod(ac, &t1, NULL);
ok(hr == S_OK, "Valid GetDevicePeriod call returns %08x\n", hr); todo_wine ok(hr == S_OK, "Valid GetDevicePeriod call returns %08x\n", hr);
hr = IAudioClient_GetDevicePeriod(ac, NULL, &t2); hr = IAudioClient_GetDevicePeriod(ac, NULL, &t2);
ok(hr == S_OK, "Valid GetDevicePeriod call returns %08x\n", hr); todo_wine ok(hr == S_OK, "Valid GetDevicePeriod call returns %08x\n", hr);
hr = IAudioClient_GetDevicePeriod(ac, &t1, &t2); hr = IAudioClient_GetDevicePeriod(ac, &t1, &t2);
ok(hr == S_OK, "Valid GetDevicePeriod call returns %08x\n", hr); todo_wine ok(hr == S_OK, "Valid GetDevicePeriod call returns %08x\n", hr);
trace("Returned periods: %u.%05u ms %u.%05u ms\n", trace("Returned periods: %u.%05u ms %u.%05u ms\n",
(UINT)(t1/10000), (UINT)(t1 % 10000), (UINT)(t1/10000), (UINT)(t1 % 10000),
(UINT)(t2/10000), (UINT)(t2 % 10000)); (UINT)(t2/10000), (UINT)(t2 % 10000));
@ -189,28 +189,28 @@ static void test_audioclient(IAudioClient *ac)
ok(hr == E_POINTER, "GetMixFormat returns %08x\n", hr); ok(hr == E_POINTER, "GetMixFormat returns %08x\n", hr);
hr = IAudioClient_GetMixFormat(ac, &pwfx); hr = IAudioClient_GetMixFormat(ac, &pwfx);
ok(hr == S_OK, "Valid GetMixFormat returns %08x\n", hr); todo_wine ok(hr == S_OK, "Valid GetMixFormat returns %08x\n", hr);
trace("Tag: %04x\n", pwfx->wFormatTag);
trace("bits: %u\n", pwfx->wBitsPerSample);
trace("chan: %u\n", pwfx->nChannels);
trace("rate: %u\n", pwfx->nSamplesPerSec);
trace("align: %u\n", pwfx->nBlockAlign);
trace("extra: %u\n", pwfx->cbSize);
ok(pwfx->wFormatTag == WAVE_FORMAT_EXTENSIBLE, "wFormatTag is %x\n", pwfx->wFormatTag);
if (pwfx->wFormatTag == WAVE_FORMAT_EXTENSIBLE)
{
WAVEFORMATEXTENSIBLE *pwfxe = (void*)pwfx;
trace("Res: %u\n", pwfxe->Samples.wReserved);
trace("Mask: %x\n", pwfxe->dwChannelMask);
trace("Alg: %s\n",
IsEqualGUID(&pwfxe->SubFormat, &KSDATAFORMAT_SUBTYPE_PCM)?"PCM":
(IsEqualGUID(&pwfxe->SubFormat,
&KSDATAFORMAT_SUBTYPE_IEEE_FLOAT)?"FLOAT":"Other"));
}
if (hr == S_OK) if (hr == S_OK)
{ {
trace("Tag: %04x\n", pwfx->wFormatTag);
trace("bits: %u\n", pwfx->wBitsPerSample);
trace("chan: %u\n", pwfx->nChannels);
trace("rate: %u\n", pwfx->nSamplesPerSec);
trace("align: %u\n", pwfx->nBlockAlign);
trace("extra: %u\n", pwfx->cbSize);
ok(pwfx->wFormatTag == WAVE_FORMAT_EXTENSIBLE, "wFormatTag is %x\n", pwfx->wFormatTag);
if (pwfx->wFormatTag == WAVE_FORMAT_EXTENSIBLE)
{
WAVEFORMATEXTENSIBLE *pwfxe = (void*)pwfx;
trace("Res: %u\n", pwfxe->Samples.wReserved);
trace("Mask: %x\n", pwfxe->dwChannelMask);
trace("Alg: %s\n",
IsEqualGUID(&pwfxe->SubFormat, &KSDATAFORMAT_SUBTYPE_PCM)?"PCM":
(IsEqualGUID(&pwfxe->SubFormat,
&KSDATAFORMAT_SUBTYPE_IEEE_FLOAT)?"FLOAT":"Other"));
}
hr = IAudioClient_IsFormatSupported(ac, AUDCLNT_SHAREMODE_SHARED, pwfx, &pwfx2); hr = IAudioClient_IsFormatSupported(ac, AUDCLNT_SHAREMODE_SHARED, pwfx, &pwfx2);
ok(hr == S_OK, "Valid IsFormatSupported(Shared) call returns %08x\n", hr); ok(hr == S_OK, "Valid IsFormatSupported(Shared) call returns %08x\n", hr);
ok(pwfx2 == NULL, "pwfx2 is non-null\n"); ok(pwfx2 == NULL, "pwfx2 is non-null\n");
@ -236,19 +236,19 @@ static void test_audioclient(IAudioClient *ac)
test_uninitialized(ac); test_uninitialized(ac);
hr = IAudioClient_Initialize(ac, 3, 0, 5000000, 0, pwfx, NULL); hr = IAudioClient_Initialize(ac, 3, 0, 5000000, 0, pwfx, NULL);
ok(hr == AUDCLNT_E_NOT_INITIALIZED, "Initialize with invalid sharemode returns %08x\n", hr); todo_wine ok(hr == AUDCLNT_E_NOT_INITIALIZED, "Initialize with invalid sharemode returns %08x\n", hr);
hr = IAudioClient_Initialize(ac, AUDCLNT_SHAREMODE_SHARED, 0xffffffff, 5000000, 0, pwfx, NULL); hr = IAudioClient_Initialize(ac, AUDCLNT_SHAREMODE_SHARED, 0xffffffff, 5000000, 0, pwfx, NULL);
ok(hr == E_INVALIDARG, "Initialize with invalid flags returns %08x\n", hr); todo_wine ok(hr == E_INVALIDARG, "Initialize with invalid flags returns %08x\n", hr);
/* It seems that if length > 2s or periodicity != 0 the length is ignored and call succeeds /* It seems that if length > 2s or periodicity != 0 the length is ignored and call succeeds
* Since we can only initialize succesfully once skip those tests * Since we can only initialize succesfully once skip those tests
*/ */
hr = IAudioClient_Initialize(ac, AUDCLNT_SHAREMODE_SHARED, 0, 5000000, 0, NULL, NULL); hr = IAudioClient_Initialize(ac, AUDCLNT_SHAREMODE_SHARED, 0, 5000000, 0, NULL, NULL);
ok(hr == E_POINTER, "Initialize with null format returns %08x\n", hr); todo_wine ok(hr == E_POINTER, "Initialize with null format returns %08x\n", hr);
hr = IAudioClient_Initialize(ac, AUDCLNT_SHAREMODE_SHARED, AUDCLNT_STREAMFLAGS_EVENTCALLBACK, 5000000, 0, pwfx, NULL); hr = IAudioClient_Initialize(ac, AUDCLNT_SHAREMODE_SHARED, AUDCLNT_STREAMFLAGS_EVENTCALLBACK, 5000000, 0, pwfx, NULL);
ok(hr == S_OK, "Valid Initialize returns %08x\n", hr); todo_wine ok(hr == S_OK, "Valid Initialize returns %08x\n", hr);
if (hr != S_OK) if (hr != S_OK)
{ {
@ -319,7 +319,7 @@ START_TEST(capture)
} }
hr = IMMDevice_Activate(dev, &IID_IAudioClient, CLSCTX_INPROC_SERVER, NULL, (void**)&ac); hr = IMMDevice_Activate(dev, &IID_IAudioClient, CLSCTX_INPROC_SERVER, NULL, (void**)&ac);
todo_wine ok(hr == S_OK, "Activation failed with %08x\n", hr); ok(hr == S_OK, "Activation failed with %08x\n", hr);
if (ac) if (ac)
{ {
test_audioclient(ac); test_audioclient(ac);

View File

@ -109,13 +109,13 @@ static void test_audioclient(IAudioClient *ac)
ok(hr == E_POINTER, "Invalid GetDevicePeriod call returns %08x\n", hr); ok(hr == E_POINTER, "Invalid GetDevicePeriod call returns %08x\n", hr);
hr = IAudioClient_GetDevicePeriod(ac, &t1, NULL); hr = IAudioClient_GetDevicePeriod(ac, &t1, NULL);
ok(hr == S_OK, "Valid GetDevicePeriod call returns %08x\n", hr); todo_wine ok(hr == S_OK, "Valid GetDevicePeriod call returns %08x\n", hr);
hr = IAudioClient_GetDevicePeriod(ac, NULL, &t2); hr = IAudioClient_GetDevicePeriod(ac, NULL, &t2);
ok(hr == S_OK, "Valid GetDevicePeriod call returns %08x\n", hr); todo_wine ok(hr == S_OK, "Valid GetDevicePeriod call returns %08x\n", hr);
hr = IAudioClient_GetDevicePeriod(ac, &t1, &t2); hr = IAudioClient_GetDevicePeriod(ac, &t1, &t2);
ok(hr == S_OK, "Valid GetDevicePeriod call returns %08x\n", hr); todo_wine ok(hr == S_OK, "Valid GetDevicePeriod call returns %08x\n", hr);
trace("Returned periods: %u.%05u ms %u.%05u ms\n", trace("Returned periods: %u.%05u ms %u.%05u ms\n",
(UINT)(t1/10000), (UINT)(t1 % 10000), (UINT)(t1/10000), (UINT)(t1 % 10000),
(UINT)(t2/10000), (UINT)(t2 % 10000)); (UINT)(t2/10000), (UINT)(t2 % 10000));
@ -124,28 +124,28 @@ static void test_audioclient(IAudioClient *ac)
ok(hr == E_POINTER, "GetMixFormat returns %08x\n", hr); ok(hr == E_POINTER, "GetMixFormat returns %08x\n", hr);
hr = IAudioClient_GetMixFormat(ac, &pwfx); hr = IAudioClient_GetMixFormat(ac, &pwfx);
ok(hr == S_OK, "Valid GetMixFormat returns %08x\n", hr); todo_wine ok(hr == S_OK, "Valid GetMixFormat returns %08x\n", hr);
trace("Tag: %04x\n", pwfx->wFormatTag);
trace("bits: %u\n", pwfx->wBitsPerSample);
trace("chan: %u\n", pwfx->nChannels);
trace("rate: %u\n", pwfx->nSamplesPerSec);
trace("align: %u\n", pwfx->nBlockAlign);
trace("extra: %u\n", pwfx->cbSize);
ok(pwfx->wFormatTag == WAVE_FORMAT_EXTENSIBLE, "wFormatTag is %x\n", pwfx->wFormatTag);
if (pwfx->wFormatTag == WAVE_FORMAT_EXTENSIBLE)
{
WAVEFORMATEXTENSIBLE *pwfxe = (void*)pwfx;
trace("Res: %u\n", pwfxe->Samples.wReserved);
trace("Mask: %x\n", pwfxe->dwChannelMask);
trace("Alg: %s\n",
IsEqualGUID(&pwfxe->SubFormat, &KSDATAFORMAT_SUBTYPE_PCM)?"PCM":
(IsEqualGUID(&pwfxe->SubFormat,
&KSDATAFORMAT_SUBTYPE_IEEE_FLOAT)?"FLOAT":"Other"));
}
if (hr == S_OK) if (hr == S_OK)
{ {
trace("Tag: %04x\n", pwfx->wFormatTag);
trace("bits: %u\n", pwfx->wBitsPerSample);
trace("chan: %u\n", pwfx->nChannels);
trace("rate: %u\n", pwfx->nSamplesPerSec);
trace("align: %u\n", pwfx->nBlockAlign);
trace("extra: %u\n", pwfx->cbSize);
ok(pwfx->wFormatTag == WAVE_FORMAT_EXTENSIBLE, "wFormatTag is %x\n", pwfx->wFormatTag);
if (pwfx->wFormatTag == WAVE_FORMAT_EXTENSIBLE)
{
WAVEFORMATEXTENSIBLE *pwfxe = (void*)pwfx;
trace("Res: %u\n", pwfxe->Samples.wReserved);
trace("Mask: %x\n", pwfxe->dwChannelMask);
trace("Alg: %s\n",
IsEqualGUID(&pwfxe->SubFormat, &KSDATAFORMAT_SUBTYPE_PCM)?"PCM":
(IsEqualGUID(&pwfxe->SubFormat,
&KSDATAFORMAT_SUBTYPE_IEEE_FLOAT)?"FLOAT":"Other"));
}
hr = IAudioClient_IsFormatSupported(ac, AUDCLNT_SHAREMODE_SHARED, pwfx, &pwfx2); hr = IAudioClient_IsFormatSupported(ac, AUDCLNT_SHAREMODE_SHARED, pwfx, &pwfx2);
ok(hr == S_OK, "Valid IsFormatSupported(Shared) call returns %08x\n", hr); ok(hr == S_OK, "Valid IsFormatSupported(Shared) call returns %08x\n", hr);
ok(pwfx2 == NULL, "pwfx2 is non-null\n"); ok(pwfx2 == NULL, "pwfx2 is non-null\n");
@ -171,19 +171,19 @@ static void test_audioclient(IAudioClient *ac)
test_uninitialized(ac); test_uninitialized(ac);
hr = IAudioClient_Initialize(ac, 3, 0, 5000000, 0, pwfx, NULL); hr = IAudioClient_Initialize(ac, 3, 0, 5000000, 0, pwfx, NULL);
ok(hr == AUDCLNT_E_NOT_INITIALIZED, "Initialize with invalid sharemode returns %08x\n", hr); todo_wine ok(hr == AUDCLNT_E_NOT_INITIALIZED, "Initialize with invalid sharemode returns %08x\n", hr);
hr = IAudioClient_Initialize(ac, AUDCLNT_SHAREMODE_SHARED, 0xffffffff, 5000000, 0, pwfx, NULL); hr = IAudioClient_Initialize(ac, AUDCLNT_SHAREMODE_SHARED, 0xffffffff, 5000000, 0, pwfx, NULL);
ok(hr == E_INVALIDARG, "Initialize with invalid flags returns %08x\n", hr); todo_wine ok(hr == E_INVALIDARG, "Initialize with invalid flags returns %08x\n", hr);
/* It seems that if length > 2s or periodicity != 0 the length is ignored and call succeeds /* It seems that if length > 2s or periodicity != 0 the length is ignored and call succeeds
* Since we can only initialize successfully once, skip those tests. * Since we can only initialize successfully once, skip those tests.
*/ */
hr = IAudioClient_Initialize(ac, AUDCLNT_SHAREMODE_SHARED, 0, 5000000, 0, NULL, NULL); hr = IAudioClient_Initialize(ac, AUDCLNT_SHAREMODE_SHARED, 0, 5000000, 0, NULL, NULL);
ok(hr == E_POINTER, "Initialize with null format returns %08x\n", hr); todo_wine ok(hr == E_POINTER, "Initialize with null format returns %08x\n", hr);
hr = IAudioClient_Initialize(ac, AUDCLNT_SHAREMODE_SHARED, 0, 5000000, 0, pwfx, NULL); hr = IAudioClient_Initialize(ac, AUDCLNT_SHAREMODE_SHARED, 0, 5000000, 0, pwfx, NULL);
ok(hr == S_OK, "Valid Initialize returns %08x\n", hr); todo_wine ok(hr == S_OK, "Valid Initialize returns %08x\n", hr);
if (hr != S_OK) if (hr != S_OK)
{ {
@ -252,7 +252,7 @@ START_TEST(render)
} }
hr = IMMDevice_Activate(dev, &IID_IAudioClient, CLSCTX_INPROC_SERVER, NULL, (void**)&ac); hr = IMMDevice_Activate(dev, &IID_IAudioClient, CLSCTX_INPROC_SERVER, NULL, (void**)&ac);
todo_wine ok(hr == S_OK, "Activation failed with %08x\n", hr); ok(hr == S_OK, "Activation failed with %08x\n", hr);
if (ac) if (ac)
{ {
test_audioclient(ac); test_audioclient(ac);