1 /* FAudio - XAudio Reimplementation for FNA
3 * Copyright (c) 2011-2023 Ethan Lee, Luigi Auriemma, and the MonoGame Team
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.
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:
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.
18 * 2. Altered source versions must be plainly marked as such, and must not be
19 * misrepresented as being the original software.
21 * 3. This notice may not be removed or altered from any source distribution.
23 * Ethan "flibitijibibo" Lee <flibitijibibo@flibitijibibo.com>
32 #define FAPOFXAPI FAUDIOAPI
36 #endif /* __cplusplus */
40 /* "Legacy" GUIDs are from XAPOFX <= 1.5. They were removed in XAudio 2.8 and later. */
41 extern const FAudioGUID FAPOFX_CLSID_FXEQ
, FAPOFX_CLSID_FXEQ_LEGACY
;
42 extern const FAudioGUID FAPOFX_CLSID_FXMasteringLimiter
, FAPOFX_CLSID_FXMasteringLimiter_LEGACY
;
43 extern const FAudioGUID FAPOFX_CLSID_FXReverb
, FAPOFX_CLSID_FXReverb_LEGACY
;
44 extern const FAudioGUID FAPOFX_CLSID_FXEcho
, FAPOFX_CLSID_FXEcho_LEGACY
;
50 /* See FAPOFXEQ_* constants below.
51 * FrequencyCenter is in Hz, Gain is amplitude ratio, Bandwidth is Q factor.
53 typedef struct FAPOFXEQParameters
55 float FrequencyCenter0
;
58 float FrequencyCenter1
;
61 float FrequencyCenter2
;
64 float FrequencyCenter3
;
69 /* See FAPOFXMASTERINGLIMITER_* constants below. */
70 typedef struct FAPOFXMasteringLimiterParameters
72 uint32_t Release
; /* In milliseconds */
73 uint32_t Loudness
; /* In... uh, MSDN doesn't actually say what. */
74 } FAPOFXMasteringLimiterParameters
;
76 /* See FAPOFXREVERB_* constants below.
77 * Both parameters are arbitrary and should be treated subjectively.
79 typedef struct FAPOFXReverbParameters
83 } FAPOFXReverbParameters
;
85 /* See FAPOFXECHO_* constants below. */
86 typedef struct FAPOFXEchoParameters
88 float WetDryMix
; /* Percentage of processed signal vs original */
89 float Feedback
; /* Percentage to feed back into input */
90 float Delay
; /* In milliseconds */
91 } FAPOFXEchoParameters
;
97 #define FAPOFXEQ_MIN_FRAMERATE 22000
98 #define FAPOFXEQ_MAX_FRAMERATE 48000
100 #define FAPOFXEQ_MIN_FREQUENCY_CENTER 20.0f
101 #define FAPOFXEQ_MAX_FREQUENCY_CENTER 20000.0f
102 #define FAPOFXEQ_DEFAULT_FREQUENCY_CENTER_0 100.0f
103 #define FAPOFXEQ_DEFAULT_FREQUENCY_CENTER_1 800.0f
104 #define FAPOFXEQ_DEFAULT_FREQUENCY_CENTER_2 2000.0f
105 #define FAPOFXEQ_DEFAULT_FREQUENCY_CENTER_3 10000.0f
107 #define FAPOFXEQ_MIN_GAIN 0.126f
108 #define FAPOFXEQ_MAX_GAIN 7.94f
109 #define FAPOFXEQ_DEFAULT_GAIN 1.0f
111 #define FAPOFXEQ_MIN_BANDWIDTH 0.1f
112 #define FAPOFXEQ_MAX_BANDWIDTH 2.0f
113 #define FAPOFXEQ_DEFAULT_BANDWIDTH 1.0f
115 #define FAPOFXMASTERINGLIMITER_MIN_RELEASE 1
116 #define FAPOFXMASTERINGLIMITER_MAX_RELEASE 20
117 #define FAPOFXMASTERINGLIMITER_DEFAULT_RELEASE 6
119 #define FAPOFXMASTERINGLIMITER_MIN_LOUDNESS 1
120 #define FAPOFXMASTERINGLIMITER_MAX_LOUDNESS 1800
121 #define FAPOFXMASTERINGLIMITER_DEFAULT_LOUDNESS 1000
123 #define FAPOFXREVERB_MIN_DIFFUSION 0.0f
124 #define FAPOFXREVERB_MAX_DIFFUSION 1.0f
125 #define FAPOFXREVERB_DEFAULT_DIFFUSION 0.9f
127 #define FAPOFXREVERB_MIN_ROOMSIZE 0.0001f
128 #define FAPOFXREVERB_MAX_ROOMSIZE 1.0f
129 #define FAPOFXREVERB_DEFAULT_ROOMSIZE 0.6f
131 #define FAPOFXECHO_MIN_WETDRYMIX 0.0f
132 #define FAPOFXECHO_MAX_WETDRYMIX 1.0f
133 #define FAPOFXECHO_DEFAULT_WETDRYMIX 0.5f
135 #define FAPOFXECHO_MIN_FEEDBACK 0.0f
136 #define FAPOFXECHO_MAX_FEEDBACK 1.0f
137 #define FAPOFXECHO_DEFAULT_FEEDBACK 0.5f
139 #define FAPOFXECHO_MIN_DELAY 1.0f
140 #define FAPOFXECHO_MAX_DELAY 2000.0f
141 #define FAPOFXECHO_DEFAULT_DELAY 500.0f
145 /* Creates an effect from the pre-made FAPOFX effect library.
147 * clsid: A reference to one of the FAPOFX_CLSID_* GUIDs
148 * pEffect: Filled with the resulting FAPO object
149 * pInitData: Starting parameters, pass NULL to use the default values
150 * InitDataByteSize: Parameter struct size, pass 0 if pInitData is NULL
152 * Returns 0 on success.
154 FAPOFXAPI
uint32_t FAPOFX_CreateFX(
155 const FAudioGUID
*clsid
,
157 const void *pInitData
,
158 uint32_t InitDataByteSize
161 /* See "extensions/CustomAllocatorEXT.txt" for more details. */
162 FAPOFXAPI
uint32_t FAPOFX_CreateFXWithCustomAllocatorEXT(
163 const FAudioGUID
*clsid
,
165 const void *pInitData
,
166 uint32_t InitDataByteSize
,
167 FAudioMallocFunc customMalloc
,
168 FAudioFreeFunc customFree
,
169 FAudioReallocFunc customRealloc
174 #endif /* __cplusplus */
176 #endif /* FAPOFX_H */
178 /* vim: set noexpandtab shiftwidth=8 tabstop=8: */