[PATCH 3/6] xactengine2_0: New DLL.

Zebediah Figura z.figura12 at gmail.com
Mon Apr 19 16:31:22 CDT 2021


From: Zebediah Figura <zfigura at codeweavers.com>

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=41048
Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
---
Changes from wine-staging patch set: instead of using a new source file, share
source with xactengine3_7. Apart from a few changed fields and methods, and
IXACT* -> IXACT3* naming, the implementation is almost entirely identical.

I've also omitted DLLs not currently known to be required by any
application—this so as to save space and time; obviously they can be added later
as needed.

 configure                             |   3 +
 configure.ac                          |   2 +
 dlls/xactengine2_0/Makefile.in        |  11 ++
 dlls/xactengine2_0/xactengine2_0.spec |   4 +
 dlls/xactengine3_7/xact_classes.idl   |   4 +-
 dlls/xactengine3_7/xact_dll.c         | 162 +++++++++++++++++++++-----
 6 files changed, 158 insertions(+), 28 deletions(-)
 create mode 100644 dlls/xactengine2_0/Makefile.in
 create mode 100644 dlls/xactengine2_0/xactengine2_0.spec

diff --git a/configure b/configure
index 9d1df64891b..d7a88f0f499 100755
--- a/configure
+++ b/configure
@@ -1727,6 +1727,7 @@ enable_x3daudio1_4
 enable_x3daudio1_5
 enable_x3daudio1_6
 enable_x3daudio1_7
+enable_xactengine2_0
 enable_xactengine3_0
 enable_xactengine3_1
 enable_xactengine3_2
@@ -16424,6 +16425,7 @@ then
     enable_x3daudio1_5=${enable_x3daudio1_5:-no}
     enable_x3daudio1_6=${enable_x3daudio1_6:-no}
     enable_x3daudio1_7=${enable_x3daudio1_7:-no}
+    enable_xactengine2_0=${enable_xactengine2_0:-no}
     enable_xactengine3_0=${enable_xactengine3_0:-no}
     enable_xactengine3_1=${enable_xactengine3_1:-no}
     enable_xactengine3_2=${enable_xactengine3_2:-no}
@@ -21209,6 +21211,7 @@ wine_fn_config_makefile dlls/x3daudio1_4 enable_x3daudio1_4
 wine_fn_config_makefile dlls/x3daudio1_5 enable_x3daudio1_5
 wine_fn_config_makefile dlls/x3daudio1_6 enable_x3daudio1_6
 wine_fn_config_makefile dlls/x3daudio1_7 enable_x3daudio1_7
+wine_fn_config_makefile dlls/xactengine2_0 enable_xactengine2_0
 wine_fn_config_makefile dlls/xactengine3_0 enable_xactengine3_0
 wine_fn_config_makefile dlls/xactengine3_1 enable_xactengine3_1
 wine_fn_config_makefile dlls/xactengine3_2 enable_xactengine3_2
diff --git a/configure.ac b/configure.ac
index 30bbe7bc5cd..7f966e744a1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1915,6 +1915,7 @@ then
     enable_x3daudio1_5=${enable_x3daudio1_5:-no}
     enable_x3daudio1_6=${enable_x3daudio1_6:-no}
     enable_x3daudio1_7=${enable_x3daudio1_7:-no}
+    enable_xactengine2_0=${enable_xactengine2_0:-no}
     enable_xactengine3_0=${enable_xactengine3_0:-no}
     enable_xactengine3_1=${enable_xactengine3_1:-no}
     enable_xactengine3_2=${enable_xactengine3_2:-no}
@@ -3892,6 +3893,7 @@ WINE_CONFIG_MAKEFILE(dlls/x3daudio1_4)
 WINE_CONFIG_MAKEFILE(dlls/x3daudio1_5)
 WINE_CONFIG_MAKEFILE(dlls/x3daudio1_6)
 WINE_CONFIG_MAKEFILE(dlls/x3daudio1_7)
+WINE_CONFIG_MAKEFILE(dlls/xactengine2_0)
 WINE_CONFIG_MAKEFILE(dlls/xactengine3_0)
 WINE_CONFIG_MAKEFILE(dlls/xactengine3_1)
 WINE_CONFIG_MAKEFILE(dlls/xactengine3_2)
