Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
wine-mirror
GitHub Repository: wine-mirror/wine
Path: blob/master/libs/faudio/src/FAPOFX.c
4389 views
1
/* FAudio - XAudio Reimplementation for FNA
2
*
3
* Copyright (c) 2011-2024 Ethan Lee, Luigi Auriemma, and the MonoGame Team
4
*
5
* This software is provided 'as-is', without any express or implied warranty.
6
* In no event will the authors be held liable for any damages arising from
7
* the use of this software.
8
*
9
* Permission is granted to anyone to use this software for any purpose,
10
* including commercial applications, and to alter it and redistribute it
11
* freely, subject to the following restrictions:
12
*
13
* 1. The origin of this software must not be misrepresented; you must not
14
* claim that you wrote the original software. If you use this software in a
15
* product, an acknowledgment in the product documentation would be
16
* appreciated but is not required.
17
*
18
* 2. Altered source versions must be plainly marked as such, and must not be
19
* misrepresented as being the original software.
20
*
21
* 3. This notice may not be removed or altered from any source distribution.
22
*
23
* Ethan "flibitijibibo" Lee <[email protected]>
24
*
25
*/
26
27
#include "FAPOFX.h"
28
#include "FAudio_internal.h"
29
30
uint32_t FAPOFX_CreateFX(
31
const FAudioGUID *clsid,
32
FAPO **pEffect,
33
const void *pInitData,
34
uint32_t InitDataByteSize
35
) {
36
return FAPOFX_CreateFXWithCustomAllocatorEXT(
37
clsid,
38
pEffect,
39
pInitData,
40
InitDataByteSize,
41
FAudio_malloc,
42
FAudio_free,
43
FAudio_realloc
44
);
45
}
46
47
uint32_t FAPOFX_CreateFXWithCustomAllocatorEXT(
48
const FAudioGUID *clsid,
49
FAPO **pEffect,
50
const void *pInitData,
51
uint32_t InitDataByteSize,
52
FAudioMallocFunc customMalloc,
53
FAudioFreeFunc customFree,
54
FAudioReallocFunc customRealloc
55
) {
56
#define CHECK_AND_RETURN(effect) \
57
if (FAudio_memcmp(clsid, &FAPOFX_CLSID_FX##effect, sizeof(FAudioGUID)) == 0) \
58
{ \
59
return FAPOFXCreate##effect( \
60
pEffect, \
61
pInitData, \
62
InitDataByteSize, \
63
customMalloc, \
64
customFree, \
65
customRealloc, \
66
0 \
67
); \
68
} \
69
else if (FAudio_memcmp(clsid, &FAPOFX_CLSID_FX##effect##_LEGACY, sizeof(FAudioGUID)) == 0) \
70
{ \
71
return FAPOFXCreate##effect( \
72
pEffect, \
73
pInitData, \
74
InitDataByteSize, \
75
customMalloc, \
76
customFree, \
77
customRealloc, \
78
1 \
79
); \
80
}
81
CHECK_AND_RETURN(EQ)
82
CHECK_AND_RETURN(MasteringLimiter)
83
CHECK_AND_RETURN(Reverb)
84
CHECK_AND_RETURN(Echo)
85
#undef CHECK_AND_RETURN
86
return -1;
87
}
88
89
/* vim: set noexpandtab shiftwidth=8 tabstop=8: */
90
91