RetroArch
xapofx.h
Go to the documentation of this file.
1 /*-========================================================================-_
2  | - XAPOFX - |
3  | Copyright (c) Microsoft Corporation. All rights reserved. |
4  |~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
5  |PROJECT: XAPOFX MODEL: Unmanaged User-mode |
6  |VERSION: 1.3 EXCEPT: No Exceptions |
7  |CLASS: N / A MINREQ: WinXP, Xbox360 |
8  |BASE: N / A DIALECT: MSC++ 14.00 |
9  |>------------------------------------------------------------------------<|
10  | DUTY: Cross-platform Audio Processing Objects |
11  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
12 */
13 
14 #ifdef _MSC_VER
15 #pragma once
16 #endif
17 
18 #include <sdkddkver.h>
19 
20 #if(_WIN32_WINNT < _WIN32_WINNT_WIN8)
21 #error "This version of XAudio2 is available only in Windows 8 or later. Use the XAudio2 headers and libraries from the DirectX SDK with applications that target Windows 7 and earlier versions."
22 #endif // (_WIN32_WINNT < _WIN32_WINNT_WIN8)
23 
24 /*#include <winapifamily.h>*/
25 
26 /*#pragma region Application Family*/
27 /*#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP | WINAPI_PARTITION_TV_APP | WINAPI_PARTITION_TV_TITLE)*/
28 
29 //--------------<D-E-F-I-N-I-T-I-O-N-S>-------------------------------------//
30 
31 // FX class IDs
32 class __declspec(uuid("F5E01117-D6C4-485A-A3F5-695196F3DBFA")) FXEQ;
33 class __declspec(uuid("C4137916-2BE1-46FD-8599-441536F49856")) FXMasteringLimiter;
34 class __declspec(uuid("7D9ACA56-CB68-4807-B632-B137352E8596")) FXReverb;
35 class __declspec(uuid("5039D740-F736-449A-84D3-A56202557B87")) FXEcho;
36 
37 
38 #if !defined(GUID_DEFS_ONLY) // ignore rest if only GUID definitions requested
39  #include <windows.h>
40  #include <objbase.h>
41  #include <float.h> // float bounds
42 
43 
44  // EQ parameter bounds (inclusive), used with FXEQ:
45  #define FXEQ_MIN_FRAMERATE 22000
46  #define FXEQ_MAX_FRAMERATE 48000
47 
48  #define FXEQ_MIN_FREQUENCY_CENTER 20.0f
49  #define FXEQ_MAX_FREQUENCY_CENTER 20000.0f
50  #define FXEQ_DEFAULT_FREQUENCY_CENTER_0 100.0f // band 0
51  #define FXEQ_DEFAULT_FREQUENCY_CENTER_1 800.0f // band 1
52  #define FXEQ_DEFAULT_FREQUENCY_CENTER_2 2000.0f // band 2
53  #define FXEQ_DEFAULT_FREQUENCY_CENTER_3 10000.0f // band 3
54 
55  #define FXEQ_MIN_GAIN 0.126f // -18dB
56  #define FXEQ_MAX_GAIN 7.94f // +18dB
57  #define FXEQ_DEFAULT_GAIN 1.0f // 0dB change, all bands
58 
59  #define FXEQ_MIN_BANDWIDTH 0.1f
60  #define FXEQ_MAX_BANDWIDTH 2.0f
61  #define FXEQ_DEFAULT_BANDWIDTH 1.0f // all bands
62 
63 
64  // Mastering limiter parameter bounds (inclusive), used with FXMasteringLimiter:
65  #define FXMASTERINGLIMITER_MIN_RELEASE 1
66  #define FXMASTERINGLIMITER_MAX_RELEASE 20
67  #define FXMASTERINGLIMITER_DEFAULT_RELEASE 6
68 
69  #define FXMASTERINGLIMITER_MIN_LOUDNESS 1
70  #define FXMASTERINGLIMITER_MAX_LOUDNESS 1800
71  #define FXMASTERINGLIMITER_DEFAULT_LOUDNESS 1000
72 
73 
74  // Reverb parameter bounds (inclusive), used with FXReverb:
75  #define FXREVERB_MIN_DIFFUSION 0.0f
76  #define FXREVERB_MAX_DIFFUSION 1.0f
77  #define FXREVERB_DEFAULT_DIFFUSION 0.9f
78 
79  #define FXREVERB_MIN_ROOMSIZE 0.0001f
80  #define FXREVERB_MAX_ROOMSIZE 1.0f
81  #define FXREVERB_DEFAULT_ROOMSIZE 0.6f
82 
83 
84  // Echo initialization data/parameter bounds (inclusive), used with FXEcho:
85  #define FXECHO_MIN_WETDRYMIX 0.0f
86  #define FXECHO_MAX_WETDRYMIX 1.0f
87  #define FXECHO_DEFAULT_WETDRYMIX 0.5f
88 
89  #define FXECHO_MIN_FEEDBACK 0.0f
90  #define FXECHO_MAX_FEEDBACK 1.0f
91  #define FXECHO_DEFAULT_FEEDBACK 0.5f
92 
93  #define FXECHO_MIN_DELAY 1.0f
94  #define FXECHO_MAX_DELAY 2000.0f
95  #define FXECHO_DEFAULT_DELAY 500.0f
96 
97 
98 //--------------<D-A-T-A---T-Y-P-E-S>---------------------------------------//
99  #pragma pack(push, 1) // set packing alignment to ensure consistency across arbitrary build environments
100 
101 
102  // EQ parameters (4 bands), used with IXAPOParameters::SetParameters:
103  // The EQ supports only FLOAT32 audio foramts.
104  // The framerate must be within [22000, 48000] Hz.
105  typedef struct FXEQ_PARAMETERS {
106  float FrequencyCenter0; // center frequency in Hz, band 0
107  float Gain0; // boost/cut
108  float Bandwidth0; // bandwidth, region of EQ is center frequency +/- bandwidth/2
109  float FrequencyCenter1; // band 1
110  float Gain1;
111  float Bandwidth1;
112  float FrequencyCenter2; // band 2
113  float Gain2;
114  float Bandwidth2;
115  float FrequencyCenter3; // band 3
116  float Gain3;
117  float Bandwidth3;
118  } FXEQ_PARAMETERS;
119 
120 
121  // Mastering limiter parameters, used with IXAPOParameters::SetParameters:
122  // The mastering limiter supports only FLOAT32 audio formats.
124  UINT32 Release; // release time (tuning factor with no specific units)
125  UINT32 Loudness; // loudness target (threshold)
127 
128 
129  // Reverb parameters, used with IXAPOParameters::SetParameters:
130  // The reverb supports only FLOAT32 audio formats with the following
131  // channel configurations:
132  // Input: Mono Output: Mono
133  // Input: Stereo Output: Stereo
134  typedef struct FXREVERB_PARAMETERS {
135  float Diffusion; // diffusion
136  float RoomSize; // room size
138 
139 
140  // Echo initialization data, used with CreateFX:
141  // Use of this structure is optional, the default MaxDelay is FXECHO_DEFAULT_DELAY.
142  typedef struct FXECHO_INITDATA {
143  float MaxDelay; // maximum delay (all channels) in milliseconds, must be within [FXECHO_MIN_DELAY, FXECHO_MAX_DELAY]
144  } FXECHO_INITDATA;
145 
146  // Echo parameters, used with IXAPOParameters::SetParameters:
147  // The echo supports only FLOAT32 audio formats.
148  typedef struct FXECHO_PARAMETERS {
149  float WetDryMix; // ratio of wet (processed) signal to dry (original) signal
150  float Feedback; // amount of output fed back into input
151  float Delay; // delay (all channels) in milliseconds, must be within [FXECHO_MIN_DELAY, FXECHO_PARAMETERS.MaxDelay]
153 
154 
155 //--------------<M-A-C-R-O-S>-----------------------------------------------//
156  // function storage-class attribute and calltype
157 
158  #if !defined(FXDLL)
159  #define FX_API_(type) EXTERN_C type STDAPIVCALLTYPE
160  #else
161  #if defined(FXEXPORT)
162  #define FX_API_(type) EXTERN_C __declspec(dllexport) type STDAPIVCALLTYPE
163  #else
164  #define FX_API_(type) EXTERN_C __declspec(dllimport) type STDAPIVCALLTYPE
165  #endif
166  #endif
167 
168  #define FX_IMP_(type) type STDMETHODVCALLTYPE
169 
170 
171 //--------------<F-U-N-C-T-I-O-N-S>-----------------------------------------//
172  // creates instance of requested XAPO, use Release to free instance
173  // pInitData - [in] effect-specific initialization parameters, may be NULL if InitDataByteSize == 0
174  // InitDataByteSize - [in] size of pInitData in bytes, may be 0 if pInitData is NULL
175  FX_API_(HRESULT) CreateFX (REFCLSID clsid, _Outptr_ IUnknown** pEffect, _In_reads_bytes_opt_(InitDataByteSize) const void* pInitData=NULL, UINT32 InitDataByteSize=0);
176 
177 
178  #pragma pack(pop) // revert packing alignment
179 #endif // !defined(GUID_DEFS_ONLY)
180 
181 /*#endif*/ /* WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP | WINAPI_PARTITION_TV_APP | WINAPI_PARTITION_TV_TITLE) */
182 /*#pragma endregion*/
183 //---------------------------------<-EOF->----------------------------------//
184 
class __declspec(uuid("F5E01117-D6C4-485A-A3F5-695196F3DBFA")) FXEQ
float Delay
Definition: xapofx.h:151
Definition: xapofx.h:148
_Outptr_ IUnknown UINT32 InitDataByteSize
Definition: xapofx.h:175
float WetDryMix
Definition: xapofx.h:149
typedef HRESULT(WINAPI *PFN_D3D12_SERIALIZE_ROOT_SIGNATURE)(_In_ const D3D12_ROOT_SIGNATURE_DESC *pRootSignature
_Outptr_ IUnknown ** pEffect
Definition: xapofx.h:175
_Outptr_ IUnknown _In_reads_bytes_opt_(InitDataByteSize) const void *pInitData
Definition: xapofx.h:142
#define NULL
Pointer to 0.
Definition: gctypes.h:65
float Bandwidth0
Definition: xapofx.h:108
struct FXMASTERINGLIMITER_PARAMETERS FXMASTERINGLIMITER_PARAMETERS
float Bandwidth3
Definition: xapofx.h:117
float Gain2
Definition: xapofx.h:113
Definition: xapofx.h:134
struct FXECHO_PARAMETERS FXECHO_PARAMETERS
float Bandwidth1
Definition: xapofx.h:111
float Gain1
Definition: xapofx.h:110
#define A(i)
Definition: ecp_curves.c:884
float MaxDelay
Definition: xapofx.h:143
float FrequencyCenter2
Definition: xapofx.h:112
float Bandwidth2
Definition: xapofx.h:114
UINT32 Release
Definition: xapofx.h:124
struct FXEQ_PARAMETERS FXEQ_PARAMETERS
float Diffusion
Definition: xapofx.h:135
uint32_t UINT32
Definition: coretypes.h:10
Definition: xapofx.h:123
float FrequencyCenter3
Definition: xapofx.h:115
float Gain3
Definition: xapofx.h:116
float FrequencyCenter0
Definition: xapofx.h:106
#define FX_API_(type)
Definition: xapofx.h:159
Definition: xapofx.h:105
float RoomSize
Definition: xapofx.h:136
float FrequencyCenter1
Definition: xapofx.h:109
struct FXREVERB_PARAMETERS FXREVERB_PARAMETERS
struct FXECHO_INITDATA FXECHO_INITDATA
float Gain0
Definition: xapofx.h:107
UINT32 Loudness
Definition: xapofx.h:125
float Feedback
Definition: xapofx.h:150