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

Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Michael Stefaniuc 2020-02-14 01:21:06 +01:00 committed by Alexandre Julliard
parent d966413a49
commit 3dd2912874
2 changed files with 23 additions and 3 deletions

View File

@ -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;

View File

@ -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;
}