From fa4b6d66242136e922620295da4a22a7431d17fe Mon Sep 17 00:00:00 2001 From: Ethan Lee Date: Wed, 22 Jan 2020 00:12:10 +0000 Subject: [PATCH] include: Add xact3.idl Signed-off-by: Alistair Leslie-Hughes --- include/Makefile.in | 1 + include/xact3.idl | 533 ++++++++++++++++++++++++++++++++++++++++++++ include/xact3wb.h | 2 + 3 files changed, 536 insertions(+) create mode 100644 include/xact3.idl diff --git a/include/Makefile.in b/include/Makefile.in index ce0f6fc433..faba1622d9 100644 --- a/include/Makefile.in +++ b/include/Makefile.in @@ -784,6 +784,7 @@ SOURCES = \ wtypes.idl \ wuapi.idl \ x3daudio.h \ + xact3.idl \ xact3wb.h \ xapo.idl \ xapofx.h \ diff --git a/include/xact3.idl b/include/xact3.idl new file mode 100644 index 0000000000..c49718ff39 --- /dev/null +++ b/include/xact3.idl @@ -0,0 +1,533 @@ +/* + * Copyright (c) 2018 Ethan Lee for CodeWeavers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +import "unknwn.idl"; +import "xaudio2.idl"; + +import "xact3wb.h"; + +[ + uuid(bcc782bc-6492-4c22-8c35-f5d72fe73c6e) +] +coclass XACTEngine +{ +} + +interface IXACT3Engine; +interface IXACT3SoundBank; +interface IXACT3WaveBank; +interface IXACT3Cue; +interface IXACT3Wave; + +typedef WORD XACTCATEGORY; +typedef BYTE XACTCHANNEL; +typedef WORD XACTINDEX; +typedef BYTE XACTINSTANCELIMIT; +typedef BYTE XACTLOOPCOUNT; +typedef BYTE XACTNOTIFICATIONTYPE; +typedef SHORT XACTPITCH; +typedef LONG XACTTIME; +typedef WORD XACTVARIABLEINDEX; +typedef FLOAT XACTVARIABLEVALUE; +typedef BYTE XACTVARIATIONWEIGHT; +typedef FLOAT XACTVOLUME; + +#define XACT_RENDERER_ID_LENGTH 0xff +#define XACT_RENDERER_NAME_LENGTH 0xff +#define XACT_CUE_NAME_LENGTH 0xff + +cpp_quote("#ifndef WAVEBANK_ENTRYNAME_LENGTH") +#define WAVEBANK_ENTRYNAME_LENGTH 64 +cpp_quote("#endif") + +typedef struct XACT_RENDERER_DETAILS +{ + WCHAR rendererID[XACT_RENDERER_ID_LENGTH]; + WCHAR displayName[XACT_RENDERER_NAME_LENGTH]; + BOOL defaultDevice; +} XACT_RENDERER_DETAILS; + +typedef BOOL (__stdcall *XACT_READFILE_CALLBACK)( + HANDLE hFile, + LPVOID lpBuffer, + DWORD nNumberOfBytesRead, + LPDWORD lpNumberOfBytesRead, + void* lpOverlapped +); +typedef BOOL (__stdcall *XACT_GETOVERLAPPEDRESULT_CALLBACK)( + HANDLE hFile, + void* lpOverlapped, + LPDWORD lpNumberOfBytesTransferred, + BOOL bWait +); +typedef struct XACT_FILEIO_CALLBACKS +{ + XACT_READFILE_CALLBACK readFileCallback; + XACT_GETOVERLAPPEDRESULT_CALLBACK getOverlappedResultCallback; +} XACT_FILEIO_CALLBACKS; + +typedef struct XACT_STREAMING_PARAMETERS +{ + HANDLE file; + DWORD offset; + DWORD flags; + WORD packetSize; +} XACT_STREAMING_PARAMETERS; + +typedef struct XACT_WAVE_PROPERTIES +{ + char friendlyName[WAVEBANK_ENTRYNAME_LENGTH]; + WAVEBANKMINIWAVEFORMAT format; + DWORD durationInSamples; + WAVEBANKSAMPLEREGION loopRegion; + BOOL streaming; +} XACT_WAVE_PROPERTIES; + +cpp_quote("#if 0") +typedef struct XACT_WAVE_INSTANCE_PROPERTIES +{ + XACT_WAVE_PROPERTIES waveProperties; /* properties is a keyword for midl */ + BOOL backgroundMusic; +} XACT_WAVE_INSTANCE_PROPERTIES; +cpp_quote("#endif") + +cpp_quote("typedef struct XACT_WAVE_INSTANCE_PROPERTIES") +cpp_quote("{") +cpp_quote(" XACT_WAVE_PROPERTIES properties;") +cpp_quote(" BOOL backgroundMusic;") +cpp_quote("} XACT_WAVE_INSTANCE_PROPERTIES;") + +typedef struct XACT_CUE_PROPERTIES +{ + char friendlyName[XACT_CUE_NAME_LENGTH]; + BOOL interactive; + XACTINDEX iaVariableIndex; + XACTINDEX numVariations; + XACTINSTANCELIMIT maxInstances; + XACTINSTANCELIMIT currentInstances; +} XACT_CUE_PROPERTIES; + +typedef struct XACT_TRACK_PROPERTIES +{ + XACTTIME duration; + XACTINDEX numVariations; + XACTCHANNEL numChannels; + XACTINDEX waveVariation; + XACTLOOPCOUNT loopCount; +} XACT_TRACK_PROPERTIES; + +typedef struct XACT_VARIATION_PROPERTIES +{ + XACTINDEX index; + XACTVARIATIONWEIGHT weight; + XACTVARIABLEVALUE iaVariableMin; + XACTVARIABLEVALUE iaVariableMax; + BOOL linger; +} XACT_VARIATION_PROPERTIES; + +typedef struct XACT_SOUND_PROPERTIES +{ + XACTCATEGORY category; + BYTE priority; + XACTPITCH pitch; + XACTVOLUME volume; + XACTINDEX numTracks; + XACT_TRACK_PROPERTIES arrTrackProperties[1]; +} XACT_SOUND_PROPERTIES; + +typedef struct XACT_SOUND_VARIATION_PROPERTIES +{ + XACT_VARIATION_PROPERTIES variationProperties; + XACT_SOUND_PROPERTIES soundProperties; +} XACT_SOUND_VARIATION_PROPERTIES; + +typedef struct XACT_CUE_INSTANCE_PROPERTIES +{ + DWORD allocAttributes; + XACT_CUE_PROPERTIES cueProperties; + XACT_SOUND_VARIATION_PROPERTIES activeVariationProperties; +} XACT_CUE_INSTANCE_PROPERTIES; + +cpp_quote("#include ") + +typedef struct XACT_NOTIFICATION_DESCRIPTION +{ + XACTNOTIFICATIONTYPE type; + BYTE flags; + IXACT3SoundBank *pSoundBank; + IXACT3WaveBank *pWaveBank; + IXACT3Cue *pCue; + IXACT3Wave *pWave; + XACTINDEX cueIndex; + XACTINDEX waveIndex; + void* pvContext; +} XACT_NOTIFICATION_DESCRIPTION; + +typedef struct XACT_NOTIFICATION_CUE +{ + XACTINDEX cueIndex; + IXACT3SoundBank *pSoundBank; + IXACT3Cue *pCue; +} XACT_NOTIFICATION_CUE; + +typedef struct XACT_NOTIFICATION_MARKER +{ + XACTINDEX cueIndex; + IXACT3SoundBank *pSoundBank; + IXACT3Cue *pCue; + DWORD marker; +} XACT_NOTIFICATION_MARKER; + +typedef struct XACT_NOTIFICATION_SOUNDBANK +{ + IXACT3SoundBank *pSoundBank; +} XACT_NOTIFICATION_SOUNDBANK; + +typedef struct XACT_NOTIFICATION_WAVEBANK +{ + IXACT3WaveBank *pWaveBank; +} XACT_NOTIFICATION_WAVEBANK; + +typedef struct XACT_NOTIFICATION_VARIABLE +{ + XACTINDEX cueIndex; + IXACT3SoundBank *pSoundBank; + IXACT3Cue *pCue; + XACTVARIABLEINDEX variableIndex; + XACTVARIABLEVALUE variableValue; + BOOL local; +} XACT_NOTIFICATION_VARIABLE; + +typedef struct XACT_NOTIFICATION_GUI +{ + DWORD reserved; +} XACT_NOTIFICATION_GUI; + +typedef struct XACT_NOTIFICATION_WAVE +{ + IXACT3WaveBank *pWaveBank; + XACTINDEX waveIndex; + XACTINDEX cueIndex; + IXACT3SoundBank *pSoundBank; + IXACT3Cue *pCue; + IXACT3Wave *pWave; +} XACT_NOTIFICATION_WAVE; + +typedef struct XACT_NOTIFICATION +{ + XACTNOTIFICATIONTYPE type; + LONG timeStamp; + PVOID pvContext; + union + { + XACT_NOTIFICATION_CUE cue; + XACT_NOTIFICATION_MARKER marker; + XACT_NOTIFICATION_SOUNDBANK soundBank; + XACT_NOTIFICATION_WAVEBANK waveBank; + XACT_NOTIFICATION_VARIABLE variable; + XACT_NOTIFICATION_GUI gui; + XACT_NOTIFICATION_WAVE wave; + } DUMMYUNIONNAME; +} XACT_NOTIFICATION; + +typedef void (__stdcall *XACT_NOTIFICATION_CALLBACK)( + const XACT_NOTIFICATION *pNotification +); + +typedef struct XACT_RUNTIME_PARAMETERS +{ + DWORD lookAheadTime; + void* pGlobalSettingsBuffer; + DWORD globalSettingsBufferSize; + DWORD globalSettingsFlags; + DWORD globalSettingsAllocAttributes; + XACT_FILEIO_CALLBACKS fileIOCallbacks; + XACT_NOTIFICATION_CALLBACK fnNotificationCallback; + LPCWSTR pRendererID; + IXAudio2 *pXAudio2; + IXAudio2MasteringVoice *pMasteringVoice; +} XACT_RUNTIME_PARAMETERS; + + +cpp_quote("#include ") + +static const XACTNOTIFICATIONTYPE XACTNOTIFICATIONTYPE_CUEDESTROYED = 4; +static const XACTNOTIFICATIONTYPE XACTNOTIFICATIONTYPE_SOUNDBANKDESTROYED = 6; +static const XACTNOTIFICATIONTYPE XACTNOTIFICATIONTYPE_WAVEBANKDESTROYED = 7; +static const XACTNOTIFICATIONTYPE XACTNOTIFICATIONTYPE_WAVEDESTROYED = 16; + +[ + object, + local, + uuid(b1ee676a-d9cd-4d2a-89a8-fa53eb9e480b), +] +interface IXACT3Engine : IUnknown +{ + HRESULT GetRendererCount(XACTINDEX *pnRendererCount); + + HRESULT GetRendererDetails( + XACTINDEX nRendererIndex, + XACT_RENDERER_DETAILS *pRendererDetails); + + HRESULT GetFinalMixFormat(WAVEFORMATEXTENSIBLE *pFinalMixFormat); + + HRESULT Initialize(const XACT_RUNTIME_PARAMETERS *pParams); + + HRESULT ShutDown(); + + HRESULT DoWork(); + + HRESULT CreateSoundBank( + const void* pvBuffer, + DWORD dwSize, + DWORD dwFlags, + DWORD dwAllocAttributes, + IXACT3SoundBank **ppSoundBank); + + HRESULT CreateInMemoryWaveBank( + const void* pvBuffer, + DWORD dwSize, + DWORD dwFlags, + DWORD dwAllocAttributes, + IXACT3WaveBank **ppWaveBank); + + HRESULT CreateStreamingWaveBank( + const XACT_STREAMING_PARAMETERS *pParms, + IXACT3WaveBank **ppWaveBank); + + HRESULT PrepareWave( + DWORD dwFlags, + LPCSTR szWavePath, + WORD wStreamingPacketSize, + DWORD dwAlignment, + DWORD dwPlayOffset, + XACTLOOPCOUNT nLoopCount, + IXACT3Wave **ppWave); + + HRESULT PrepareInMemoryWave( + DWORD dwFlags, + WAVEBANKENTRY entry, + DWORD *pdwSeekTable, + BYTE *pbWaveData, + DWORD dwPlayOffset, + XACTLOOPCOUNT nLoopCount, + IXACT3Wave **ppWave); + + HRESULT PrepareStreamingWave( + DWORD dwFlags, + WAVEBANKENTRY entry, + XACT_STREAMING_PARAMETERS streamingParams, + DWORD dwAlignment, + DWORD *pdwSeekTable, + DWORD dwPlayOffset, + XACTLOOPCOUNT nLoopCount, + IXACT3Wave **ppWave); + + HRESULT RegisterNotification( + const XACT_NOTIFICATION_DESCRIPTION *pNotificationDesc); + + HRESULT UnRegisterNotification( + const XACT_NOTIFICATION_DESCRIPTION *pNotificationDesc); + + XACTCATEGORY GetCategory( + LPCSTR szFriendlyName); + + HRESULT Stop(XACTCATEGORY nCategory, DWORD dwFlags); + + HRESULT SetVolume(XACTCATEGORY nCategory, XACTVOLUME nVolume); + + HRESULT Pause(XACTCATEGORY nCategory, BOOL fPause); + + XACTVARIABLEINDEX GetGlobalVariableIndex(LPCSTR szFriendlyName); + + HRESULT SetGlobalVariable( + XACTVARIABLEINDEX nIndex, + XACTVARIABLEVALUE nValue); + + HRESULT GetGlobalVariable( + XACTVARIABLEINDEX nIndex, + XACTVARIABLEVALUE *nValue); +} + +[ + object, + local +] +interface IXACT3SoundBank +{ + XACTINDEX GetCueIndex(LPCSTR szFriendlyName); + + HRESULT GetNumCues(XACTINDEX *pnNumCues); + + HRESULT GetCueProperties( + XACTINDEX nCueIndex, + XACT_CUE_PROPERTIES *pProperties); + + HRESULT Prepare( + XACTINDEX nCueIndex, + DWORD dwFlags, + XACTTIME timeOffset, + IXACT3Cue **ppCue); + + HRESULT Play( + XACTINDEX nCueIndex, + DWORD dwFlags, + XACTTIME timeOffset, + IXACT3Cue **ppCue); + + HRESULT Stop(XACTINDEX nCueIndex, DWORD dwFlags); + + HRESULT Destroy(); + + HRESULT GetState(DWORD *pdwState); +} + +[ + object, + local +] +interface IXACT3WaveBank +{ + HRESULT Destroy(); + + HRESULT GetNumWaves(XACTINDEX *pnNumWaves); + + XACTINDEX GetWaveIndex(LPCSTR szFriendlyName); + + HRESULT GetWaveProperties( + XACTINDEX nWaveIndex, + XACT_WAVE_PROPERTIES *pWaveProperties); + + HRESULT Prepare( + XACTINDEX nWaveIndex, + DWORD dwFlags, + DWORD dwPlayOffset, + XACTLOOPCOUNT nLoopCount, + IXACT3Wave **ppWave); + + HRESULT Play( + XACTINDEX nWaveIndex, + DWORD dwFlags, + DWORD dwPlayOffset, + XACTLOOPCOUNT nLoopCount, + IXACT3Wave **ppWave); + + HRESULT Stop(XACTINDEX nWaveIndex, DWORD dwFlags); + + HRESULT GetState(DWORD *pdwState); +} + +[ + object, + local +] +interface IXACT34Cue +{ + HRESULT Play(); + + HRESULT Stop(DWORD dwFlags); + + HRESULT GetState(DWORD *pdwState); + + HRESULT Destroy(); + + HRESULT SetMatrixCoefficients( + UINT32 uSrcChannelCount, + UINT32 uDstChannelCount, + float *pMatrixCoefficients); + + XACTVARIABLEINDEX GetVariableIndex(LPCSTR szFriendlyName); + + HRESULT SetVariable(XACTVARIABLEINDEX nIndex, XACTVARIABLEVALUE nValue); + + HRESULT GetVariable( + XACTVARIABLEINDEX nIndex, + XACTVARIABLEVALUE *nValue); + + HRESULT Pause(BOOL fPause); + + HRESULT GetProperties(XACT_CUE_INSTANCE_PROPERTIES **ppProperties); +} + +[ + object, + local +] +interface IXACT3Cue +{ + HRESULT Play(); + + HRESULT Stop(DWORD dwFlags); + + HRESULT GetState(DWORD *pdwState); + + HRESULT Destroy(); + + HRESULT SetMatrixCoefficients( + UINT32 uSrcChannelCount, + UINT32 uDstChannelCount, + float *pMatrixCoefficients); + + XACTVARIABLEINDEX GetVariableIndex(LPCSTR szFriendlyName); + + HRESULT SetVariable(XACTVARIABLEINDEX nIndex, XACTVARIABLEVALUE nValue); + + HRESULT GetVariable( + XACTVARIABLEINDEX nIndex, + XACTVARIABLEVALUE *nValue); + + HRESULT Pause(BOOL fPause); + + HRESULT GetProperties(XACT_CUE_INSTANCE_PROPERTIES **ppProperties); + + HRESULT SetOutputVoices(const XAUDIO2_VOICE_SENDS *pSendList); + + HRESULT SetOutputVoiceMatrix( + IXAudio2Voice *pDestinationVoice, + UINT32 SourceChannels, + UINT32 DestinationChannels, + const float *pLevelMatrix); +} + +[ + object, + local +] +interface IXACT3Wave +{ + HRESULT Destroy(); + + HRESULT Play(); + + HRESULT Stop(DWORD dwFlags); + + HRESULT Pause(BOOL fPause); + + HRESULT GetState(DWORD *pdwState); + + HRESULT SetPitch(XACTPITCH pitch); + + HRESULT SetVolume(XACTVOLUME volume); + + HRESULT SetMatrixCoefficients( + UINT32 uSrcChannelCount, + UINT32 uDstChannelCount, + float *pMatrixCoefficients); + + HRESULT GetProperties(XACT_WAVE_INSTANCE_PROPERTIES *pProperties); +} diff --git a/include/xact3wb.h b/include/xact3wb.h index b4c5a53d40..130efc9745 100644 --- a/include/xact3wb.h +++ b/include/xact3wb.h @@ -18,6 +18,8 @@ #ifndef __XACT3WB_H__ #define __XACT3WB_H__ +#define WAVEBANK_ENTRYNAME_LENGTH 64 + typedef union WAVEBANKMINIWAVEFORMAT { struct -- 2.25.1