diff --git a/dlls/xactengine2_0/Makefile.in b/dlls/xactengine2_0/Makefile.in
new file mode 100644
index 00000000000..3196ecd9b5a
--- /dev/null
+++ b/dlls/xactengine2_0/Makefile.in
@@ -0,0 +1,11 @@
+MODULE    = xactengine2_0.dll
+IMPORTS   = ole32 uuid
+EXTRADEFS = -DXACT3_VER=0x0200
+PARENTSRC = ../xactengine3_7
+EXTRALIBS = $(FAUDIO_LIBS)
+EXTRAINCL = $(FAUDIO_CFLAGS)
+
+C_SRCS = \
+	xact_dll.c
+
+IDL_SRCS = xact_classes.idl
diff --git a/dlls/xactengine2_0/xactengine2_0.spec b/dlls/xactengine2_0/xactengine2_0.spec
new file mode 100644
index 00000000000..b16365d0c9f
--- /dev/null
+++ b/dlls/xactengine2_0/xactengine2_0.spec
@@ -0,0 +1,4 @@
+@ stdcall -private DllCanUnloadNow()
+@ stdcall -private DllGetClassObject(ptr ptr ptr)
+@ stdcall -private DllRegisterServer()
+@ stdcall -private DllUnregisterServer()
diff --git a/dlls/xactengine3_7/xact_classes.idl b/dlls/xactengine3_7/xact_classes.idl
index 40c00f4ff06..91a9c19ff67 100644
--- a/dlls/xactengine3_7/xact_classes.idl
+++ b/dlls/xactengine3_7/xact_classes.idl
@@ -22,7 +22,9 @@
 
 [
     threading(both),
-#if XACT3_VER == 0x0300
+#if XACT3_VER == 0x0200
+    uuid(0aa000aa-f404-11d9-bd7a-0010dc4f8f81)
+#elif XACT3_VER == 0x0300
     uuid(3b80ee2a-b0f5-4780-9e30-90cb39685b03)
 #elif XACT3_VER == 0x0301
     uuid(962f5027-99be-4692-a468-85802cf8de61)
diff --git a/dlls/xactengine3_7/xact_dll.c b/dlls/xactengine3_7/xact_dll.c
index 3fbb4875930..4f68c7ee74d 100644
--- a/dlls/xactengine3_7/xact_dll.c
+++ b/dlls/xactengine3_7/xact_dll.c
@@ -25,12 +25,31 @@
 #define COBJMACROS
 
 #include "initguid.h"
+#if XACT3_VER < 0x0300
+#include "xact.h"
+#else
 #include "xact3.h"
+#endif
 #include "rpcproxy.h"
 #include "wine/debug.h"
 
 WINE_DEFAULT_DEBUG_CHANNEL(xact3);
 
+#if XACT3_VER < 0x0300
+#define IID_IXACT3Engine IID_IXACTEngine
+#define IXACT3Cue IXACTCue
+#define IXACT3CueVtbl IXACTCueVtbl
+#define IXACT3Engine IXACTEngine
+#define IXACT3EngineVtbl IXACTEngineVtbl
+#define IXACT3Engine_QueryInterface IXACTEngine_QueryInterface
+#define IXACT3SoundBank IXACTSoundBank
+#define IXACT3SoundBankVtbl IXACTSoundBankVtbl
+#define IXACT3Wave IXACTWave
+#define IXACT3WaveVtbl IXACTWaveVtbl
+#define IXACT3WaveBank IXACTWaveBank
+#define IXACT3WaveBankVtbl IXACTWaveBankVtbl
+#endif
+
 static HINSTANCE instance;
 
 typedef struct _XACT3CueImpl {
@@ -84,6 +103,39 @@ static HRESULT WINAPI IXACT3CueImpl_Destroy(IXACT3Cue *iface)
     return S_OK;
 }
 
+#if XACT3_VER < 0x0300
+
+static HRESULT WINAPI IXACT3CueImpl_GetChannelMap(IXACT3Cue *iface,
+        XACTCHANNELMAP *map, DWORD size, DWORD *needed_size)
+{
+    FIXME("(%p)->(%p, %u, %p)\n", iface, map, size, needed_size);
+
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI IXACT3CueImpl_SetChannelMap(IXACT3Cue *iface, XACTCHANNELMAP *map)
+{
+    FIXME("(%p)->(%p)\n", iface, map);
+
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI IXACT3CueImpl_GetChannelVolume(IXACT3Cue *iface, XACTCHANNELVOLUME *volume)
+{
+    FIXME("(%p)->(%p)\n", iface, volume);
+
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI IXACT3CueImpl_SetChannelVolume(IXACT3Cue *iface, XACTCHANNELVOLUME *volume)
+{
+    FIXME("(%p)->(%p)\n", iface, volume);
+
+    return E_NOTIMPL;
+}
+
+#endif
+
 static HRESULT WINAPI IXACT3CueImpl_SetMatrixCoefficients(IXACT3Cue *iface,
         UINT32 uSrcChannelCount, UINT32 uDstChannelCount,
         float *pMatrixCoefficients)
@@ -136,6 +188,7 @@ static HRESULT WINAPI IXACT3CueImpl_Pause(IXACT3Cue *iface, BOOL fPause)
     return FACTCue_Pause(This->fact_cue, fPause);
 }
 
+#if XACT3_VER >= 0x0205
 static HRESULT WINAPI IXACT3CueImpl_GetProperties(IXACT3Cue *iface,
         XACT_CUE_INSTANCE_PROPERTIES **ppProperties)
 {
@@ -152,7 +205,9 @@ static HRESULT WINAPI IXACT3CueImpl_GetProperties(IXACT3Cue *iface,
     *ppProperties = (XACT_CUE_INSTANCE_PROPERTIES*) fProps;
     return hr;
 }
+#endif
 
+#if XACT3_VER >= 0x0300
 static HRESULT WINAPI IXACT3CueImpl_SetOutputVoices(IXACT3Cue *iface,
         const XAUDIO2_VOICE_SENDS *pSendList)
 {
@@ -170,6 +225,7 @@ static HRESULT WINAPI IXACT3CueImpl_SetOutputVoiceMatrix(IXACT3Cue *iface,
             DestinationChannels, pLevelMatrix);
     return S_OK;
 }
+#endif
 
 static const IXACT3CueVtbl XACT3Cue_Vtbl =
 {
@@ -177,14 +233,24 @@ static const IXACT3CueVtbl XACT3Cue_Vtbl =
     IXACT3CueImpl_Stop,
     IXACT3CueImpl_GetState,
     IXACT3CueImpl_Destroy,
+#if XACT3_VER < 0x0300
+    IXACT3CueImpl_GetChannelMap,
+    IXACT3CueImpl_SetChannelMap,
+    IXACT3CueImpl_GetChannelVolume,
+    IXACT3CueImpl_SetChannelVolume,
+#endif
     IXACT3CueImpl_SetMatrixCoefficients,
     IXACT3CueImpl_GetVariableIndex,
     IXACT3CueImpl_SetVariable,
     IXACT3CueImpl_GetVariable,
     IXACT3CueImpl_Pause,
+#if XACT3_VER >= 0x0205
     IXACT3CueImpl_GetProperties,
+#endif
+#if XACT3_VER >= 0x0300
     IXACT3CueImpl_SetOutputVoices,
     IXACT3CueImpl_SetOutputVoiceMatrix
+#endif
 };
 
 typedef struct _XACT3SoundBankImpl {
@@ -208,6 +274,7 @@ static XACTINDEX WINAPI IXACT3SoundBankImpl_GetCueIndex(IXACT3SoundBank *iface,
     return FACTSoundBank_GetCueIndex(This->fact_soundbank, szFriendlyName);
 }
 
+#if XACT3_VER >= 0x0205
 static HRESULT WINAPI IXACT3SoundBankImpl_GetNumCues(IXACT3SoundBank *iface,
         XACTINDEX *pnNumCues)
 {
@@ -228,6 +295,7 @@ static HRESULT WINAPI IXACT3SoundBankImpl_GetCueProperties(IXACT3SoundBank *ifac
     return FACTSoundBank_GetCueProperties(This->fact_soundbank, nCueIndex,
             (FACTCueProperties*) pProperties);
 }
+#endif
 
 static HRESULT WINAPI IXACT3SoundBankImpl_Prepare(IXACT3SoundBank *iface,
         XACTINDEX nCueIndex, DWORD dwFlags, XACTTIME timeOffset,
@@ -342,8 +410,10 @@ static HRESULT WINAPI IXACT3SoundBankImpl_GetState(IXACT3SoundBank *iface,
 static const IXACT3SoundBankVtbl XACT3SoundBank_Vtbl =
 {
     IXACT3SoundBankImpl_GetCueIndex,
+#if XACT3_VER >= 0x0205
     IXACT3SoundBankImpl_GetNumCues,
     IXACT3SoundBankImpl_GetCueProperties,
+#endif
     IXACT3SoundBankImpl_Prepare,
     IXACT3SoundBankImpl_Play,
     IXACT3SoundBankImpl_Stop,
@@ -351,6 +421,8 @@ static const IXACT3SoundBankVtbl XACT3SoundBank_Vtbl =
     IXACT3SoundBankImpl_GetState
 };
 
+#if XACT3_VER >= 0x0205
+
 typedef struct _XACT3WaveImpl {
     IXACT3Wave IXACT3Wave_iface;
 
@@ -465,6 +537,8 @@ static const IXACT3WaveVtbl XACT3Wave_Vtbl =
     IXACT3WaveImpl_GetProperties
 };
 
+#endif
+
 typedef struct _XACT3WaveBankImpl {
     IXACT3WaveBank IXACT3WaveBank_iface;
 
@@ -488,6 +562,8 @@ static HRESULT WINAPI IXACT3WaveBankImpl_Destroy(IXACT3WaveBank *iface)
     return hr;
 }
 
+#if XACT3_VER >= 0x0205
+
 static HRESULT WINAPI IXACT3WaveBankImpl_GetNumWaves(IXACT3WaveBank *iface,
         XACTINDEX *pnNumWaves)
 {
@@ -607,6 +683,8 @@ static HRESULT WINAPI IXACT3WaveBankImpl_Stop(IXACT3WaveBank *iface,
     return FACTWaveBank_Stop(This->fact_wavebank, nWaveIndex, dwFlags);
 }
 
+#endif
+
 static HRESULT WINAPI IXACT3WaveBankImpl_GetState(IXACT3WaveBank *iface,
         DWORD *pdwState)
 {
@@ -620,12 +698,14 @@ static HRESULT WINAPI IXACT3WaveBankImpl_GetState(IXACT3WaveBank *iface,
 static const IXACT3WaveBankVtbl XACT3WaveBank_Vtbl =
 {
     IXACT3WaveBankImpl_Destroy,
+#if XACT3_VER >= 0x0205
     IXACT3WaveBankImpl_GetNumWaves,
     IXACT3WaveBankImpl_GetWaveIndex,
     IXACT3WaveBankImpl_GetWaveProperties,
     IXACT3WaveBankImpl_Prepare,
     IXACT3WaveBankImpl_Play,
     IXACT3WaveBankImpl_Stop,
+#endif
     IXACT3WaveBankImpl_GetState
 };
 
@@ -737,6 +817,8 @@ static HRESULT WINAPI IXACT3EngineImpl_GetRendererDetails(IXACT3Engine *iface,
             nRendererIndex, (FACTRendererDetails*) pRendererDetails);
 }
 
+#if XACT3_VER >= 0x0205
+
 static HRESULT WINAPI IXACT3EngineImpl_GetFinalMixFormat(IXACT3Engine *iface,
         WAVEFORMATEXTENSIBLE *pFinalMixFormat)
 {
@@ -748,6 +830,8 @@ static HRESULT WINAPI IXACT3EngineImpl_GetFinalMixFormat(IXACT3Engine *iface,
             (FAudioWaveFormatExtensible*) pFinalMixFormat);
 }
 
+#endif
+
 static void FACTCALL fact_notification_cb(const FACTNotification *notification)
 {
     XACT3EngineImpl *engine = (XACT3EngineImpl *)notification->pvContext;
@@ -787,6 +871,7 @@ static HRESULT WINAPI IXACT3EngineImpl_Initialize(IXACT3Engine *iface,
     params.pXAudio2 = NULL;
     params.pMasteringVoice = NULL;
 
+#if XACT3_VER >= 0x0300
     /* FIXME: pXAudio2 and pMasteringVoice are pointers to
      * IXAudio2/IXAudio2MasteringVoice objects. FACT wants pointers to
      * FAudio/FAudioMasteringVoice objects. In Wine's XAudio2 implementation, we
@@ -804,6 +889,7 @@ static HRESULT WINAPI IXACT3EngineImpl_Initialize(IXACT3Engine *iface,
             FIXME("pMasteringVoice parameter not supported!\n");
         }
     }
+#endif
 
     /* Force Windows I/O, do NOT use the FACT default! */
     This->pReadFile = (XACT_READFILE_CALLBACK)
@@ -968,6 +1054,8 @@ static HRESULT WINAPI IXACT3EngineImpl_CreateStreamingWaveBank(IXACT3Engine *ifa
     return S_OK;
 }
 
+#if XACT3_VER >= 0x0205
+
 static HRESULT WINAPI IXACT3EngineImpl_PrepareInMemoryWave(IXACT3Engine *iface,
         DWORD dwFlags, WAVEBANKENTRY entry, DWORD *pdwSeekTable,
         BYTE *pbWaveData, DWORD dwPlayOffset, XACTLOOPCOUNT nLoopCount,
@@ -1026,6 +1114,8 @@ static HRESULT WINAPI IXACT3EngineImpl_PrepareWave(IXACT3Engine *iface,
     return S_OK;
 }
 
+#endif
+
 enum {
     NOTIFY_SoundBank = 0x01,
     NOTIFY_WaveBank  = 0x02,
@@ -1044,34 +1134,44 @@ static inline void unwrap_notificationdesc(FACTNotificationDescription *fd,
 
     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)
+    switch (xd->type)
     {
-        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;
+        case XACTNOTIFICATIONTYPE_CUEPREPARED:
+        case XACTNOTIFICATIONTYPE_CUEPLAY:
+        case XACTNOTIFICATIONTYPE_CUESTOP:
+        case XACTNOTIFICATIONTYPE_CUEDESTROYED:
+        case XACTNOTIFICATIONTYPE_MARKER:
+        case XACTNOTIFICATIONTYPE_LOCALVARIABLECHANGED:
+            flags = NOTIFY_SoundBank | NOTIFY_cueIndex | NOTIFY_Cue;
+            break;
+
+        case XACTNOTIFICATIONTYPE_WAVEBANKDESTROYED:
+        case XACTNOTIFICATIONTYPE_WAVEBANKPREPARED:
+        case XACTNOTIFICATIONTYPE_WAVEBANKSTREAMING_INVALIDCONTENT:
+            flags = NOTIFY_WaveBank;
+            break;
+
+        case XACTNOTIFICATIONTYPE_SOUNDBANKDESTROYED:
+            flags = NOTIFY_SoundBank;
+            break;
+
+#if XACT3_VER >= 0x0205
+        case XACTNOTIFICATIONTYPE_WAVEPREPARED:
+        case XACTNOTIFICATIONTYPE_WAVEDESTROYED:
+            flags = NOTIFY_WaveBank | NOTIFY_waveIndex | NOTIFY_Wave;
+            break;
+#endif
+
+        case XACTNOTIFICATIONTYPE_WAVEPLAY:
+        case XACTNOTIFICATIONTYPE_WAVESTOP:
+#if XACT3_VER >= 0x0205
+        case XACTNOTIFICATIONTYPE_WAVELOOPED:
+#endif
+            flags = NOTIFY_SoundBank | NOTIFY_cueIndex | NOTIFY_Cue | NOTIFY_WaveBank | NOTIFY_Wave;
+            break;
+
+        default:
+            FIXME("Unrecognized type %#x.\n", xd->type);
     }
 
     /* We have to unwrap the FACT object first! */
@@ -1080,8 +1180,10 @@ static inline void unwrap_notificationdesc(FACTNotificationDescription *fd,
     fd->pvContext = xd->pvContext;
     if (flags & NOTIFY_cueIndex)
         fd->cueIndex = xd->cueIndex;
+#if XACT3_VER >= 0x0205
     if (flags & NOTIFY_waveIndex)
         fd->waveIndex = xd->waveIndex;
+#endif
 
     if (flags & NOTIFY_Cue && xd->pCue != NULL)
     {
@@ -1104,12 +1206,14 @@ static inline void unwrap_notificationdesc(FACTNotificationDescription *fd,
             fd->pWaveBank = bank->fact_wavebank;
     }
 
+#if XACT3_VER >= 0x0205
     if (flags & NOTIFY_Wave && xd->pWave != NULL)
     {
         XACT3WaveImpl *wave = impl_from_IXACT3Wave(xd->pWave);
         if (wave)
             fd->pWave = wave->fact_wave;
     }
+#endif
 }
 
 static HRESULT WINAPI IXACT3EngineImpl_RegisterNotification(IXACT3Engine *iface,
@@ -1216,16 +1320,20 @@ static const IXACT3EngineVtbl XACT3Engine_Vtbl =
     IXACT3EngineImpl_Release,
     IXACT3EngineImpl_GetRendererCount,
     IXACT3EngineImpl_GetRendererDetails,
+#if XACT3_VER >= 0x0205
     IXACT3EngineImpl_GetFinalMixFormat,
+#endif
     IXACT3EngineImpl_Initialize,
     IXACT3EngineImpl_ShutDown,
     IXACT3EngineImpl_DoWork,
     IXACT3EngineImpl_CreateSoundBank,
     IXACT3EngineImpl_CreateInMemoryWaveBank,
     IXACT3EngineImpl_CreateStreamingWaveBank,
+#if XACT3_VER >= 0x0205
     IXACT3EngineImpl_PrepareWave,
     IXACT3EngineImpl_PrepareInMemoryWave,
     IXACT3EngineImpl_PrepareStreamingWave,
+#endif
     IXACT3EngineImpl_RegisterNotification,
     IXACT3EngineImpl_UnRegisterNotification,
     IXACT3EngineImpl_GetCategory,
-- 
2.30.2




More information about the wine-devel mailing list