FACT3D.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. /* FAudio - XAudio Reimplementation for FNA
  2. *
  3. * Copyright (c) 2011-2021 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 <flibitijibibo@flibitijibibo.com>
  24. *
  25. */
  26. /* This file has no documentation since you are expected to already know how
  27. * XACT works if you are still using these APIs!
  28. */
  29. #ifndef FACT3D_H
  30. #define FACT3D_H
  31. #include "F3DAudio.h"
  32. #include "FACT.h"
  33. #ifdef __cplusplus
  34. extern "C" {
  35. #endif /* __cplusplus */
  36. /* Constants */
  37. #define LEFT_AZIMUTH (3.0f * F3DAUDIO_PI / 2.0f)
  38. #define RIGHT_AZIMUTH (F3DAUDIO_PI / 2.0f)
  39. #define FRONT_LEFT_AZIMUTH (7.0f * F3DAUDIO_PI / 4.0f)
  40. #define FRONT_RIGHT_AZIMUTH (F3DAUDIO_PI / 4.0f)
  41. #define FRONT_CENTER_AZIMUTH 0.0f
  42. #define LOW_FREQUENCY_AZIMUTH F3DAUDIO_2PI
  43. #define BACK_LEFT_AZIMUTH (5.0f * F3DAUDIO_PI / 4.0f)
  44. #define BACK_RIGHT_AZIMUTH (3.0f * F3DAUDIO_PI / 4.0f)
  45. #define BACK_CENTER_AZIMUTH F3DAUDIO_PI
  46. #define FRONT_LEFT_OF_CENTER_AZIMUTH (15.0f * F3DAUDIO_PI / 8.0f)
  47. #define FRONT_RIGHT_OF_CENTER_AZIMUTH (F3DAUDIO_PI / 8.0f)
  48. static const float aStereoLayout[] =
  49. {
  50. LEFT_AZIMUTH,
  51. RIGHT_AZIMUTH
  52. };
  53. static const float a2Point1Layout[] =
  54. {
  55. LEFT_AZIMUTH,
  56. RIGHT_AZIMUTH,
  57. LOW_FREQUENCY_AZIMUTH
  58. };
  59. static const float aQuadLayout[] =
  60. {
  61. FRONT_LEFT_AZIMUTH,
  62. FRONT_RIGHT_AZIMUTH,
  63. BACK_LEFT_AZIMUTH,
  64. BACK_RIGHT_AZIMUTH
  65. };
  66. static const float a4Point1Layout[] =
  67. {
  68. FRONT_LEFT_AZIMUTH,
  69. FRONT_RIGHT_AZIMUTH,
  70. LOW_FREQUENCY_AZIMUTH,
  71. BACK_LEFT_AZIMUTH,
  72. BACK_RIGHT_AZIMUTH
  73. };
  74. static const float a5Point1Layout[] =
  75. {
  76. FRONT_LEFT_AZIMUTH,
  77. FRONT_RIGHT_AZIMUTH,
  78. FRONT_CENTER_AZIMUTH,
  79. LOW_FREQUENCY_AZIMUTH,
  80. BACK_LEFT_AZIMUTH,
  81. BACK_RIGHT_AZIMUTH
  82. };
  83. static const float a7Point1Layout[] =
  84. {
  85. FRONT_LEFT_AZIMUTH,
  86. FRONT_RIGHT_AZIMUTH,
  87. FRONT_CENTER_AZIMUTH,
  88. LOW_FREQUENCY_AZIMUTH,
  89. BACK_LEFT_AZIMUTH,
  90. BACK_RIGHT_AZIMUTH,
  91. LEFT_AZIMUTH,
  92. RIGHT_AZIMUTH
  93. };
  94. /* Functions */
  95. FACTAPI uint32_t FACT3DInitialize(
  96. FACTAudioEngine *pEngine,
  97. F3DAUDIO_HANDLE F3DInstance
  98. );
  99. FACTAPI uint32_t FACT3DCalculate(
  100. F3DAUDIO_HANDLE F3DInstance,
  101. const F3DAUDIO_LISTENER *pListener,
  102. F3DAUDIO_EMITTER *pEmitter,
  103. F3DAUDIO_DSP_SETTINGS *pDSPSettings
  104. );
  105. FACTAPI uint32_t FACT3DApply(
  106. F3DAUDIO_DSP_SETTINGS *pDSPSettings,
  107. FACTCue *pCue
  108. );
  109. #ifdef __cplusplus
  110. }
  111. #endif /* __cplusplus */
  112. #endif /* FACT3D_H */
  113. /* vim: set noexpandtab shiftwidth=8 tabstop=8: */