dmime: Split out the perf default port creation.
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
67f55f9b13
commit
d966413a49
|
@ -624,39 +624,57 @@ static HRESULT WINAPI IDirectMusicPerformance8Impl_RemoveNotificationType(IDirec
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI IDirectMusicPerformance8Impl_AddPort(IDirectMusicPerformance8 *iface,
|
static HRESULT perf_dmport_create(IDirectMusicPerformance8Impl *perf, DMUS_PORTPARAMS *params)
|
||||||
IDirectMusicPort *pPort)
|
|
||||||
{
|
{
|
||||||
IDirectMusicPerformance8Impl *This = impl_from_IDirectMusicPerformance8(iface);
|
IDirectMusicPort *port;
|
||||||
HRESULT hr = E_FAIL;
|
GUID guid;
|
||||||
|
unsigned int i;
|
||||||
|
HRESULT hr;
|
||||||
|
|
||||||
FIXME("(%p, %p): stub\n", This, pPort);
|
if (FAILED(hr = IDirectMusic8_GetDefaultPort(perf->dmusic, &guid)))
|
||||||
if (!This->dmusic)
|
return hr;
|
||||||
return DMUS_E_NOT_INIT;
|
|
||||||
if (NULL == pPort) {
|
params->dwSize = sizeof(params);
|
||||||
GUID port_guid;
|
params->dwValidParams |= DMUS_PORTPARAMS_SHARE;
|
||||||
IDirectMusicPort* pDefaultPort = NULL;
|
params->fShare = TRUE;
|
||||||
DMUS_PORTPARAMS params;
|
|
||||||
hr = IDirectMusic8_GetDefaultPort(This->dmusic, &port_guid);
|
if (FAILED(hr = IDirectMusic8_CreatePort(perf->dmusic, &guid, params, &port, NULL)))
|
||||||
if (FAILED(hr)) return hr;
|
return hr;
|
||||||
ZeroMemory(¶ms, sizeof(params));
|
if (FAILED(hr = IDirectMusicPort_Activate(port, TRUE))) {
|
||||||
params.dwSize = sizeof(params);
|
IDirectMusicPort_Release(port);
|
||||||
params.dwValidParams = DMUS_PORTPARAMS_CHANNELGROUPS | DMUS_PORTPARAMS_SHARE;
|
return hr;
|
||||||
params.dwChannelGroups = 1;
|
}
|
||||||
params.fShare = TRUE;
|
for (i = 0; i < params->dwChannelGroups; i++)
|
||||||
hr = IDirectMusic8_CreatePort(This->dmusic, &port_guid, ¶ms, &pDefaultPort, NULL);
|
pchannel_block_set(&perf->pchannels, i, port, i + 1, FALSE);
|
||||||
if (FAILED(hr)) return hr;
|
|
||||||
hr = IDirectMusicPort_Activate(pDefaultPort, TRUE);
|
return S_OK;
|
||||||
if (FAILED(hr)) { IDirectMusicPort_Release(pDefaultPort); return hr; }
|
}
|
||||||
IDirectMusicPerformance8_AssignPChannelBlock(iface, 0, pDefaultPort, 1);
|
|
||||||
} else {
|
static HRESULT WINAPI IDirectMusicPerformance8Impl_AddPort(IDirectMusicPerformance8 *iface,
|
||||||
IDirectMusicPort_AddRef(pPort);
|
IDirectMusicPort *port)
|
||||||
}
|
{
|
||||||
/**
|
IDirectMusicPerformance8Impl *This = impl_from_IDirectMusicPerformance8(iface);
|
||||||
* We should remember added Ports (for example using a list)
|
|
||||||
* and control if Port is registered for each api who use ports
|
FIXME("(%p, %p): semi-stub\n", This, port);
|
||||||
*/
|
|
||||||
return S_OK;
|
if (!This->dmusic)
|
||||||
|
return DMUS_E_NOT_INIT;
|
||||||
|
|
||||||
|
if (!port) {
|
||||||
|
DMUS_PORTPARAMS params = {
|
||||||
|
.dwValidParams = DMUS_PORTPARAMS_CHANNELGROUPS,
|
||||||
|
.dwChannelGroups = 1
|
||||||
|
};
|
||||||
|
|
||||||
|
return perf_dmport_create(This, ¶ms);
|
||||||
|
}
|
||||||
|
|
||||||
|
IDirectMusicPort_AddRef(port);
|
||||||
|
/**
|
||||||
|
* We should remember added Ports (for example using a list)
|
||||||
|
* and control if Port is registered for each api who use ports
|
||||||
|
*/
|
||||||
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI IDirectMusicPerformance8Impl_RemovePort(IDirectMusicPerformance8 *iface,
|
static HRESULT WINAPI IDirectMusicPerformance8Impl_RemovePort(IDirectMusicPerformance8 *iface,
|
||||||
|
|
Loading…
Reference in New Issue