Michael Stefaniuc : dmime: Finish the cleanup of InitAudio().

Alexandre Julliard julliard at winehq.org
Thu May 11 15:07:29 CDT 2017


Module: wine
Branch: master
Commit: 3236e4ccab754eac8a14ff94efc19db8fae898e7
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=3236e4ccab754eac8a14ff94efc19db8fae898e7

Author: Michael Stefaniuc <mstefani at winehq.org>
Date:   Thu May 11 11:05:49 2017 +0200

dmime: Finish the cleanup of InitAudio().

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

---

 dlls/dmime/performance.c | 46 ++++++++++++++++++++++------------------------
 1 file changed, 22 insertions(+), 24 deletions(-)

diff --git a/dlls/dmime/performance.c b/dlls/dmime/performance.c
index 2bd34d5..bbfc04f 100644
--- a/dlls/dmime/performance.c
+++ b/dlls/dmime/performance.c
@@ -28,8 +28,7 @@ typedef struct IDirectMusicPerformance8Impl {
     IDirectMusic8 *dmusic;
     IDirectSound *dsound;
     IDirectMusicGraph *pToolGraph;
-    DMUS_AUDIOPARAMS pParams;
-    /* global parameters */
+    DMUS_AUDIOPARAMS params;
     BOOL fAutoDownload;
     char cMasterGrooveLevel;
     float fMasterTempo;
@@ -892,14 +891,14 @@ static HRESULT WINAPI IDirectMusicPerformance8Impl_RhythmToTime(IDirectMusicPerf
 
 /* IDirectMusicPerformance8 Interface part follow: */
 static HRESULT WINAPI IDirectMusicPerformance8Impl_InitAudio(IDirectMusicPerformance8 *iface,
-        IDirectMusic **dmusic, IDirectSound **dsound, HWND hwnd,
-        DWORD dwDefaultPathType, DWORD dwPChannelCount, DWORD dwFlags, DMUS_AUDIOPARAMS* pParams)
+        IDirectMusic **dmusic, IDirectSound **dsound, HWND hwnd, DWORD default_path_type,
+        DWORD num_channels, DWORD flags, DMUS_AUDIOPARAMS *params)
 {
     IDirectMusicPerformance8Impl *This = impl_from_IDirectMusicPerformance8(iface);
     HRESULT hr = S_OK;
 
-    TRACE("(%p, %p, %p, %p, %x, %u, %x, %p)\n", This, dmusic, dsound, hwnd, dwDefaultPathType,
-            dwPChannelCount, dwFlags, pParams);
+    TRACE("(%p, %p, %p, %p, %x, %u, %x, %p)\n", This, dmusic, dsound, hwnd, default_path_type,
+            num_channels, flags, params);
 
     if (This->dmusic)
         return DMUS_E_ALREADY_INITED;
@@ -929,26 +928,25 @@ static HRESULT WINAPI IDirectMusicPerformance8Impl_InitAudio(IDirectMusicPerform
     if (dsound)
         IDirectSound_AddRef(This->dsound);
 
-	/* as seen in msdn we need params init before audio path creation */
-	if (NULL != pParams) {
-	  This->pParams = *pParams;
-	} else {
-	  /* TODO, how can i fill the struct as seen on msdn */
-	  memset(&This->pParams, 0, sizeof(DMUS_AUDIOPARAMS));
-	  This->pParams.dwSize = sizeof(DMUS_AUDIOPARAMS);
-	  This->pParams.fInitNow = FALSE;
-	  This->pParams.dwValidData = DMUS_AUDIOPARAMS_FEATURES | DMUS_AUDIOPARAMS_VOICES | DMUS_AUDIOPARAMS_SAMPLERATE | DMUS_AUDIOPARAMS_DEFAULTSYNTH;
-	  This->pParams.dwVoices = 64;
-	  This->pParams.dwSampleRate = (DWORD) 22.050; 
-	  This->pParams.dwFeatures = dwFlags;
-	  This->pParams.clsidDefaultSynth = CLSID_DirectMusicSynthSink;
-	}
-	if(dwDefaultPathType != 0)
-		hr = IDirectMusicPerformance8_CreateStandardAudioPath(iface, dwDefaultPathType, dwPChannelCount, FALSE, &This->pDefaultPath);
+    if (!params) {
+        This->params.dwSize = sizeof(DMUS_AUDIOPARAMS);
+        This->params.fInitNow = FALSE;
+        This->params.dwValidData = DMUS_AUDIOPARAMS_FEATURES | DMUS_AUDIOPARAMS_VOICES |
+                DMUS_AUDIOPARAMS_SAMPLERATE | DMUS_AUDIOPARAMS_DEFAULTSYNTH;
+        This->params.dwVoices = 64;
+        This->params.dwSampleRate = 22050;
+        This->params.dwFeatures = flags;
+        This->params.clsidDefaultSynth = CLSID_DirectMusicSynthSink;
+    } else
+        This->params = *params;
+
+    if (default_path_type)
+        hr = IDirectMusicPerformance8_CreateStandardAudioPath(iface, default_path_type,
+                num_channels, FALSE, &This->pDefaultPath);
 
-	PostMessageToProcessMsgThread(This, PROCESSMSG_START);
+    PostMessageToProcessMsgThread(This, PROCESSMSG_START);
 
-	return hr;
+    return hr;
 }
 
 static HRESULT WINAPI IDirectMusicPerformance8Impl_PlaySegmentEx(IDirectMusicPerformance8 *iface,




More information about the wine-cvs mailing list