XAPOFX.h 6.8 KB

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