Commit 3dd29128 authored by Michael Stefaniuc's avatar Michael Stefaniuc Committed by Alexandre Julliard

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

parent d966413a
...@@ -1070,16 +1070,17 @@ static HRESULT WINAPI IDirectMusicPerformance8Impl_CreateAudioPath(IDirectMusicP ...@@ -1070,16 +1070,17 @@ static HRESULT WINAPI IDirectMusicPerformance8Impl_CreateAudioPath(IDirectMusicP
} }
static HRESULT WINAPI IDirectMusicPerformance8Impl_CreateStandardAudioPath(IDirectMusicPerformance8 *iface, 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); IDirectMusicPerformance8Impl *This = impl_from_IDirectMusicPerformance8(iface);
IDirectMusicAudioPath *pPath; IDirectMusicAudioPath *pPath;
DSBUFFERDESC desc; DSBUFFERDESC desc;
WAVEFORMATEX format; WAVEFORMATEX format;
DMUS_PORTPARAMS params = {0};
IDirectSoundBuffer *buffer, *primary_buffer; IDirectSoundBuffer *buffer, *primary_buffer;
HRESULT hr = S_OK; 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) { if (NULL == ppNewPath) {
return E_POINTER; return E_POINTER;
...@@ -1126,7 +1127,13 @@ static HRESULT WINAPI IDirectMusicPerformance8Impl_CreateStandardAudioPath(IDire ...@@ -1126,7 +1127,13 @@ static HRESULT WINAPI IDirectMusicPerformance8Impl_CreateStandardAudioPath(IDire
return E_INVALIDARG; 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); hr = IDirectSound_CreateSoundBuffer(This->dsound, &desc, &buffer, NULL);
if (FAILED(hr)) if (FAILED(hr))
return DSERR_BUFFERLOST; return DSERR_BUFFERLOST;
......
...@@ -82,6 +82,7 @@ static HRESULT test_InitAudio(void) ...@@ -82,6 +82,7 @@ static HRESULT test_InitAudio(void)
IDirectSound *dsound; IDirectSound *dsound;
IDirectMusicPort *port; IDirectMusicPort *port;
IDirectMusicAudioPath *path; IDirectMusicAudioPath *path;
DWORD channel, group;
HRESULT hr; HRESULT hr;
ULONG ref; ULONG ref;
...@@ -216,6 +217,18 @@ static HRESULT test_InitAudio(void) ...@@ -216,6 +217,18 @@ static HRESULT test_InitAudio(void)
ok(ref == 2, "dmusic ref count got %d expected 2\n", ref); ok(ref == 2, "dmusic ref count got %d expected 2\n", ref);
destroy_performance(performance, dmusic, dsound); 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; return S_OK;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment