Fix XA2 driver compile under MinGW

This commit is contained in:
kaetemi 2014-06-18 23:18:06 +02:00
parent 2c6b53c53e
commit 76704a9952
4 changed files with 71 additions and 5 deletions

View file

@ -62,7 +62,7 @@ protected:
/// Mutex for cross-thread access from XAudio2 callbacks. /// Mutex for cross-thread access from XAudio2 callbacks.
NLMISC::CMutex _Mutex; NLMISC::CMutex _Mutex;
/// Unique id for buffer. /// Unique id for buffer.
uint _LastBufferContext; uintptr_t _LastBufferContext;
/// Current buffer. /// Current buffer.
void *_ValidBufferContext[_BufferNb]; void *_ValidBufferContext[_BufferNb];
public: public:

View file

@ -1,4 +1,6 @@
EXPORTS NLSOUND_createISoundDriverInstance LIBRARY nel_drv_xaudio2_win_r
EXPORTS NLSOUND_interfaceVersion EXPORTS
EXPORTS NLSOUND_outputProfile NLSOUND_createISoundDriverInstance
EXPORTS NLSOUND_getDriverType NLSOUND_interfaceVersion
NLSOUND_outputProfile
NLSOUND_getDriverType

View file

@ -53,6 +53,14 @@ BOOL WINAPI DllMain(HANDLE hModule, DWORD /* ul_reason_for_call */, LPVOID /* lp
// *************************************************************************** // ***************************************************************************
#ifndef NL_STATIC
#ifdef NL_COMP_MINGW
extern "C" {
#endif
#endif
// ***************************************************************************
#ifdef NL_STATIC #ifdef NL_STATIC
ISoundDriver* createISoundDriverInstanceXAudio2 ISoundDriver* createISoundDriverInstanceXAudio2
#else #else
@ -99,6 +107,14 @@ __declspec(dllexport) ISoundDriver::TDriver NLSOUND_getDriverType()
// ****************************************************************** // ******************************************************************
#ifndef NL_STATIC
#ifdef NL_COMP_MINGW
}
#endif
#endif
// ******************************************************************
#ifdef NL_DEBUG #ifdef NL_DEBUG
static XAUDIO2_DEBUG_CONFIGURATION NLSOUND_XAUDIO2_DEBUG_CONFIGURATION_DISABLED = { static XAUDIO2_DEBUG_CONFIGURATION NLSOUND_XAUDIO2_DEBUG_CONFIGURATION_DISABLED = {

View file

@ -25,9 +25,57 @@
#include <cfloat> #include <cfloat>
#include <algorithm> #include <algorithm>
#include <limits> #include <limits>
#include <intrin.h>
// 3rd Party Includes // 3rd Party Includes
#include <basetyps.h>
#define XAUDIO2_HELPER_FUNCTIONS #define XAUDIO2_HELPER_FUNCTIONS
#ifdef NL_COMP_MINGW
#define __in_bcount(x)
#define __in_bcount_opt(x)
#define __in_ecount(x)
#define __in_xcount(x)
#define __inout_bcount_full(x)
#define __inout_bcount_opt(x)
#define __out_bcount(x)
#define __out_bcount_full(x)
#define __out_bcount_opt(x)
#define __out_bcount_part_opt(x,y)
#define __out_ecount(x)
#define __out_xcount(x)
#define __deref_opt_inout_bcount_part_opt(x,y)
#define __deref_out_bcount(x)
#define __deref_out_bcount_opt(x)
#define __out
#define __in
#define __inout
#define __deref_out
#define __in_opt
#define __inout_opt
#define __out_opt
#define __deref
#define __deref_inout_opt
#define __reserved
#define __XMA2DEFS_INCLUDED__
#endif /* NL_COMP_MINGW */
#include <comdecl.h>
#ifdef NL_COMP_MINGW
#undef DEFINE_CLSID
#undef DEFINE_IID
#undef DECLSPEC_UUID_WRAPPER
#define DEFINE_CLSID(className, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
class className; \
__CRT_UUID_DECL(className, 0x##l, 0x##w1, 0x##w2, 0x##b1, 0x##b2, 0x##b3, 0x##b4, 0x##b5, 0x##b6, 0x##b7, 0x##b8) \
EXTERN_C const GUID CLSID_##className
#define DEFINE_IID(interfaceName, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
interface interfaceName; \
__CRT_UUID_DECL(interfaceName, 0x##l, 0x##w1, 0x##w2, 0x##b1, 0x##b2, 0x##b3, 0x##b4, 0x##b5, 0x##b6, 0x##b7, 0x##b8) \
EXTERN_C const GUID IID_##interfaceName
#endif /* NL_COMP_MINGW */
#include <xaudio2.h> #include <xaudio2.h>
#include <xaudio2fx.h> #include <xaudio2fx.h>
#include <x3daudio.h> #include <x3daudio.h>