/* FAudio - XAudio Reimplementation for FNA1*2* Copyright (c) 2011-2024 Ethan Lee, Luigi Auriemma, and the MonoGame Team3*4* This software is provided 'as-is', without any express or implied warranty.5* In no event will the authors be held liable for any damages arising from6* the use of this software.7*8* Permission is granted to anyone to use this software for any purpose,9* including commercial applications, and to alter it and redistribute it10* freely, subject to the following restrictions:11*12* 1. The origin of this software must not be misrepresented; you must not13* claim that you wrote the original software. If you use this software in a14* product, an acknowledgment in the product documentation would be15* appreciated but is not required.16*17* 2. Altered source versions must be plainly marked as such, and must not be18* misrepresented as being the original software.19*20* 3. This notice may not be removed or altered from any source distribution.21*22* Ethan "flibitijibibo" Lee <[email protected]>23*24*/2526#include "FAPOFX.h"27#include "FAudio_internal.h"2829uint32_t FAPOFX_CreateFX(30const FAudioGUID *clsid,31FAPO **pEffect,32const void *pInitData,33uint32_t InitDataByteSize34) {35return FAPOFX_CreateFXWithCustomAllocatorEXT(36clsid,37pEffect,38pInitData,39InitDataByteSize,40FAudio_malloc,41FAudio_free,42FAudio_realloc43);44}4546uint32_t FAPOFX_CreateFXWithCustomAllocatorEXT(47const FAudioGUID *clsid,48FAPO **pEffect,49const void *pInitData,50uint32_t InitDataByteSize,51FAudioMallocFunc customMalloc,52FAudioFreeFunc customFree,53FAudioReallocFunc customRealloc54) {55#define CHECK_AND_RETURN(effect) \56if (FAudio_memcmp(clsid, &FAPOFX_CLSID_FX##effect, sizeof(FAudioGUID)) == 0) \57{ \58return FAPOFXCreate##effect( \59pEffect, \60pInitData, \61InitDataByteSize, \62customMalloc, \63customFree, \64customRealloc, \650 \66); \67} \68else if (FAudio_memcmp(clsid, &FAPOFX_CLSID_FX##effect##_LEGACY, sizeof(FAudioGUID)) == 0) \69{ \70return FAPOFXCreate##effect( \71pEffect, \72pInitData, \73InitDataByteSize, \74customMalloc, \75customFree, \76customRealloc, \771 \78); \79}80CHECK_AND_RETURN(EQ)81CHECK_AND_RETURN(MasteringLimiter)82CHECK_AND_RETURN(Reverb)83CHECK_AND_RETURN(Echo)84#undef CHECK_AND_RETURN85return -1;86}8788/* vim: set noexpandtab shiftwidth=8 tabstop=8: */899091