Michael Stefaniuc : dmime: Create a port in the perf CreateStandardAudioPath().

Alexandre Julliard julliard at winehq.org
Sun Feb 16 15:23:58 CST 2020


Module: wine
Branch: master
Commit: 3dd2912874c9beb0e62c03b43a45788df7222d21
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=3dd2912874c9beb0e62c03b43a45788df7222d21

Author: Michael Stefaniuc <mstefani at winehq.org>
Date:   Fri Feb 14 01:21:06 2020 +0100

dmime: Create a port in the perf CreateStandardAudioPath().

Signed-off-by: Michael Stefaniuc <mstefani at winehq.org>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/dmime/performance.c       | 13 ++++++++++---
 dlls/dmime/tests/performance.c | 13 +++++++++++++
 2 files changed, 23 insertions(+), 3 deletions(-)

diff --git a/dlls/dmime/performance.c b/dlls/dmime/performance.c
index b12247ea31..989e5ee207 100644
--- a/dlls/dmime/performance.c
+++ b/dlls/dmime/performance.c
@@ -1070,16 +1070,17 @@ static HRESULT WINAPI IDirectMusicPerformance8Impl_CreateAudioPath(IDirectMusicP
 }
 
 static HRESULT WINAPI IDirectMusicPerformance8Impl_CreateStandardAudioPath(IDirectMusicPerformance8 *iface,
-        DWORD dwType, DWORD dwPChannelCount, BOOL fActivate, IDirectMusicAudioPath **ppNewPath)
+        DWORD dwType, DWORD pchannel_count, BOOL fActivate, IDirectMusicAudioPath **ppNewPath)
 {
         IDirectMusicPerformance8Impl *This = impl_from_IDirectMusicPerformance8(iface);
 	IDirectMusicAudioPath *pPath;
 	DSBUFFERDESC desc;
 	WAVEFORMATEX format;
+        DMUS_PORTPARAMS params = {0};
 	IDirectSoundBuffer *buffer, *primary_buffer;
 	HRESULT hr = S_OK;
 
-	FIXME("(%p)->(%d, %d, %d, %p): semi-stub\n", This, dwType, dwPChannelCount, fActivate, ppNewPath);
+        FIXME("(%p)->(%d, %d, %d, %p): semi-stub\n", This, dwType, pchannel_count, fActivate, ppNewPath);
 
 	if (NULL == ppNewPath) {
 	  return E_POINTER;
@@ -1126,7 +1127,13 @@ static HRESULT WINAPI IDirectMusicPerformance8Impl_CreateStandardAudioPath(IDire
 	        return E_INVALIDARG;
 	}
 
-	/* FIXME: Should we create one secondary buffer for each PChannel? */
+        /* Create a port */
+        params.dwValidParams = DMUS_PORTPARAMS_CHANNELGROUPS | DMUS_PORTPARAMS_AUDIOCHANNELS;
+        params.dwChannelGroups = (pchannel_count + 15) / 16;
+        params.dwAudioChannels = format.nChannels;
+        if (FAILED(hr = perf_dmport_create(This, &params)))
+                return hr;
+
         hr = IDirectSound_CreateSoundBuffer(This->dsound, &desc, &buffer, NULL);
 	if (FAILED(hr))
 	        return DSERR_BUFFERLOST;
diff --git a/dlls/dmime/tests/performance.c b/dlls/dmime/tests/performance.c
index ff275eb9c2..97c43c520b 100644
--- a/dlls/dmime/tests/performance.c
+++ b/dlls/dmime/tests/performance.c
@@ -82,6 +82,7 @@ static HRESULT test_InitAudio(void)
     IDirectSound *dsound;
     IDirectMusicPort *port;
     IDirectMusicAudioPath *path;
+    DWORD channel, group;
     HRESULT hr;
     ULONG ref;
 
@@ -216,6 +217,18 @@ static HRESULT test_InitAudio(void)
     ok(ref == 2, "dmusic ref count got %d expected 2\n", ref);
     destroy_performance(performance, dmusic, dsound);
 
+    /* InitAudio with perf channel count not a multiple of 16 rounds up */
+    create_performance(&performance, NULL, NULL, TRUE);
+    hr = IDirectMusicPerformance8_InitAudio(performance, NULL, NULL, NULL,
+            DMUS_APATH_SHARED_STEREOPLUSREVERB, 29, DMUS_AUDIOF_ALL, NULL);
+    ok(hr == S_OK, "InitAudio failed: %08x\n", hr);
+    hr = IDirectMusicPerformance8_PChannelInfo(performance, 31, &port, &group, &channel);
+    todo_wine ok(hr == S_OK && group == 2 && channel == 15,
+            "PChannelInfo failed, got %08x, %u, %u\n", hr, group, channel);
+    hr = IDirectMusicPerformance8_PChannelInfo(performance, 32, &port, NULL, NULL);
+    todo_wine ok(hr == E_INVALIDARG, "PChannelInfo failed, got %08x\n", hr);
+    destroy_performance(performance, NULL, NULL);
+
     return S_OK;
 }
 




More information about the wine-cvs mailing list