alAuxEffectSlot.h 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. #ifndef _AL_AUXEFFECTSLOT_H_
  2. #define _AL_AUXEFFECTSLOT_H_
  3. #include "alMain.h"
  4. #include "alEffect.h"
  5. #ifdef __cplusplus
  6. extern "C" {
  7. #endif
  8. struct ALeffectStateVtable;
  9. struct ALeffectslot;
  10. typedef struct ALeffectState {
  11. const struct ALeffectStateVtable *vtbl;
  12. } ALeffectState;
  13. struct ALeffectStateVtable {
  14. void (*const Destruct)(ALeffectState *state);
  15. ALboolean (*const deviceUpdate)(ALeffectState *state, ALCdevice *device);
  16. void (*const update)(ALeffectState *state, ALCdevice *device, const struct ALeffectslot *slot);
  17. void (*const process)(ALeffectState *state, ALuint samplesToDo, const ALfloat *restrict samplesIn, ALfloat (*restrict samplesOut)[BUFFERSIZE]);
  18. void (*const Delete)(struct ALeffectState *state);
  19. };
  20. #define DEFINE_ALEFFECTSTATE_VTABLE(T) \
  21. DECLARE_THUNK(T, ALeffectState, void, Destruct) \
  22. DECLARE_THUNK1(T, ALeffectState, ALboolean, deviceUpdate, ALCdevice*) \
  23. DECLARE_THUNK2(T, ALeffectState, void, update, ALCdevice*, const ALeffectslot*) \
  24. DECLARE_THUNK3(T, ALeffectState, void, process, ALuint, const ALfloat*restrict, ALfloatBUFFERSIZE*restrict) \
  25. DECLARE_THUNK(T, ALeffectState, void, Delete) \
  26. \
  27. static const struct ALeffectStateVtable T##_ALeffectState_vtable = { \
  28. T##_ALeffectState_Destruct, \
  29. \
  30. T##_ALeffectState_deviceUpdate, \
  31. T##_ALeffectState_update, \
  32. T##_ALeffectState_process, \
  33. \
  34. T##_ALeffectState_Delete, \
  35. }
  36. struct ALeffectStateFactoryVtable;
  37. typedef struct ALeffectStateFactory {
  38. const struct ALeffectStateFactoryVtable *vtbl;
  39. } ALeffectStateFactory;
  40. struct ALeffectStateFactoryVtable {
  41. ALeffectState *(*const create)(ALeffectStateFactory *factory);
  42. };
  43. #define DEFINE_ALEFFECTSTATEFACTORY_VTABLE(T) \
  44. DECLARE_THUNK(T, ALeffectStateFactory, ALeffectState*, create) \
  45. \
  46. static const struct ALeffectStateFactoryVtable T##_ALeffectStateFactory_vtable = { \
  47. T##_ALeffectStateFactory_create, \
  48. }
  49. typedef struct ALeffectslot {
  50. ALenum EffectType;
  51. ALeffectProps EffectProps;
  52. volatile ALfloat Gain;
  53. volatile ALboolean AuxSendAuto;
  54. volatile ALenum NeedsUpdate;
  55. ALeffectState *EffectState;
  56. ALIGN(16) ALfloat WetBuffer[1][BUFFERSIZE];
  57. ALfloat ClickRemoval[1];
  58. ALfloat PendingClicks[1];
  59. RefCount ref;
  60. /* Self ID */
  61. ALuint id;
  62. } ALeffectslot;
  63. inline struct ALeffectslot *LookupEffectSlot(ALCcontext *context, ALuint id)
  64. { return (struct ALeffectslot*)LookupUIntMapKey(&context->EffectSlotMap, id); }
  65. inline struct ALeffectslot *RemoveEffectSlot(ALCcontext *context, ALuint id)
  66. { return (struct ALeffectslot*)RemoveUIntMapKey(&context->EffectSlotMap, id); }
  67. ALenum InitEffectSlot(ALeffectslot *slot);
  68. ALvoid ReleaseALAuxiliaryEffectSlots(ALCcontext *Context);
  69. ALeffectStateFactory *ALnullStateFactory_getFactory(void);
  70. ALeffectStateFactory *ALreverbStateFactory_getFactory(void);
  71. ALeffectStateFactory *ALautowahStateFactory_getFactory(void);
  72. ALeffectStateFactory *ALchorusStateFactory_getFactory(void);
  73. ALeffectStateFactory *ALcompressorStateFactory_getFactory(void);
  74. ALeffectStateFactory *ALdistortionStateFactory_getFactory(void);
  75. ALeffectStateFactory *ALechoStateFactory_getFactory(void);
  76. ALeffectStateFactory *ALequalizerStateFactory_getFactory(void);
  77. ALeffectStateFactory *ALflangerStateFactory_getFactory(void);
  78. ALeffectStateFactory *ALmodulatorStateFactory_getFactory(void);
  79. ALeffectStateFactory *ALdedicatedStateFactory_getFactory(void);
  80. ALenum InitializeEffect(ALCdevice *Device, ALeffectslot *EffectSlot, ALeffect *effect);
  81. void InitEffectFactoryMap(void);
  82. void DeinitEffectFactoryMap(void);
  83. #ifdef __cplusplus
  84. }
  85. #endif
  86. #endif