Module: wine Branch: master Commit: 26011d2d3e3c0d616ef8c738c7941bffcb919396 URL: http://source.winehq.org/git/wine.git/?a=commit;h=26011d2d3e3c0d616ef8c738c7...
Author: Michael Stefaniuc mstefani@winehq.org Date: Thu May 11 11:05:48 2017 +0200
dmime: Do not use Init() from InitAudio().
Signed-off-by: Michael Stefaniuc mstefani@winehq.org Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/dmime/performance.c | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-)
diff --git a/dlls/dmime/performance.c b/dlls/dmime/performance.c index 292ae80..2bd34d5 100644 --- a/dlls/dmime/performance.c +++ b/dlls/dmime/performance.c @@ -892,17 +892,30 @@ static HRESULT WINAPI IDirectMusicPerformance8Impl_RhythmToTime(IDirectMusicPerf
/* IDirectMusicPerformance8 Interface part follow: */ static HRESULT WINAPI IDirectMusicPerformance8Impl_InitAudio(IDirectMusicPerformance8 *iface, - IDirectMusic **ppDirectMusic, IDirectSound **dsound, HWND hwnd, + IDirectMusic **dmusic, IDirectSound **dsound, HWND hwnd, DWORD dwDefaultPathType, DWORD dwPChannelCount, DWORD dwFlags, DMUS_AUDIOPARAMS* pParams) { IDirectMusicPerformance8Impl *This = impl_from_IDirectMusicPerformance8(iface); HRESULT hr = S_OK;
- TRACE("(%p, %p, %p, %p, %x, %u, %x, %p)\n", This, ppDirectMusic, dsound, hwnd, dwDefaultPathType, dwPChannelCount, dwFlags, pParams); + TRACE("(%p, %p, %p, %p, %x, %u, %x, %p)\n", This, dmusic, dsound, hwnd, dwDefaultPathType, + dwPChannelCount, dwFlags, pParams);
if (This->dmusic) return DMUS_E_ALREADY_INITED;
+ if (!dmusic || !*dmusic) { + hr = CoCreateInstance(&CLSID_DirectMusic, NULL, CLSCTX_INPROC_SERVER, &IID_IDirectMusic8, + (void **)&This->dmusic); + if (FAILED(hr)) + return hr; + if (dmusic) + *dmusic = (IDirectMusic *)This->dmusic; + } else + This->dmusic = (IDirectMusic8 *)*dmusic; + if (dmusic) + IDirectMusic8_AddRef(This->dmusic); + if (!dsound || !*dsound) { hr = DirectSoundCreate8(NULL, (IDirectSound8 **)&This->dsound, NULL); if (FAILED(hr)) @@ -913,12 +926,8 @@ static HRESULT WINAPI IDirectMusicPerformance8Impl_InitAudio(IDirectMusicPerform *dsound = This->dsound; } else This->dsound = *dsound; - - IDirectMusicPerformance8_Init(iface, ppDirectMusic, This->dsound, hwnd); - - /* Init increases the ref count of the dsound object. Decrement it if the app doesn't want a pointer to the object. */ - if (!dsound) - IDirectSound_Release(This->dsound); + if (dsound) + IDirectSound_AddRef(This->dsound);
/* as seen in msdn we need params init before audio path creation */ if (NULL != pParams) {