Module: wine Branch: master Commit: 00c5e09fafa51fe536b300eb02d17a7b9baded24 URL: https://source.winehq.org/git/wine.git/?a=commit;h=00c5e09fafa51fe536b300eb0...
Author: Vijay Kiran Kamuju infyquest@gmail.com Date: Sat Jul 18 22:54:07 2020 +0200
xactengine3_7: Implement IXACT3WaveBank::Play function.
Based on patch from Ethan Lee.
Signed-off-by: Vijay Kiran Kamuju infyquest@gmail.com Signed-off-by: Alistair Leslie-Hughes leslie_alistair@hotmail.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/xactengine3_7/xact_dll.c | 35 +++++++++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-)
diff --git a/dlls/xactengine3_7/xact_dll.c b/dlls/xactengine3_7/xact_dll.c index 2c7eff08fc..ce9059221a 100644 --- a/dlls/xactengine3_7/xact_dll.c +++ b/dlls/xactengine3_7/xact_dll.c @@ -559,9 +559,40 @@ static HRESULT WINAPI IXACT3WaveBankImpl_Play(IXACT3WaveBank *iface, XACTLOOPCOUNT nLoopCount, IXACT3Wave** ppWave) { XACT3WaveBankImpl *This = impl_from_IXACT3WaveBank(iface); - FIXME("(%p)->(0x%x, %u, 0x%x, %u, %p): stub!\n", This, nWaveIndex, dwFlags, dwPlayOffset, + XACT3WaveImpl *wave; + FACTWave *fwave; + HRESULT hr; + + TRACE("(%p)->(0x%x, %u, 0x%x, %u, %p)\n", This, nWaveIndex, dwFlags, dwPlayOffset, nLoopCount, ppWave); - return E_NOTIMPL; + + /* If the application doesn't want a handle, don't generate one at all. + * Let the engine handle that memory instead. + * -flibit + */ + if (ppWave == NULL){ + hr = FACTWaveBank_Play(This->fact_wavebank, nWaveIndex, dwFlags, + dwPlayOffset, nLoopCount, NULL); + }else{ + hr = FACTWaveBank_Play(This->fact_wavebank, nWaveIndex, dwFlags, + dwPlayOffset, nLoopCount, &fwave); + if(FAILED(hr)) + return hr; + + 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 = (IXACT3Wave*)wave; + } + + return hr; }
static HRESULT WINAPI IXACT3WaveBankImpl_Stop(IXACT3WaveBank *iface,