Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1 | pmbaty | 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 | NOTES: |
||
13 | 1. USE THE DEBUG DLL TO ENABLE PARAMETER VALIDATION VIA ASSERTS! |
||
14 | Here's how: |
||
15 | Copy XAPOFXDX_X.dll to where your application exists. |
||
16 | The debug DLL can be found under %WINDIR%\system32. |
||
17 | Rename XAPOFXDX_X.dll to XAPOFXX_X.dll to use the debug version. */ |
||
18 | |||
19 | #pragma once |
||
20 | //--------------<D-E-F-I-N-I-T-I-O-N-S>-------------------------------------// |
||
21 | #include "comdecl.h" // for DEFINE_CLSID |
||
22 | |||
23 | // FX class IDs |
||
24 | DEFINE_CLSID(FXEQ, A90BC001, E897, E897, 74, 39, 43, 55, 00, 00, 00, 00); |
||
25 | DEFINE_CLSID(FXMasteringLimiter, A90BC001, E897, E897, 74, 39, 43, 55, 00, 00, 00, 01); |
||
26 | DEFINE_CLSID(FXReverb, A90BC001, E897, E897, 74, 39, 43, 55, 00, 00, 00, 02); |
||
27 | DEFINE_CLSID(FXEcho, A90BC001, E897, E897, 74, 39, 43, 55, 00, 00, 00, 03); |
||
28 | |||
29 | |||
30 | #if !defined(GUID_DEFS_ONLY) // ignore rest if only GUID definitions requested |
||
31 | #if defined(_XBOX) // general windows and COM declarations |
||
32 | #include <xtl.h> |
||
33 | #include <xobjbase.h> |
||
34 | #else |
||
35 | #include <windows.h> |
||
36 | #include <objbase.h> |
||
37 | #endif |
||
38 | #include <float.h> // float bounds |
||
39 | |||
40 | |||
41 | // EQ parameter bounds (inclusive), used with XEQ: |
||
42 | #define FXEQ_MIN_FRAMERATE 22000 |
||
43 | #define FXEQ_MAX_FRAMERATE 48000 |
||
44 | |||
45 | #define FXEQ_MIN_FREQUENCY_CENTER 20.0f |
||
46 | #define FXEQ_MAX_FREQUENCY_CENTER 20000.0f |
||
47 | #define FXEQ_DEFAULT_FREQUENCY_CENTER_0 100.0f // band 0 |
||
48 | #define FXEQ_DEFAULT_FREQUENCY_CENTER_1 800.0f // band 1 |
||
49 | #define FXEQ_DEFAULT_FREQUENCY_CENTER_2 2000.0f // band 2 |
||
50 | #define FXEQ_DEFAULT_FREQUENCY_CENTER_3 10000.0f // band 3 |
||
51 | |||
52 | #define FXEQ_MIN_GAIN 0.126f // -18dB |
||
53 | #define FXEQ_MAX_GAIN 7.94f // +18dB |
||
54 | #define FXEQ_DEFAULT_GAIN 1.0f // 0dB change, all bands |
||
55 | |||
56 | #define FXEQ_MIN_BANDWIDTH 0.1f |
||
57 | #define FXEQ_MAX_BANDWIDTH 2.0f |
||
58 | #define FXEQ_DEFAULT_BANDWIDTH 1.0f // all bands |
||
59 | |||
60 | |||
61 | // Mastering limiter parameter bounds (inclusive), used with XMasteringLimiter: |
||
62 | #define FXMASTERINGLIMITER_MIN_RELEASE 1 |
||
63 | #define FXMASTERINGLIMITER_MAX_RELEASE 20 |
||
64 | #define FXMASTERINGLIMITER_DEFAULT_RELEASE 6 |
||
65 | |||
66 | #define FXMASTERINGLIMITER_MIN_LOUDNESS 1 |
||
67 | #define FXMASTERINGLIMITER_MAX_LOUDNESS 1800 |
||
68 | #define FXMASTERINGLIMITER_DEFAULT_LOUDNESS 1000 |
||
69 | |||
70 | |||
71 | // Reverb parameter bounds (inclusive), used with XReverb: |
||
72 | #define FXREVERB_MIN_DIFFUSION 0.0f |
||
73 | #define FXREVERB_MAX_DIFFUSION 1.0f |
||
74 | #define FXREVERB_DEFAULT_DIFFUSION 0.9f |
||
75 | |||
76 | #define FXREVERB_MIN_ROOMSIZE 0.0001f |
||
77 | #define FXREVERB_MAX_ROOMSIZE 1.0f |
||
78 | #define FXREVERB_DEFAULT_ROOMSIZE 0.6f |
||
79 | |||
80 | |||
81 | // Echo parameter bounds (inclusive), used with XEcho: |
||
82 | #define FXECHO_MIN_WETDRYMIX 0.0f |
||
83 | #define FXECHO_MAX_WETDRYMIX 1.0f |
||
84 | #define FXECHO_DEFAULT_WETDRYMIX 0.5f |
||
85 | |||
86 | #define FXECHO_MIN_FEEDBACK 0.0f |
||
87 | #define FXECHO_MAX_FEEDBACK 1.0f |
||
88 | #define FXECHO_DEFAULT_FEEDBACK 0.5f |
||
89 | |||
90 | #define FXECHO_MIN_DELAY 1.0f |
||
91 | #define FXECHO_MAX_DELAY 2000.0f |
||
92 | #define FXECHO_DEFAULT_DELAY 500.0f |
||
93 | |||
94 | |||
95 | //--------------<D-A-T-A---T-Y-P-E-S>---------------------------------------// |
||
96 | #pragma pack(push, 1) // set packing alignment to ensure consistency across arbitrary build environments |
||
97 | |||
98 | |||
99 | // EQ parameters (4 bands), used with IXAPOParameters::SetParameters: |
||
100 | // The EQ supports only FLOAT32 audio foramts. |
||
101 | // The framerate must be within [22000, 48000] Hz. |
||
102 | typedef struct FXEQ_PARAMETERS { |
||
103 | float FrequencyCenter0; // center frequency in Hz, band 0 |
||
104 | float Gain0; // boost/cut |
||
105 | float Bandwidth0; // bandwidth, region of EQ is center frequency +/- bandwidth/2 |
||
106 | float FrequencyCenter1; // band 1 |
||
107 | float Gain1; |
||
108 | float Bandwidth1; |
||
109 | float FrequencyCenter2; // band 2 |
||
110 | float Gain2; |
||
111 | float Bandwidth2; |
||
112 | float FrequencyCenter3; // band 3 |
||
113 | float Gain3; |
||
114 | float Bandwidth3; |
||
115 | } FXEQ_PARAMETERS; |
||
116 | |||
117 | |||
118 | // Mastering limiter parameters, used with IXAPOParameters::SetParameters: |
||
119 | // The mastering limiter supports only FLOAT32 audio formats. |
||
120 | typedef struct FXMASTERINGLIMITER_PARAMETERS { |
||
121 | UINT32 Release; // release time (tuning factor with no specific units) |
||
122 | UINT32 Loudness; // loudness target (threshold) |
||
123 | } FXMASTERINGLIMITER_PARAMETERS; |
||
124 | |||
125 | |||
126 | // Reverb parameters, used with IXAPOParameters::SetParameters: |
||
127 | // The reverb supports only FLOAT32 audio formats with the following |
||
128 | // channel configurations: |
||
129 | // Input: Mono Output: Mono |
||
130 | // Input: Stereo Output: Stereo |
||
131 | typedef struct FXREVERB_PARAMETERS { |
||
132 | float Diffusion; // diffusion |
||
133 | float RoomSize; // room size |
||
134 | } FXREVERB_PARAMETERS; |
||
135 | |||
136 | |||
137 | // Echo parameters, used with IXAPOParameters::SetParameters: |
||
138 | // The echo supports only FLOAT32 audio formats. |
||
139 | typedef struct FXECHO_PARAMETERS { |
||
140 | float WetDryMix; // ratio of wet (processed) signal to dry (original) signal |
||
141 | float Feedback; // amount of output fed back into input |
||
142 | float Delay; // delay (all channels) in milliseconds |
||
143 | } FXECHO_PARAMETERS; |
||
144 | |||
145 | |||
146 | //--------------<M-A-C-R-O-S>-----------------------------------------------// |
||
147 | // function storage-class attribute and calltype |
||
148 | #if defined(_XBOX) || !defined(FXDLL) |
||
149 | #define FX_API_(type) EXTERN_C type STDAPIVCALLTYPE |
||
150 | #else |
||
151 | #if defined(FXEXPORT) |
||
152 | #define FX_API_(type) EXTERN_C __declspec(dllexport) type STDAPIVCALLTYPE |
||
153 | #else |
||
154 | #define FX_API_(type) EXTERN_C __declspec(dllimport) type STDAPIVCALLTYPE |
||
155 | #endif |
||
156 | #endif |
||
157 | #define FX_IMP_(type) type STDMETHODVCALLTYPE |
||
158 | |||
159 | |||
160 | //--------------<F-U-N-C-T-I-O-N-S>-----------------------------------------// |
||
161 | // creates instance of requested XAPO, use Release to free instance |
||
162 | FX_API_(HRESULT) CreateFX (REFCLSID clsid, __deref_out IUnknown** pEffect); |
||
163 | |||
164 | |||
165 | #pragma pack(pop) // revert packing alignment |
||
166 | #endif // !defined(GUID_DEFS_ONLY) |
||
167 | //---------------------------------<-EOF->----------------------------------// |