🛠️🐜 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.

88 lines
1.8 KiB

  1. #ifndef CORE_EFFECTSLOT_H
  2. #define CORE_EFFECTSLOT_H
  3. #include <atomic>
  4. #include "almalloc.h"
  5. #include "device.h"
  6. #include "effects/base.h"
  7. #include "intrusive_ptr.h"
  8. struct EffectSlot;
  9. struct WetBuffer;
  10. using EffectSlotArray = al::FlexArray<EffectSlot*>;
  11. enum class EffectSlotType : unsigned char {
  12. None,
  13. Reverb,
  14. Chorus,
  15. Distortion,
  16. Echo,
  17. Flanger,
  18. FrequencyShifter,
  19. VocalMorpher,
  20. PitchShifter,
  21. RingModulator,
  22. Autowah,
  23. Compressor,
  24. Equalizer,
  25. EAXReverb,
  26. DedicatedLFE,
  27. DedicatedDialog,
  28. Convolution
  29. };
  30. struct EffectSlotProps {
  31. float Gain;
  32. bool AuxSendAuto;
  33. EffectSlot *Target;
  34. EffectSlotType Type;
  35. EffectProps Props;
  36. al::intrusive_ptr<EffectState> State;
  37. std::atomic<EffectSlotProps*> next;
  38. DEF_NEWDEL(EffectSlotProps)
  39. };
  40. struct EffectSlot {
  41. std::atomic<EffectSlotProps*> Update{nullptr};
  42. /* Wet buffer configuration is ACN channel order with N3D scaling.
  43. * Consequently, effects that only want to work with mono input can use
  44. * channel 0 by itself. Effects that want multichannel can process the
  45. * ambisonics signal and make a B-Format source pan.
  46. */
  47. MixParams Wet;
  48. float Gain{1.0f};
  49. bool AuxSendAuto{true};
  50. EffectSlot *Target{nullptr};
  51. EffectSlotType EffectType{EffectSlotType::None};
  52. EffectProps mEffectProps{};
  53. EffectState *mEffectState{nullptr};
  54. float RoomRolloff{0.0f}; /* Added to the source's room rolloff, not multiplied. */
  55. float DecayTime{0.0f};
  56. float DecayLFRatio{0.0f};
  57. float DecayHFRatio{0.0f};
  58. bool DecayHFLimit{false};
  59. float AirAbsorptionGainHF{1.0f};
  60. /* Mixing buffer used by the Wet mix. */
  61. WetBuffer *mWetBuffer{nullptr};
  62. ~EffectSlot();
  63. static EffectSlotArray *CreatePtrArray(size_t count) noexcept;
  64. DISABLE_ALLOC()
  65. };
  66. #endif /* CORE_EFFECTSLOT_H */