Signed-off-by: Alistair Leslie-Hughes leslie_alistair@hotmail.com --- dlls/xactengine3_7/xact_dll.c | 55 +++++++++++++++++++++++++++++++++-- 1 file changed, 53 insertions(+), 2 deletions(-)
diff --git a/dlls/xactengine3_7/xact_dll.c b/dlls/xactengine3_7/xact_dll.c index 231ef753f22..6f4f118257f 100644 --- a/dlls/xactengine3_7/xact_dll.c +++ b/dlls/xactengine3_7/xact_dll.c @@ -1066,8 +1066,59 @@ static HRESULT WINAPI IXACT3EngineImpl_PrepareStreamingWave(IXACT3Engine *iface, IXACT3Wave **ppWave) { XACT3EngineImpl *This = impl_from_IXACT3Engine(iface); - FIXME("(%p): stub!\n", This); - return E_NOTIMPL; + XACT3WaveImpl *wave; + FACTWave *fwave = NULL; + FACTStreamingParameters fakeParms; + wrap_readfile_struct *fake; + FACTWaveBankEntry fact_wavebank; + UINT ret; + + TRACE("(%p)->(0x%08x, %p, %p, %d, %p, %d, %d, %p)\n", This, dwFlags, &entry, &streamingParams, + dwAlignment, pdwSeekTable, dwPlayOffset, nLoopCount, ppWave); + + fake = (wrap_readfile_struct*) CoTaskMemAlloc( + sizeof(wrap_readfile_struct)); + fake->engine = This; + fake->file = streamingParams.file; + fakeParms.file = fake; + fakeParms.flags = streamingParams.flags; + fakeParms.offset = streamingParams.offset; + fakeParms.packetSize = streamingParams.packetSize; + + fact_wavebank.dwFlagsAndDuration = entry.dwFlagsAndDuration; + fact_wavebank.Format.dwValue = entry.Format.dwValue; + fact_wavebank.PlayRegion.dwOffset = entry.PlayRegion.dwOffset; + fact_wavebank.PlayRegion.dwLength = entry.PlayRegion.dwLength; + fact_wavebank.LoopRegion.dwStartSample = entry.LoopRegion.dwStartSample; + fact_wavebank.LoopRegion.dwTotalSamples = entry.LoopRegion.dwTotalSamples; + + /* FAudio Prototype is incorrect and shouldn't take a buffer as an parameter, + * passing through NULL to ensure it's not used. + */ + ret = FACTAudioEngine_PrepareStreamingWave(This->fact_engine, dwFlags, fact_wavebank, fakeParms, + dwAlignment, pdwSeekTable, NULL, dwPlayOffset, nLoopCount, &fwave); + + if(ret != 0 || !fwave) + { + ERR("Failed to CreateWave: %d (%p)\n", ret, fwave); + return E_FAIL; + } + + wave = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*wave)); + if (!wave) + { + FACTWave_Destroy(fwave); + ERR("Failed to allocate XACT3WaveImpl!"); + return E_OUTOFMEMORY; + } + + wave->IXACT3Wave_iface.lpVtbl = &XACT3Wave_Vtbl; + wave->fact_wave = fwave; + *ppWave = &wave->IXACT3Wave_iface; + + TRACE("Created Wave: %p\n", wave); + + return S_OK; }
static HRESULT WINAPI IXACT3EngineImpl_PrepareWave(IXACT3Engine *iface,