Vijay Kiran Kamuju : xactengine3_7: Implement IXACT3Engine::RegisterNotification and IXACT3Engine::UnRegisterNotification functions.
Alexandre Julliard
julliard at winehq.org
Thu Aug 6 16:33:43 CDT 2020
Module: wine
Branch: master
Commit: 81b5e2d112c2c3680da268ab1afce1d2f6b08312
URL: https://source.winehq.org/git/wine.git/?a=commit;h=81b5e2d112c2c3680da268ab1afce1d2f6b08312
Author: Vijay Kiran Kamuju <infyquest at gmail.com>
Date: Sat Jul 18 22:59:25 2020 +0200
xactengine3_7: Implement IXACT3Engine::RegisterNotification and IXACT3Engine::UnRegisterNotification functions.
Based on patches from Ethan Lee and Alistair Leslie-Hughes.
Signed-off-by: Vijay Kiran Kamuju <infyquest at gmail.com>
Signed-off-by: Alistair Leslie-Hughes <leslie_alistair at hotmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/xactengine3_7/xact_dll.c | 100 ++++++++++++++++++++++++++++++++++++++++--
1 file changed, 96 insertions(+), 4 deletions(-)
diff --git a/dlls/xactengine3_7/xact_dll.c b/dlls/xactengine3_7/xact_dll.c
index ce9059221a..cb8aed5f3a 100644
--- a/dlls/xactengine3_7/xact_dll.c
+++ b/dlls/xactengine3_7/xact_dll.c
@@ -967,22 +967,114 @@ static HRESULT WINAPI IXACT3EngineImpl_PrepareWave(IXACT3Engine *iface,
return E_NOTIMPL;
}
+enum {
+ NOTIFY_SoundBank = 0x01,
+ NOTIFY_WaveBank = 0x02,
+ NOTIFY_Cue = 0x04,
+ NOTIFY_Wave = 0x08,
+ NOTIFY_cueIndex = 0x10,
+ NOTIFY_waveIndex = 0x20
+};
+
+static inline void unwrap_notificationdesc(FACTNotificationDescription *fd,
+ const XACT_NOTIFICATION_DESCRIPTION *xd)
+{
+ DWORD flags = 0;
+
+ TRACE("Type %d\n", xd->type);
+
+ memset(fd, 0, sizeof(*fd));
+
+ /* Supports SoundBank, Cue index, Cue instance */
+ if (xd->type == XACTNOTIFICATIONTYPE_CUEPREPARED || xd->type == XACTNOTIFICATIONTYPE_CUEPLAY ||
+ xd->type == XACTNOTIFICATIONTYPE_CUESTOP || xd->type == XACTNOTIFICATIONTYPE_CUEDESTROYED ||
+ xd->type == XACTNOTIFICATIONTYPE_MARKER || xd->type == XACTNOTIFICATIONTYPE_LOCALVARIABLECHANGED)
+ {
+ flags = NOTIFY_SoundBank | NOTIFY_cueIndex | NOTIFY_Cue;
+ }
+ /* Supports WaveBank */
+ else if (xd->type == XACTNOTIFICATIONTYPE_WAVEBANKDESTROYED || xd->type == XACTNOTIFICATIONTYPE_WAVEBANKPREPARED ||
+ xd->type == XACTNOTIFICATIONTYPE_WAVEBANKSTREAMING_INVALIDCONTENT)
+ {
+ flags = NOTIFY_WaveBank;
+ }
+ /* Supports NOTIFY_SoundBank */
+ else if (xd->type == XACTNOTIFICATIONTYPE_SOUNDBANKDESTROYED)
+ {
+ flags = NOTIFY_SoundBank;
+ }
+ /* Supports WaveBank, Wave index, Wave instance */
+ else if (xd->type == XACTNOTIFICATIONTYPE_WAVEPREPARED || xd->type == XACTNOTIFICATIONTYPE_WAVEDESTROYED)
+ {
+ flags = NOTIFY_WaveBank | NOTIFY_waveIndex | NOTIFY_Wave;
+ }
+ /* Supports SoundBank, SoundBank, Cue index, Cue instance, WaveBank, Wave instance */
+ else if (xd->type == XACTNOTIFICATIONTYPE_WAVEPLAY || xd->type == XACTNOTIFICATIONTYPE_WAVESTOP ||
+ xd->type == XACTNOTIFICATIONTYPE_WAVELOOPED)
+ {
+ flags = NOTIFY_SoundBank | NOTIFY_cueIndex | NOTIFY_Cue | NOTIFY_WaveBank | NOTIFY_Wave;
+ }
+
+ /* We have to unwrap the FACT object first! */
+ fd->type = xd->type;
+ fd->flags = xd->flags;
+ fd->pvContext = xd->pvContext;
+ if (flags & NOTIFY_cueIndex)
+ fd->cueIndex = xd->cueIndex;
+ if (flags & NOTIFY_waveIndex)
+ fd->waveIndex = xd->waveIndex;
+
+ if (flags & NOTIFY_Cue && xd->pCue != NULL)
+ {
+ XACT3CueImpl *cue = impl_from_IXACT3Cue(xd->pCue);
+ if (cue)
+ fd->pCue = cue->fact_cue;
+ }
+
+ if (flags & NOTIFY_SoundBank && xd->pSoundBank != NULL)
+ {
+ XACT3SoundBankImpl *sound = impl_from_IXACT3SoundBank(xd->pSoundBank);
+ if (sound)
+ fd->pSoundBank = sound->fact_soundbank;
+ }
+
+ if (flags & NOTIFY_WaveBank && xd->pWaveBank != NULL)
+ {
+ XACT3WaveBankImpl *bank = impl_from_IXACT3WaveBank(xd->pWaveBank);
+ if (bank)
+ fd->pWaveBank = bank->fact_wavebank;
+ }
+
+ if (flags & NOTIFY_Wave && xd->pWave != NULL)
+ {
+ XACT3WaveImpl *wave = impl_from_IXACT3Wave(xd->pWave);
+ if (wave)
+ fd->pWave = wave->fact_wave;
+ }
+}
+
static HRESULT WINAPI IXACT3EngineImpl_RegisterNotification(IXACT3Engine *iface,
const XACT_NOTIFICATION_DESCRIPTION *pNotificationDesc)
{
XACT3EngineImpl *This = impl_from_IXACT3Engine(iface);
+ FACTNotificationDescription fdesc;
- FIXME("(%p)->(%p): stub!\n", This, pNotificationDesc);
- return E_NOTIMPL;
+ TRACE("(%p)->(%p)\n", This, pNotificationDesc);
+
+ unwrap_notificationdesc(&fdesc, pNotificationDesc);
+ return FACTAudioEngine_RegisterNotification(This->fact_engine, &fdesc);
}
static HRESULT WINAPI IXACT3EngineImpl_UnRegisterNotification(IXACT3Engine *iface,
const XACT_NOTIFICATION_DESCRIPTION *pNotificationDesc)
{
XACT3EngineImpl *This = impl_from_IXACT3Engine(iface);
+ FACTNotificationDescription fdesc;
- FIXME("(%p)->(%p): stub!\n", This, pNotificationDesc);
- return E_NOTIMPL;
+ TRACE("(%p)->(%p)\n", This, pNotificationDesc);
+
+ unwrap_notificationdesc(&fdesc, pNotificationDesc);
+ return FACTAudioEngine_UnRegisterNotification(This->fact_engine, &fdesc);
}
static XACTCATEGORY WINAPI IXACT3EngineImpl_GetCategory(IXACT3Engine *iface,
More information about the wine-cvs
mailing list