diff --git a/patches/dmime_segment_getaudiopath/0001-dmime-Semi-implement-IDirectMusicSegment-GetAudioPat.patch b/patches/dmime_segment_getaudiopath/0001-dmime-Semi-implement-IDirectMusicSegment-GetAudioPat.patch new file mode 100644 index 00000000..45bef9d3 --- /dev/null +++ b/patches/dmime_segment_getaudiopath/0001-dmime-Semi-implement-IDirectMusicSegment-GetAudioPat.patch @@ -0,0 +1,177 @@ +From 77236eab74a9c09a54feec3985ffd732faf52120 Mon Sep 17 00:00:00 2001 +From: Alistair Leslie-Hughes +Date: Fri, 1 Nov 2024 17:59:51 +1100 +Subject: [PATCH] dmime: Semi implement + IDirectMusicSegment::GetAudioPathConfig. + +--- + dlls/dmime/audiopath.c | 97 ++++++++++++++++++++++------------------ + dlls/dmime/performance.c | 4 +- + dlls/dmime/segment.c | 6 +++ + 3 files changed, 61 insertions(+), 46 deletions(-) + +diff --git a/dlls/dmime/audiopath.c b/dlls/dmime/audiopath.c +index 3389f965b8f..501eecf234c 100644 +--- a/dlls/dmime/audiopath.c ++++ b/dlls/dmime/audiopath.c +@@ -649,18 +649,21 @@ HRESULT path_config_get_audio_path_params(IUnknown *iface, WAVEFORMATEX *format, + { + struct audio_path_config *This = impl_from_IUnknown(iface); + struct list *first_port_config, *first_pchannel_to_buffer; +- struct audio_path_port_config *port_config; +- struct audio_path_pchannel_to_buffer *pchannel_to_buffer; ++ struct audio_path_port_config *port_config = NULL; ++ struct audio_path_pchannel_to_buffer *pchannel_to_buffer = NULL; + GUID *guids; + + first_port_config = list_head(&This->port_config_entries); +- if (list_next(&This->port_config_entries, first_port_config)) +- FIXME("Only one port config supported. %p -> %p\n", first_port_config, list_next(&This->port_config_entries, first_port_config)); +- port_config = LIST_ENTRY(first_port_config, struct audio_path_port_config, entry); +- first_pchannel_to_buffer = list_head(&port_config->pchannel_to_buffer_entries); +- if (list_next(&port_config->pchannel_to_buffer_entries, first_pchannel_to_buffer)) +- FIXME("Only one pchannel to buffer entry supported.\n"); +- pchannel_to_buffer = LIST_ENTRY(first_pchannel_to_buffer, struct audio_path_pchannel_to_buffer, entry); ++ if (first_port_config) ++ { ++ if (list_next(&This->port_config_entries, first_port_config)) ++ FIXME("Only one port config supported. %p -> %p\n", first_port_config, list_next(&This->port_config_entries, first_port_config)); ++ port_config = LIST_ENTRY(first_port_config, struct audio_path_port_config, entry); ++ first_pchannel_to_buffer = list_head(&port_config->pchannel_to_buffer_entries); ++ if (list_next(&port_config->pchannel_to_buffer_entries, first_pchannel_to_buffer)) ++ FIXME("Only one pchannel to buffer entry supported.\n"); ++ pchannel_to_buffer = LIST_ENTRY(first_pchannel_to_buffer, struct audio_path_pchannel_to_buffer, entry); ++ } + + /* Secondary buffer description */ + memset(format, 0, sizeof(*format)); +@@ -680,50 +683,56 @@ HRESULT path_config_get_audio_path_params(IUnknown *iface, WAVEFORMATEX *format, + desc->lpwfxFormat = format; + desc->guid3DAlgorithm = GUID_NULL; + +- guids = pchannel_to_buffer->guids; +- if (pchannel_to_buffer->header.dwBufferCount == 2) ++ if (pchannel_to_buffer) + { +- if ((!IsEqualGUID(&guids[0], &GUID_Buffer_Reverb) && !IsEqualGUID(&guids[0], &GUID_Buffer_Stereo)) || +- (!IsEqualGUID(&guids[1], &GUID_Buffer_Reverb) && !IsEqualGUID(&guids[1], &GUID_Buffer_Stereo)) || +- IsEqualGUID(&guids[0], &guids[1])) +- FIXME("Only a stereo plus reverb buffer is supported\n"); +- else ++ guids = pchannel_to_buffer->guids; ++ if (pchannel_to_buffer->header.dwBufferCount == 2) + { +- desc->dwFlags |= DSBCAPS_CTRLPAN | DSBCAPS_CTRLFREQUENCY; +- format->nChannels = 2; +- format->nBlockAlign *= 2; +- format->nAvgBytesPerSec *= 2; ++ if ((!IsEqualGUID(&guids[0], &GUID_Buffer_Reverb) && !IsEqualGUID(&guids[0], &GUID_Buffer_Stereo)) || ++ (!IsEqualGUID(&guids[1], &GUID_Buffer_Reverb) && !IsEqualGUID(&guids[1], &GUID_Buffer_Stereo)) || ++ IsEqualGUID(&guids[0], &guids[1])) ++ FIXME("Only a stereo plus reverb buffer is supported\n"); ++ else ++ { ++ desc->dwFlags |= DSBCAPS_CTRLPAN | DSBCAPS_CTRLFREQUENCY; ++ format->nChannels = 2; ++ format->nBlockAlign *= 2; ++ format->nAvgBytesPerSec *= 2; ++ } + } +- } +- else if (pchannel_to_buffer->header.dwBufferCount == 1) +- { +- if (IsEqualGUID(guids, &GUID_Buffer_Stereo)) ++ else if (pchannel_to_buffer->header.dwBufferCount == 1) + { +- desc->dwFlags |= DSBCAPS_CTRLPAN | DSBCAPS_CTRLFREQUENCY; +- format->nChannels = 2; +- format->nBlockAlign *= 2; +- format->nAvgBytesPerSec *= 2; ++ if (IsEqualGUID(guids, &GUID_Buffer_Stereo)) ++ { ++ desc->dwFlags |= DSBCAPS_CTRLPAN | DSBCAPS_CTRLFREQUENCY; ++ format->nChannels = 2; ++ format->nBlockAlign *= 2; ++ format->nAvgBytesPerSec *= 2; ++ } ++ else if (IsEqualGUID(guids, &GUID_Buffer_3D_Dry)) ++ desc->dwFlags |= DSBCAPS_CTRL3D | DSBCAPS_CTRLFREQUENCY | DSBCAPS_MUTE3DATMAXDISTANCE; ++ else if (IsEqualGUID(guids, &GUID_Buffer_Mono)) ++ desc->dwFlags |= DSBCAPS_CTRLPAN | DSBCAPS_CTRLFREQUENCY; ++ else ++ FIXME("Unsupported buffer guid %s\n", debugstr_dmguid(guids)); + } +- else if (IsEqualGUID(guids, &GUID_Buffer_3D_Dry)) +- desc->dwFlags |= DSBCAPS_CTRL3D | DSBCAPS_CTRLFREQUENCY | DSBCAPS_MUTE3DATMAXDISTANCE; +- else if (IsEqualGUID(guids, &GUID_Buffer_Mono)) +- desc->dwFlags |= DSBCAPS_CTRLPAN | DSBCAPS_CTRLFREQUENCY; + else +- FIXME("Unsupported buffer guid %s\n", debugstr_dmguid(guids)); ++ FIXME("Multiple buffers not supported\n"); + } +- else +- FIXME("Multiple buffers not supported\n"); + +- *params = port_config->params; +- if (!(params->dwValidParams & DMUS_PORTPARAMS_CHANNELGROUPS)) +- { +- params->dwValidParams |= DMUS_PORTPARAMS_CHANNELGROUPS; +- params->dwChannelGroups = (port_config->header.dwPChannelCount + 15) / 16; +- } +- if (!(params->dwValidParams & DMUS_PORTPARAMS_AUDIOCHANNELS)) ++ if (port_config) + { +- params->dwValidParams |= DMUS_PORTPARAMS_AUDIOCHANNELS; +- params->dwAudioChannels = format->nChannels; ++ *params = port_config->params; ++ if (!(params->dwValidParams & DMUS_PORTPARAMS_CHANNELGROUPS)) ++ { ++ params->dwValidParams |= DMUS_PORTPARAMS_CHANNELGROUPS; ++ params->dwChannelGroups = (port_config->header.dwPChannelCount + 15) / 16; ++ } ++ if (!(params->dwValidParams & DMUS_PORTPARAMS_AUDIOCHANNELS)) ++ { ++ params->dwValidParams |= DMUS_PORTPARAMS_AUDIOCHANNELS; ++ params->dwAudioChannels = format->nChannels; ++ } + } + return S_OK; + } +diff --git a/dlls/dmime/performance.c b/dlls/dmime/performance.c +index 500bc8b536f..cc83d96872a 100644 +--- a/dlls/dmime/performance.c ++++ b/dlls/dmime/performance.c +@@ -1678,11 +1678,11 @@ static HRESULT WINAPI performance_CreateAudioPath(IDirectMusicPerformance8 *ifac + ERR("Unexpected object class %s for source config.\n", debugstr_dmguid(&objDesc.guidClass)); + return E_INVALIDARG; + } +- ++FIXME("4\n"); + hr = path_config_get_audio_path_params(pSourceConfig, &format, &desc, &port_params); + if (FAILED(hr)) + return hr; +- ++FIXME("5\n"); + hr = perf_dmport_create(This, &port_params); + if (FAILED(hr)) + return hr; +diff --git a/dlls/dmime/segment.c b/dlls/dmime/segment.c +index b96f0e2e401..36860b7c762 100644 +--- a/dlls/dmime/segment.c ++++ b/dlls/dmime/segment.c +@@ -516,6 +516,12 @@ static HRESULT WINAPI segment_GetAudioPathConfig(IDirectMusicSegment8 *iface, IU + { + struct segment *This = impl_from_IDirectMusicSegment8(iface); + FIXME("(%p, %p): stub\n", This, ppAudioPathConfig); ++ ++ if (!ppAudioPathConfig) ++ return E_POINTER; ++ ++ create_dmaudiopath_config(&IID_IUnknown, (void**)ppAudioPathConfig); ++ + return S_OK; + } + +-- +2.45.2 + diff --git a/patches/dmime_segment_getaudiopath/definition b/patches/dmime_segment_getaudiopath/definition new file mode 100644 index 00000000..afb6450d --- /dev/null +++ b/patches/dmime_segment_getaudiopath/definition @@ -0,0 +1 @@ +Fixes: [56699] dmime: Semi-Implement IDirectMusicSegment8::GetAudioPathConfig