🛠️🐜 Antkeeper superbuild with dependencies included https://antkeeper.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

809 lines
21 KiB

  1. #ifndef AL_SOURCE_H
  2. #define AL_SOURCE_H
  3. #include <array>
  4. #include <atomic>
  5. #include <cstddef>
  6. #include <iterator>
  7. #include <limits>
  8. #include <deque>
  9. #include "AL/al.h"
  10. #include "AL/alc.h"
  11. #include "alc/alu.h"
  12. #include "alc/context.h"
  13. #include "alc/inprogext.h"
  14. #include "aldeque.h"
  15. #include "almalloc.h"
  16. #include "alnumeric.h"
  17. #include "atomic.h"
  18. #include "core/voice.h"
  19. #include "vector.h"
  20. #ifdef ALSOFT_EAX
  21. #include "eax_eax_call.h"
  22. #include "eax_fx_slot_index.h"
  23. #include "eax_utils.h"
  24. #endif // ALSOFT_EAX
  25. struct ALbuffer;
  26. struct ALeffectslot;
  27. enum class SourceStereo : bool {
  28. Normal = AL_NORMAL_SOFT,
  29. Enhanced = AL_SUPER_STEREO_SOFT
  30. };
  31. #define DEFAULT_SENDS 2
  32. #define INVALID_VOICE_IDX static_cast<ALuint>(-1)
  33. struct ALbufferQueueItem : public VoiceBufferItem {
  34. ALbuffer *mBuffer{nullptr};
  35. DISABLE_ALLOC()
  36. };
  37. #ifdef ALSOFT_EAX
  38. using EaxSourceSourceFilterDirtyFlagsValue = std::uint_least16_t;
  39. struct EaxSourceSourceFilterDirtyFlags
  40. {
  41. using EaxIsBitFieldStruct = bool;
  42. EaxSourceSourceFilterDirtyFlagsValue lDirect : 1;
  43. EaxSourceSourceFilterDirtyFlagsValue lDirectHF : 1;
  44. EaxSourceSourceFilterDirtyFlagsValue lRoom : 1;
  45. EaxSourceSourceFilterDirtyFlagsValue lRoomHF : 1;
  46. EaxSourceSourceFilterDirtyFlagsValue lObstruction : 1;
  47. EaxSourceSourceFilterDirtyFlagsValue flObstructionLFRatio : 1;
  48. EaxSourceSourceFilterDirtyFlagsValue lOcclusion : 1;
  49. EaxSourceSourceFilterDirtyFlagsValue flOcclusionLFRatio : 1;
  50. EaxSourceSourceFilterDirtyFlagsValue flOcclusionRoomRatio : 1;
  51. EaxSourceSourceFilterDirtyFlagsValue flOcclusionDirectRatio : 1;
  52. EaxSourceSourceFilterDirtyFlagsValue lExclusion : 1;
  53. EaxSourceSourceFilterDirtyFlagsValue flExclusionLFRatio : 1;
  54. }; // EaxSourceSourceFilterDirtyFlags
  55. using EaxSourceSourceMiscDirtyFlagsValue = std::uint_least8_t;
  56. struct EaxSourceSourceMiscDirtyFlags
  57. {
  58. using EaxIsBitFieldStruct = bool;
  59. EaxSourceSourceMiscDirtyFlagsValue lOutsideVolumeHF : 1;
  60. EaxSourceSourceMiscDirtyFlagsValue flDopplerFactor : 1;
  61. EaxSourceSourceMiscDirtyFlagsValue flRolloffFactor : 1;
  62. EaxSourceSourceMiscDirtyFlagsValue flRoomRolloffFactor : 1;
  63. EaxSourceSourceMiscDirtyFlagsValue flAirAbsorptionFactor : 1;
  64. EaxSourceSourceMiscDirtyFlagsValue ulFlags : 1;
  65. EaxSourceSourceMiscDirtyFlagsValue flMacroFXFactor : 1;
  66. EaxSourceSourceMiscDirtyFlagsValue speaker_levels : 1;
  67. }; // EaxSourceSourceMiscDirtyFlags
  68. using EaxSourceSendDirtyFlagsValue = std::uint_least8_t;
  69. struct EaxSourceSendDirtyFlags
  70. {
  71. using EaxIsBitFieldStruct = bool;
  72. EaxSourceSendDirtyFlagsValue lSend : 1;
  73. EaxSourceSendDirtyFlagsValue lSendHF : 1;
  74. EaxSourceSendDirtyFlagsValue lOcclusion : 1;
  75. EaxSourceSendDirtyFlagsValue flOcclusionLFRatio : 1;
  76. EaxSourceSendDirtyFlagsValue flOcclusionRoomRatio : 1;
  77. EaxSourceSendDirtyFlagsValue flOcclusionDirectRatio : 1;
  78. EaxSourceSendDirtyFlagsValue lExclusion : 1;
  79. EaxSourceSendDirtyFlagsValue flExclusionLFRatio : 1;
  80. }; // EaxSourceSendDirtyFlags
  81. struct EaxSourceSendsDirtyFlags
  82. {
  83. using EaxIsBitFieldStruct = bool;
  84. EaxSourceSendDirtyFlags sends[EAX_MAX_FXSLOTS];
  85. }; // EaxSourceSendsDirtyFlags
  86. #endif // ALSOFT_EAX
  87. struct ALsource {
  88. /** Source properties. */
  89. float Pitch{1.0f};
  90. float Gain{1.0f};
  91. float OuterGain{0.0f};
  92. float MinGain{0.0f};
  93. float MaxGain{1.0f};
  94. float InnerAngle{360.0f};
  95. float OuterAngle{360.0f};
  96. float RefDistance{1.0f};
  97. float MaxDistance{std::numeric_limits<float>::max()};
  98. float RolloffFactor{1.0f};
  99. #ifdef ALSOFT_EAX
  100. // For EAXSOURCE_ROLLOFFFACTOR, which is distinct from and added to
  101. // AL_ROLLOFF_FACTOR
  102. float RolloffFactor2{0.0f};
  103. #endif
  104. std::array<float,3> Position{{0.0f, 0.0f, 0.0f}};
  105. std::array<float,3> Velocity{{0.0f, 0.0f, 0.0f}};
  106. std::array<float,3> Direction{{0.0f, 0.0f, 0.0f}};
  107. std::array<float,3> OrientAt{{0.0f, 0.0f, -1.0f}};
  108. std::array<float,3> OrientUp{{0.0f, 1.0f, 0.0f}};
  109. bool HeadRelative{false};
  110. bool Looping{false};
  111. DistanceModel mDistanceModel{DistanceModel::Default};
  112. Resampler mResampler{ResamplerDefault};
  113. DirectMode DirectChannels{DirectMode::Off};
  114. SpatializeMode mSpatialize{SpatializeMode::Auto};
  115. SourceStereo mStereoMode{SourceStereo::Normal};
  116. bool DryGainHFAuto{true};
  117. bool WetGainAuto{true};
  118. bool WetGainHFAuto{true};
  119. float OuterGainHF{1.0f};
  120. float AirAbsorptionFactor{0.0f};
  121. float RoomRolloffFactor{0.0f};
  122. float DopplerFactor{1.0f};
  123. /* NOTE: Stereo pan angles are specified in radians, counter-clockwise
  124. * rather than clockwise.
  125. */
  126. std::array<float,2> StereoPan{{al::numbers::pi_v<float>/6.0f, -al::numbers::pi_v<float>/6.0f}};
  127. float Radius{0.0f};
  128. float EnhWidth{0.593f};
  129. /** Direct filter and auxiliary send info. */
  130. struct {
  131. float Gain;
  132. float GainHF;
  133. float HFReference;
  134. float GainLF;
  135. float LFReference;
  136. } Direct;
  137. struct SendData {
  138. ALeffectslot *Slot;
  139. float Gain;
  140. float GainHF;
  141. float HFReference;
  142. float GainLF;
  143. float LFReference;
  144. };
  145. std::array<SendData,MAX_SENDS> Send;
  146. /**
  147. * Last user-specified offset, and the offset type (bytes, samples, or
  148. * seconds).
  149. */
  150. double Offset{0.0};
  151. ALenum OffsetType{AL_NONE};
  152. /** Source type (static, streaming, or undetermined) */
  153. ALenum SourceType{AL_UNDETERMINED};
  154. /** Source state (initial, playing, paused, or stopped) */
  155. ALenum state{AL_INITIAL};
  156. /** Source Buffer Queue head. */
  157. al::deque<ALbufferQueueItem> mQueue;
  158. bool mPropsDirty{true};
  159. /* Index into the context's Voices array. Lazily updated, only checked and
  160. * reset when looking up the voice.
  161. */
  162. ALuint VoiceIdx{INVALID_VOICE_IDX};
  163. /** Self ID */
  164. ALuint id{0};
  165. ALsource();
  166. ~ALsource();
  167. ALsource(const ALsource&) = delete;
  168. ALsource& operator=(const ALsource&) = delete;
  169. DISABLE_ALLOC()
  170. #ifdef ALSOFT_EAX
  171. public:
  172. void eax_initialize(ALCcontext *context) noexcept;
  173. void eax_dispatch(const EaxEaxCall& eax_call)
  174. { eax_call.is_get() ? eax_get(eax_call) : eax_set(eax_call); }
  175. void eax_update_filters();
  176. void eax_update(
  177. EaxContextSharedDirtyFlags dirty_flags);
  178. void eax_commit() { eax_apply_deferred(); }
  179. void eax_commit_and_update();
  180. bool eax_is_initialized() const noexcept { return eax_al_context_; }
  181. static ALsource* eax_lookup_source(
  182. ALCcontext& al_context,
  183. ALuint source_id) noexcept;
  184. private:
  185. static constexpr auto eax_max_speakers = 9;
  186. using EaxActiveFxSlots = std::array<bool, EAX_MAX_FXSLOTS>;
  187. using EaxSpeakerLevels = std::array<long, eax_max_speakers>;
  188. struct Eax
  189. {
  190. using Sends = std::array<EAXSOURCEALLSENDPROPERTIES, EAX_MAX_FXSLOTS>;
  191. EAX50ACTIVEFXSLOTS active_fx_slots{};
  192. EAX50SOURCEPROPERTIES source{};
  193. Sends sends{};
  194. EaxSpeakerLevels speaker_levels{};
  195. }; // Eax
  196. bool eax_uses_primary_id_{};
  197. bool eax_has_active_fx_slots_{};
  198. bool eax_are_active_fx_slots_dirty_{};
  199. ALCcontext* eax_al_context_{};
  200. EAXBUFFER_REVERBPROPERTIES eax1_{};
  201. Eax eax_{};
  202. Eax eax_d_{};
  203. EaxActiveFxSlots eax_active_fx_slots_{};
  204. EaxSourceSendsDirtyFlags eax_sends_dirty_flags_{};
  205. EaxSourceSourceFilterDirtyFlags eax_source_dirty_filter_flags_{};
  206. EaxSourceSourceMiscDirtyFlags eax_source_dirty_misc_flags_{};
  207. [[noreturn]]
  208. static void eax_fail(
  209. const char* message);
  210. void eax_set_source_defaults() noexcept;
  211. void eax_set_active_fx_slots_defaults() noexcept;
  212. void eax_set_send_defaults(EAXSOURCEALLSENDPROPERTIES& eax_send) noexcept;
  213. void eax_set_sends_defaults() noexcept;
  214. void eax_set_speaker_levels_defaults() noexcept;
  215. void eax_set_defaults() noexcept;
  216. static float eax_calculate_dst_occlusion_mb(
  217. long src_occlusion_mb,
  218. float path_ratio,
  219. float lf_ratio) noexcept;
  220. EaxAlLowPassParam eax_create_direct_filter_param() const noexcept;
  221. EaxAlLowPassParam eax_create_room_filter_param(
  222. const ALeffectslot& fx_slot,
  223. const EAXSOURCEALLSENDPROPERTIES& send) const noexcept;
  224. void eax_set_fx_slots();
  225. void eax_initialize_fx_slots();
  226. void eax_update_direct_filter_internal();
  227. void eax_update_room_filters_internal();
  228. void eax_update_filters_internal();
  229. void eax_update_primary_fx_slot_id();
  230. void eax_defer_active_fx_slots(
  231. const EaxEaxCall& eax_call);
  232. static const char* eax_get_exclusion_name() noexcept;
  233. static const char* eax_get_exclusion_lf_ratio_name() noexcept;
  234. static const char* eax_get_occlusion_name() noexcept;
  235. static const char* eax_get_occlusion_lf_ratio_name() noexcept;
  236. static const char* eax_get_occlusion_direct_ratio_name() noexcept;
  237. static const char* eax_get_occlusion_room_ratio_name() noexcept;
  238. static void eax1_validate_reverb_mix(float reverb_mix);
  239. static void eax_validate_send_receiving_fx_slot_guid(
  240. const GUID& guidReceivingFXSlotID);
  241. static void eax_validate_send_send(
  242. long lSend);
  243. static void eax_validate_send_send_hf(
  244. long lSendHF);
  245. static void eax_validate_send_occlusion(
  246. long lOcclusion);
  247. static void eax_validate_send_occlusion_lf_ratio(
  248. float flOcclusionLFRatio);
  249. static void eax_validate_send_occlusion_room_ratio(
  250. float flOcclusionRoomRatio);
  251. static void eax_validate_send_occlusion_direct_ratio(
  252. float flOcclusionDirectRatio);
  253. static void eax_validate_send_exclusion(
  254. long lExclusion);
  255. static void eax_validate_send_exclusion_lf_ratio(
  256. float flExclusionLFRatio);
  257. static void eax_validate_send(
  258. const EAXSOURCESENDPROPERTIES& all);
  259. static void eax_validate_send_exclusion_all(
  260. const EAXSOURCEEXCLUSIONSENDPROPERTIES& all);
  261. static void eax_validate_send_occlusion_all(
  262. const EAXSOURCEOCCLUSIONSENDPROPERTIES& all);
  263. static void eax_validate_send_all(
  264. const EAXSOURCEALLSENDPROPERTIES& all);
  265. static EaxFxSlotIndexValue eax_get_send_index(
  266. const GUID& send_guid);
  267. void eax_defer_send_send(
  268. long lSend,
  269. EaxFxSlotIndexValue index);
  270. void eax_defer_send_send_hf(
  271. long lSendHF,
  272. EaxFxSlotIndexValue index);
  273. void eax_defer_send_occlusion(
  274. long lOcclusion,
  275. EaxFxSlotIndexValue index);
  276. void eax_defer_send_occlusion_lf_ratio(
  277. float flOcclusionLFRatio,
  278. EaxFxSlotIndexValue index);
  279. void eax_defer_send_occlusion_room_ratio(
  280. float flOcclusionRoomRatio,
  281. EaxFxSlotIndexValue index);
  282. void eax_defer_send_occlusion_direct_ratio(
  283. float flOcclusionDirectRatio,
  284. EaxFxSlotIndexValue index);
  285. void eax_defer_send_exclusion(
  286. long lExclusion,
  287. EaxFxSlotIndexValue index);
  288. void eax_defer_send_exclusion_lf_ratio(
  289. float flExclusionLFRatio,
  290. EaxFxSlotIndexValue index);
  291. void eax_defer_send(
  292. const EAXSOURCESENDPROPERTIES& all,
  293. EaxFxSlotIndexValue index);
  294. void eax_defer_send_exclusion_all(
  295. const EAXSOURCEEXCLUSIONSENDPROPERTIES& all,
  296. EaxFxSlotIndexValue index);
  297. void eax_defer_send_occlusion_all(
  298. const EAXSOURCEOCCLUSIONSENDPROPERTIES& all,
  299. EaxFxSlotIndexValue index);
  300. void eax_defer_send_all(
  301. const EAXSOURCEALLSENDPROPERTIES& all,
  302. EaxFxSlotIndexValue index);
  303. void eax_defer_send(
  304. const EaxEaxCall& eax_call);
  305. void eax_defer_send_exclusion_all(
  306. const EaxEaxCall& eax_call);
  307. void eax_defer_send_occlusion_all(
  308. const EaxEaxCall& eax_call);
  309. void eax_defer_send_all(
  310. const EaxEaxCall& eax_call);
  311. static void eax_validate_source_direct(
  312. long direct);
  313. static void eax_validate_source_direct_hf(
  314. long direct_hf);
  315. static void eax_validate_source_room(
  316. long room);
  317. static void eax_validate_source_room_hf(
  318. long room_hf);
  319. static void eax_validate_source_obstruction(
  320. long obstruction);
  321. static void eax_validate_source_obstruction_lf_ratio(
  322. float obstruction_lf_ratio);
  323. static void eax_validate_source_occlusion(
  324. long occlusion);
  325. static void eax_validate_source_occlusion_lf_ratio(
  326. float occlusion_lf_ratio);
  327. static void eax_validate_source_occlusion_room_ratio(
  328. float occlusion_room_ratio);
  329. static void eax_validate_source_occlusion_direct_ratio(
  330. float occlusion_direct_ratio);
  331. static void eax_validate_source_exclusion(
  332. long exclusion);
  333. static void eax_validate_source_exclusion_lf_ratio(
  334. float exclusion_lf_ratio);
  335. static void eax_validate_source_outside_volume_hf(
  336. long outside_volume_hf);
  337. static void eax_validate_source_doppler_factor(
  338. float doppler_factor);
  339. static void eax_validate_source_rolloff_factor(
  340. float rolloff_factor);
  341. static void eax_validate_source_room_rolloff_factor(
  342. float room_rolloff_factor);
  343. static void eax_validate_source_air_absorption_factor(
  344. float air_absorption_factor);
  345. static void eax_validate_source_flags(
  346. unsigned long flags,
  347. int eax_version);
  348. static void eax_validate_source_macro_fx_factor(
  349. float macro_fx_factor);
  350. static void eax_validate_source_2d_all(
  351. const EAXSOURCE2DPROPERTIES& all,
  352. int eax_version);
  353. static void eax_validate_source_obstruction_all(
  354. const EAXOBSTRUCTIONPROPERTIES& all);
  355. static void eax_validate_source_exclusion_all(
  356. const EAXEXCLUSIONPROPERTIES& all);
  357. static void eax_validate_source_occlusion_all(
  358. const EAXOCCLUSIONPROPERTIES& all);
  359. static void eax_validate_source_all(
  360. const EAX20BUFFERPROPERTIES& all,
  361. int eax_version);
  362. static void eax_validate_source_all(
  363. const EAX30SOURCEPROPERTIES& all,
  364. int eax_version);
  365. static void eax_validate_source_all(
  366. const EAX50SOURCEPROPERTIES& all,
  367. int eax_version);
  368. static void eax_validate_source_speaker_id(
  369. long speaker_id);
  370. static void eax_validate_source_speaker_level(
  371. long speaker_level);
  372. static void eax_validate_source_speaker_level_all(
  373. const EAXSPEAKERLEVELPROPERTIES& all);
  374. void eax_defer_source_direct(
  375. long lDirect);
  376. void eax_defer_source_direct_hf(
  377. long lDirectHF);
  378. void eax_defer_source_room(
  379. long lRoom);
  380. void eax_defer_source_room_hf(
  381. long lRoomHF);
  382. void eax_defer_source_obstruction(
  383. long lObstruction);
  384. void eax_defer_source_obstruction_lf_ratio(
  385. float flObstructionLFRatio);
  386. void eax_defer_source_occlusion(
  387. long lOcclusion);
  388. void eax_defer_source_occlusion_lf_ratio(
  389. float flOcclusionLFRatio);
  390. void eax_defer_source_occlusion_room_ratio(
  391. float flOcclusionRoomRatio);
  392. void eax_defer_source_occlusion_direct_ratio(
  393. float flOcclusionDirectRatio);
  394. void eax_defer_source_exclusion(
  395. long lExclusion);
  396. void eax_defer_source_exclusion_lf_ratio(
  397. float flExclusionLFRatio);
  398. void eax_defer_source_outside_volume_hf(
  399. long lOutsideVolumeHF);
  400. void eax_defer_source_doppler_factor(
  401. float flDopplerFactor);
  402. void eax_defer_source_rolloff_factor(
  403. float flRolloffFactor);
  404. void eax_defer_source_room_rolloff_factor(
  405. float flRoomRolloffFactor);
  406. void eax_defer_source_air_absorption_factor(
  407. float flAirAbsorptionFactor);
  408. void eax_defer_source_flags(
  409. unsigned long ulFlags);
  410. void eax_defer_source_macro_fx_factor(
  411. float flMacroFXFactor);
  412. void eax_defer_source_2d_all(
  413. const EAXSOURCE2DPROPERTIES& all);
  414. void eax_defer_source_obstruction_all(
  415. const EAXOBSTRUCTIONPROPERTIES& all);
  416. void eax_defer_source_exclusion_all(
  417. const EAXEXCLUSIONPROPERTIES& all);
  418. void eax_defer_source_occlusion_all(
  419. const EAXOCCLUSIONPROPERTIES& all);
  420. void eax_defer_source_all(
  421. const EAX20BUFFERPROPERTIES& all);
  422. void eax_defer_source_all(
  423. const EAX30SOURCEPROPERTIES& all);
  424. void eax_defer_source_all(
  425. const EAX50SOURCEPROPERTIES& all);
  426. void eax_defer_source_speaker_level_all(
  427. const EAXSPEAKERLEVELPROPERTIES& all);
  428. void eax_defer_source_direct(
  429. const EaxEaxCall& eax_call);
  430. void eax_defer_source_direct_hf(
  431. const EaxEaxCall& eax_call);
  432. void eax_defer_source_room(
  433. const EaxEaxCall& eax_call);
  434. void eax_defer_source_room_hf(
  435. const EaxEaxCall& eax_call);
  436. void eax_defer_source_obstruction(
  437. const EaxEaxCall& eax_call);
  438. void eax_defer_source_obstruction_lf_ratio(
  439. const EaxEaxCall& eax_call);
  440. void eax_defer_source_occlusion(
  441. const EaxEaxCall& eax_call);
  442. void eax_defer_source_occlusion_lf_ratio(
  443. const EaxEaxCall& eax_call);
  444. void eax_defer_source_occlusion_room_ratio(
  445. const EaxEaxCall& eax_call);
  446. void eax_defer_source_occlusion_direct_ratio(
  447. const EaxEaxCall& eax_call);
  448. void eax_defer_source_exclusion(
  449. const EaxEaxCall& eax_call);
  450. void eax_defer_source_exclusion_lf_ratio(
  451. const EaxEaxCall& eax_call);
  452. void eax_defer_source_outside_volume_hf(
  453. const EaxEaxCall& eax_call);
  454. void eax_defer_source_doppler_factor(
  455. const EaxEaxCall& eax_call);
  456. void eax_defer_source_rolloff_factor(
  457. const EaxEaxCall& eax_call);
  458. void eax_defer_source_room_rolloff_factor(
  459. const EaxEaxCall& eax_call);
  460. void eax_defer_source_air_absorption_factor(
  461. const EaxEaxCall& eax_call);
  462. void eax_defer_source_flags(
  463. const EaxEaxCall& eax_call);
  464. void eax_defer_source_macro_fx_factor(
  465. const EaxEaxCall& eax_call);
  466. void eax_defer_source_2d_all(
  467. const EaxEaxCall& eax_call);
  468. void eax_defer_source_obstruction_all(
  469. const EaxEaxCall& eax_call);
  470. void eax_defer_source_exclusion_all(
  471. const EaxEaxCall& eax_call);
  472. void eax_defer_source_occlusion_all(
  473. const EaxEaxCall& eax_call);
  474. void eax_defer_source_all(
  475. const EaxEaxCall& eax_call);
  476. void eax_defer_source_speaker_level_all(
  477. const EaxEaxCall& eax_call);
  478. void eax_set_outside_volume_hf();
  479. void eax_set_doppler_factor();
  480. void eax_set_rolloff_factor();
  481. void eax_set_room_rolloff_factor();
  482. void eax_set_air_absorption_factor();
  483. void eax_set_direct_hf_auto_flag();
  484. void eax_set_room_auto_flag();
  485. void eax_set_room_hf_auto_flag();
  486. void eax_set_flags();
  487. void eax_set_macro_fx_factor();
  488. void eax_set_speaker_levels();
  489. void eax1_set_efx();
  490. void eax1_set_reverb_mix(const EaxEaxCall& eax_call);
  491. void eax1_set(const EaxEaxCall& eax_call);
  492. void eax_apply_deferred();
  493. void eax_set(
  494. const EaxEaxCall& eax_call);
  495. static const GUID& eax_get_send_fx_slot_guid(
  496. int eax_version,
  497. EaxFxSlotIndexValue fx_slot_index);
  498. static void eax_copy_send(
  499. const EAXSOURCEALLSENDPROPERTIES& src_send,
  500. EAXSOURCESENDPROPERTIES& dst_send);
  501. static void eax_copy_send(
  502. const EAXSOURCEALLSENDPROPERTIES& src_send,
  503. EAXSOURCEALLSENDPROPERTIES& dst_send);
  504. static void eax_copy_send(
  505. const EAXSOURCEALLSENDPROPERTIES& src_send,
  506. EAXSOURCEOCCLUSIONSENDPROPERTIES& dst_send);
  507. static void eax_copy_send(
  508. const EAXSOURCEALLSENDPROPERTIES& src_send,
  509. EAXSOURCEEXCLUSIONSENDPROPERTIES& dst_send);
  510. template<
  511. typename TException,
  512. typename TSrcSend
  513. >
  514. void eax_api_get_send_properties(
  515. const EaxEaxCall& eax_call) const
  516. {
  517. const auto eax_version = eax_call.get_version();
  518. const auto dst_sends = eax_call.get_values<TException, TSrcSend>();
  519. const auto send_count = dst_sends.size();
  520. for (auto fx_slot_index = EaxFxSlotIndexValue{}; fx_slot_index < send_count; ++fx_slot_index)
  521. {
  522. auto& dst_send = dst_sends[fx_slot_index];
  523. const auto& src_send = eax_.sends[fx_slot_index];
  524. eax_copy_send(src_send, dst_send);
  525. dst_send.guidReceivingFXSlotID = eax_get_send_fx_slot_guid(eax_version, fx_slot_index);
  526. }
  527. }
  528. void eax1_get(const EaxEaxCall& eax_call);
  529. void eax_api_get_source_all_v2(
  530. const EaxEaxCall& eax_call);
  531. void eax_api_get_source_all_v3(
  532. const EaxEaxCall& eax_call);
  533. void eax_api_get_source_all_v5(
  534. const EaxEaxCall& eax_call);
  535. void eax_api_get_source_all(
  536. const EaxEaxCall& eax_call);
  537. void eax_api_get_source_all_obstruction(
  538. const EaxEaxCall& eax_call);
  539. void eax_api_get_source_all_occlusion(
  540. const EaxEaxCall& eax_call);
  541. void eax_api_get_source_all_exclusion(
  542. const EaxEaxCall& eax_call);
  543. void eax_api_get_source_active_fx_slot_id(
  544. const EaxEaxCall& eax_call);
  545. void eax_api_get_source_all_2d(
  546. const EaxEaxCall& eax_call);
  547. void eax_api_get_source_speaker_level_all(
  548. const EaxEaxCall& eax_call);
  549. void eax_get(
  550. const EaxEaxCall& eax_call);
  551. // `alSource3i(source, AL_AUXILIARY_SEND_FILTER, ...)`
  552. void eax_set_al_source_send(ALeffectslot *slot, size_t sendidx,
  553. const EaxAlLowPassParam &filter);
  554. #endif // ALSOFT_EAX
  555. };
  556. void UpdateAllSourceProps(ALCcontext *context);
  557. #endif