-
-
Notifications
You must be signed in to change notification settings - Fork 72
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
70b17bc
commit 260dd90
Showing
6 changed files
with
241 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
#include "xaudio2.h" | ||
#include "XAPOBase.h" | ||
#include "XAPOFX.h" | ||
|
||
class XAPOFXWrapper : public CXAPOParametersBase | ||
{ | ||
public: | ||
XAPOFXWrapper(void *object) : | ||
fapo_object(object), | ||
CXAPOParametersBase(reinterpret_cast<FAPOBase*>(object)) | ||
{ | ||
} | ||
|
||
COM_METHOD(void) Process( | ||
UINT32 InputProcessParameterCount, | ||
const XAPO_PROCESS_BUFFER_PARAMETERS *pInputProcessParameters, | ||
UINT32 OutputProcessParameterCount, | ||
XAPO_PROCESS_BUFFER_PARAMETERS *pOutputProcessParameters, | ||
BOOL IsEnabled | ||
) { | ||
reinterpret_cast<FAPO*>(fapo_object)->Process( | ||
fapo_object, | ||
InputProcessParameterCount, | ||
pInputProcessParameters, | ||
OutputProcessParameterCount, | ||
pOutputProcessParameters, | ||
IsEnabled | ||
); | ||
} | ||
|
||
private: | ||
void *fapo_object; | ||
}; | ||
|
||
void* CDECL XAPOFX_INTERNAL_Malloc(size_t size) | ||
{ | ||
return CoTaskMemAlloc(size); | ||
} | ||
void CDECL XAPOFX_INTERNAL_Free(void* ptr) | ||
{ | ||
CoTaskMemFree(ptr); | ||
} | ||
void* CDECL XAPOFX_INTERNAL_Realloc(void* ptr, size_t size) | ||
{ | ||
return CoTaskMemRealloc(ptr, size); | ||
} | ||
|
||
void* CreateFXInternal( | ||
REFCLSID clsid, | ||
const void *pInitData, | ||
uint32_t InitDataByteSize | ||
) { | ||
FAPO *fapo_object = NULL; | ||
FAPOFX_CreateFXWithCustomAllocatorEXT( | ||
&clsid, | ||
&fapo_object, | ||
pInitData, | ||
InitDataByteSize, | ||
XAPOFX_INTERNAL_Malloc, | ||
XAPOFX_INTERNAL_Free, | ||
XAPOFX_INTERNAL_Realloc | ||
); | ||
return new XAPOFXWrapper(fapo_object); | ||
} | ||
|
||
#if XAUDIO2_VERSION >=8 | ||
FAPOFXCPP_API CreateFX( | ||
REFCLSID clsid, | ||
IUnknown **pEffect, | ||
const void *pInitData, | ||
UINT32 InitDataByteSize | ||
) { | ||
*pEffect = reinterpret_cast<IUnknown*>(CreateFXInternal( | ||
clsid, | ||
pInitData, | ||
InitDataByteSize | ||
)); | ||
return S_OK; | ||
} | ||
#else | ||
FAPOFXCPP_API CreateFX(REFCLSID clsid, IUnknown **pEffect) | ||
{ | ||
*pEffect = reinterpret_cast<IUnknown*>(CreateFXInternal( | ||
clsid, | ||
NULL, | ||
0 | ||
)); | ||
return S_OK; | ||
} | ||
#endif // XAUDIO2_VERSION >=8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
#ifndef FAUDIO_CPP_XAPOFX_H | ||
#define FAUDIO_CPP_XAPOFX_H | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif /* __cplusplus */ | ||
|
||
#if defined _WIN32 || defined __CYGWIN__ | ||
#define DLLIMPORT __declspec(dllimport) | ||
#define DLLEXPORT __declspec(dllexport) | ||
#else | ||
#if __GNUC__ >= 4 | ||
#define DLLIMPORT __attribute__((visibility ("default"))) | ||
#define DLLEXPORT __attribute__((visibility ("default"))) | ||
#else | ||
#define DLLIMPORT | ||
#define DLLEXPORT | ||
#endif | ||
#endif | ||
|
||
#ifdef FAUDIOCPP_EXPORTS | ||
#define FAPOFXCPP_API extern "C" DLLEXPORT HRESULT __cdecl | ||
#else | ||
#define FAPOFXCPP_API extern "C" DLLIMPORT HRESULT __cdecl | ||
#endif | ||
|
||
#ifndef XAPOFX_VERSION | ||
#define XAPOFX_VERSION 5 | ||
#endif | ||
|
||
#include <FAPOFX.h> | ||
|
||
#if XAUDIO2_VERSION >=8 | ||
FAPOFXCPP_API CreateFX( | ||
REFCLSID clsid, | ||
IUnknown **pEffect, | ||
const void *pInitData, | ||
UINT32 InitDataByteSize | ||
); | ||
#else | ||
FAPOFXCPP_API CreateFX(REFCLSID clsid, IUnknown **pEffect); | ||
#endif // XAUDIO2_VERSION >=8 | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif /* __cplusplus */ | ||
|
||
#endif /* FAUDIO_CPP_XAPOFX_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#include "com_utils.h" | ||
#include <string.h> /* memcmp */ | ||
|
||
/* GUIDs */ | ||
const IID IID_IUnknown = {0x00000000, 0x0000, 0x0000, {0xC0, 00, 00, 00, 00, 00, 00, 0x46}}; | ||
|
||
const IID IID_IXAudio2 = {0x8bcf1f58, 0x9fe7, 0x4583, {0x8a, 0xc6, 0xe2, 0xad, 0xc4, 0x65, 0xc8, 0xbb}}; | ||
const IID IID_IXAPO = {0xA90BC001, 0xE897, 0xE897, {0x55, 0xE4, 0x9E, 0x47, 0x00, 0x00, 0x00, 0x00}}; | ||
const IID IID_IXAPOParameters = {0xA90BC001, 0xE897, 0xE897, {0x55, 0xE4, 0x9E, 0x47, 0x00, 0x00, 0x00, 0x01}}; | ||
|
||
bool guid_equals(REFIID a, REFIID b) | ||
{ | ||
return memcmp(&a, &b, sizeof(IID)) == 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
EXPORTS | ||
CreateFX @1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,3 +4,4 @@ EXPORTS | |
CreateAudioVolumeMeter @3 | ||
X3DAudioCalculate @5 | ||
X3DAudioInitialize @6 | ||
CreateFX @7 |