From: Paul Gofman pgofman@codeweavers.com
--- dlls/xaudio2_7/tests/xaudio2.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+)
diff --git a/dlls/xaudio2_7/tests/xaudio2.c b/dlls/xaudio2_7/tests/xaudio2.c index a1de2959441..52850343da2 100644 --- a/dlls/xaudio2_7/tests/xaudio2.c +++ b/dlls/xaudio2_7/tests/xaudio2.c @@ -84,6 +84,16 @@ static IXAudio2 *create_xaudio2(void) return audio; }
+#define check_refcount(a, b) check_refcount_(__LINE__, a, b) +static void check_refcount_(int line, IUnknown *unk, LONG expected) +{ + LONG ref; + + IUnknown_AddRef(unk); + ref = IUnknown_Release(unk); + ok_(__FILE__, line)(ref == expected, "got refcount %ld, expected %ld.\n", ref, expected); +} + static void test_interfaces(IXAudio2 *audio) { const GUID *td[] = @@ -841,6 +851,8 @@ static void test_submix(IXAudio2 *xa) XAUDIO2_SEND_DESCRIPTOR send_desc = { 0 }; XAUDIO2_VOICE_SENDS sends = { 1, &send_desc };
+ check_refcount((IUnknown *)xa, 1); + IXAudio2_StopEngine(xa);
hr = create_mastering_voice(xa, 2, &master); @@ -849,6 +861,8 @@ static void test_submix(IXAudio2 *xa) hr = IXAudio2_CreateSubmixVoice(xa, &sub, 2, 44100, 0, 0, NULL, NULL); ok(hr == S_OK, "CreateSubmixVoice failed: %08lx\n", hr);
+ check_refcount((IUnknown *)xa, 1); + IXAudio2SubmixVoice_GetVoiceDetails(sub, &details); ok(details.CreationFlags == 0, "Got wrong creation flags: 0x%x\n", details.CreationFlags); #if XAUDIO2_VER >= 8 @@ -879,6 +893,14 @@ static void test_submix(IXAudio2 *xa) ok(details.InputChannels == 2, "Got wrong channel count: 0x%x\n", details.InputChannels); ok(details.InputSampleRate == 44100, "Got wrong sample rate: 0x%x\n", details.InputSampleRate);
+ IXAudio2MasteringVoice_DestroyVoice(master); + memset(&details, 0xcc, sizeof(details)); + IXAudio2MasteringVoice_GetVoiceDetails(master, &details); + ok(details.InputChannels == 2, "Got wrong channel count: 0x%x\n", details.InputChannels); + ok(details.InputSampleRate == 44100, "Got wrong sample rate: 0x%x\n", details.InputSampleRate); + + check_refcount((IUnknown *)xa, 1); + sends.SendCount = 0; hr = IXAudio2SubmixVoice_SetOutputVoices(sub, &sends); ok(hr == S_OK || (XAUDIO2_VER >= 8 && hr == XAUDIO2_E_INVALID_CALL), "SetOutputVoices failed: %08lx\n", hr);
This test accompanies changes by FAudio commit 2a82704a802985e83a6e00c3db3a90a6a0a6478d ("Do not reference count audio engine from voices") pulled to Wine with 68d1694900e256ed5911f260e9e9fa85bcb3a762.
This merge request was approved by Huw Davies.