Module: wine Branch: master Commit: 127ef80f0f9370a148357b7c1f001c3477a52264 URL: https://source.winehq.org/git/wine.git/?a=commit;h=127ef80f0f9370a148357b7c1...
Author: Vijay Kiran Kamuju infyquest@gmail.com Date: Sat Jul 18 22:27:46 2020 +0200
xactengine3_7: Implement IXACT3SoundBank::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 267863f930..2c7eff08fc 100644 --- a/dlls/xactengine3_7/xact_dll.c +++ b/dlls/xactengine3_7/xact_dll.c @@ -269,9 +269,40 @@ static HRESULT WINAPI IXACT3SoundBankImpl_Play(IXACT3SoundBank *iface, IXACT3Cue** ppCue) { XACT3SoundBankImpl *This = impl_from_IXACT3SoundBank(iface); - FIXME("(%p)->(%u, 0x%x, %u, %p): stub!\n", This, nCueIndex, dwFlags, timeOffset, + XACT3CueImpl *cue; + FACTCue *fcue; + HRESULT hr; + + TRACE("(%p)->(%u, 0x%x, %u, %p)\n", This, nCueIndex, dwFlags, timeOffset, ppCue); - 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 (ppCue == NULL){ + hr = FACTSoundBank_Play(This->fact_soundbank, nCueIndex, dwFlags, + timeOffset, NULL); + }else{ + hr = FACTSoundBank_Play(This->fact_soundbank, nCueIndex, dwFlags, + timeOffset, &fcue); + if(FAILED(hr)) + return hr; + + cue = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*cue)); + if (!cue) + { + FACTCue_Destroy(fcue); + ERR("Failed to allocate XACT3CueImpl!"); + return E_OUTOFMEMORY; + } + + cue->IXACT3Cue_iface.lpVtbl = &XACT3Cue_Vtbl; + cue->fact_cue = fcue; + *ppCue = (IXACT3Cue*)&cue->IXACT3Cue_iface; + } + + return hr; }
static HRESULT WINAPI IXACT3SoundBankImpl_Stop(IXACT3SoundBank *iface,