From: Rémi Bernon rbernon@codeweavers.com
--- dlls/dmime/performance.c | 28 ++++++++++++++++------------ dlls/dmime/tests/dmime.c | 4 ++-- 2 files changed, 18 insertions(+), 14 deletions(-)
diff --git a/dlls/dmime/performance.c b/dlls/dmime/performance.c index a8c2016802c..7b606998616 100644 --- a/dlls/dmime/performance.c +++ b/dlls/dmime/performance.c @@ -50,6 +50,7 @@ struct performance /* performance channels */ struct wine_rb_tree pchannels;
+ BOOL audio_paths_enabled; IDirectMusicAudioPath *pDefaultPath; HANDLE hNotification; REFERENCE_TIME rtMinimum; @@ -730,8 +731,8 @@ static HRESULT WINAPI performance_AddPort(IDirectMusicPerformance8 *iface, IDire
FIXME("(%p, %p): semi-stub\n", This, port);
- if (!This->dmusic) - return DMUS_E_NOT_INIT; + if (!This->dmusic) return DMUS_E_NOT_INIT; + if (This->audio_paths_enabled) return DMUS_E_AUDIOPATHS_IN_USE;
if (!port) { DMUS_PORTPARAMS params = { @@ -753,11 +754,13 @@ static HRESULT WINAPI performance_AddPort(IDirectMusicPerformance8 *iface, IDire
static HRESULT WINAPI performance_RemovePort(IDirectMusicPerformance8 *iface, IDirectMusicPort *pPort) { - struct performance *This = impl_from_IDirectMusicPerformance8(iface); + struct performance *This = impl_from_IDirectMusicPerformance8(iface);
- FIXME("(%p, %p): stub\n", This, pPort); - IDirectMusicPort_Release (pPort); - return S_OK; + if (This->audio_paths_enabled) return DMUS_E_AUDIOPATHS_IN_USE; + + FIXME("(%p, %p): stub\n", This, pPort); + IDirectMusicPort_Release(pPort); + return S_OK; }
static HRESULT WINAPI performance_AssignPChannelBlock(IDirectMusicPerformance8 *iface, @@ -767,10 +770,9 @@ static HRESULT WINAPI performance_AssignPChannelBlock(IDirectMusicPerformance8 *
FIXME("(%p, %ld, %p, %ld): semi-stub\n", This, block_num, port, group);
- if (!port) - return E_POINTER; - if (block_num > MAXDWORD / 16) - return E_INVALIDARG; + if (!port) return E_POINTER; + if (block_num > MAXDWORD / 16) return E_INVALIDARG; + if (This->audio_paths_enabled) return DMUS_E_AUDIOPATHS_IN_USE;
pchannel_block_set(&This->pchannels, block_num, port, group, FALSE);
@@ -785,8 +787,8 @@ static HRESULT WINAPI performance_AssignPChannel(IDirectMusicPerformance8 *iface
FIXME("(%p)->(%ld, %p, %ld, %ld) semi-stub\n", This, pchannel, port, group, channel);
- if (!port) - return E_POINTER; + if (!port) return E_POINTER; + if (This->audio_paths_enabled) return DMUS_E_AUDIOPATHS_IN_USE;
block = pchannel_block_set(&This->pchannels, pchannel / 16, port, 0, TRUE); if (block) { @@ -959,6 +961,7 @@ static HRESULT WINAPI performance_CloseDown(IDirectMusicPerformance8 *iface) IDirectMusic8_Release(This->dmusic); This->dmusic = NULL; } + This->audio_paths_enabled = FALSE;
return S_OK; } @@ -1027,6 +1030,7 @@ static HRESULT WINAPI performance_InitAudio(IDirectMusicPerformance8 *iface, IDi dsound ? *dsound : NULL, hwnd))) return hr;
+ This->audio_paths_enabled = TRUE; if (default_path_type) { hr = IDirectMusicPerformance8_CreateStandardAudioPath(iface, default_path_type, diff --git a/dlls/dmime/tests/dmime.c b/dlls/dmime/tests/dmime.c index c1043fe90f3..119bfc74fc5 100644 --- a/dlls/dmime/tests/dmime.c +++ b/dlls/dmime/tests/dmime.c @@ -1937,9 +1937,9 @@ static void test_performance_InitAudio(void) ok(hr == S_OK, "PChannelInfo failed, got %#lx\n", hr); ok(port != NULL, "IDirectMusicPort not set\n"); hr = IDirectMusicPerformance8_AssignPChannel(performance, 0, port, 0, 0); - todo_wine ok(hr == DMUS_E_AUDIOPATHS_IN_USE, "AssignPChannel failed (%#lx)\n", hr); + ok(hr == DMUS_E_AUDIOPATHS_IN_USE, "AssignPChannel failed (%#lx)\n", hr); hr = IDirectMusicPerformance8_AssignPChannelBlock(performance, 0, port, 0); - todo_wine ok(hr == DMUS_E_AUDIOPATHS_IN_USE, "AssignPChannelBlock failed (%#lx)\n", hr); + ok(hr == DMUS_E_AUDIOPATHS_IN_USE, "AssignPChannelBlock failed (%#lx)\n", hr); IDirectMusicPort_Release(port);
hr = IDirectMusicPerformance8_GetDefaultAudioPath(performance, &path);