alSource.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. #ifndef _AL_SOURCE_H_
  2. #define _AL_SOURCE_H_
  3. #include "bool.h"
  4. #include "alMain.h"
  5. #include "alu.h"
  6. #include "hrtf.h"
  7. #include "atomic.h"
  8. #define MAX_SENDS 16
  9. #define DEFAULT_SENDS 2
  10. #ifdef __cplusplus
  11. extern "C" {
  12. #endif
  13. struct ALbuffer;
  14. struct ALsource;
  15. typedef struct ALbufferlistitem {
  16. struct ALbuffer *buffer;
  17. ATOMIC(struct ALbufferlistitem*) next;
  18. } ALbufferlistitem;
  19. typedef struct ALsource {
  20. /** Source properties. */
  21. ALfloat Pitch;
  22. ALfloat Gain;
  23. ALfloat OuterGain;
  24. ALfloat MinGain;
  25. ALfloat MaxGain;
  26. ALfloat InnerAngle;
  27. ALfloat OuterAngle;
  28. ALfloat RefDistance;
  29. ALfloat MaxDistance;
  30. ALfloat RolloffFactor;
  31. ALfloat Position[3];
  32. ALfloat Velocity[3];
  33. ALfloat Direction[3];
  34. ALfloat Orientation[2][3];
  35. ALboolean HeadRelative;
  36. ALboolean Looping;
  37. enum DistanceModel DistanceModel;
  38. enum Resampler Resampler;
  39. ALboolean DirectChannels;
  40. enum SpatializeMode Spatialize;
  41. ALboolean DryGainHFAuto;
  42. ALboolean WetGainAuto;
  43. ALboolean WetGainHFAuto;
  44. ALfloat OuterGainHF;
  45. ALfloat AirAbsorptionFactor;
  46. ALfloat RoomRolloffFactor;
  47. ALfloat DopplerFactor;
  48. /* NOTE: Stereo pan angles are specified in radians, counter-clockwise
  49. * rather than clockwise.
  50. */
  51. ALfloat StereoPan[2];
  52. ALfloat Radius;
  53. /** Direct filter and auxiliary send info. */
  54. struct {
  55. ALfloat Gain;
  56. ALfloat GainHF;
  57. ALfloat HFReference;
  58. ALfloat GainLF;
  59. ALfloat LFReference;
  60. } Direct;
  61. struct {
  62. struct ALeffectslot *Slot;
  63. ALfloat Gain;
  64. ALfloat GainHF;
  65. ALfloat HFReference;
  66. ALfloat GainLF;
  67. ALfloat LFReference;
  68. } *Send;
  69. /**
  70. * Last user-specified offset, and the offset type (bytes, samples, or
  71. * seconds).
  72. */
  73. ALdouble Offset;
  74. ALenum OffsetType;
  75. /** Source type (static, streaming, or undetermined) */
  76. ALint SourceType;
  77. /** Source state (initial, playing, paused, or stopped) */
  78. ATOMIC(ALenum) state;
  79. /** Source Buffer Queue head. */
  80. RWLock queue_lock;
  81. ALbufferlistitem *queue;
  82. ATOMIC_FLAG PropsClean;
  83. /** Self ID */
  84. ALuint id;
  85. } ALsource;
  86. inline void LockSourcesRead(ALCcontext *context)
  87. { LockUIntMapRead(&context->SourceMap); }
  88. inline void UnlockSourcesRead(ALCcontext *context)
  89. { UnlockUIntMapRead(&context->SourceMap); }
  90. inline void LockSourcesWrite(ALCcontext *context)
  91. { LockUIntMapWrite(&context->SourceMap); }
  92. inline void UnlockSourcesWrite(ALCcontext *context)
  93. { UnlockUIntMapWrite(&context->SourceMap); }
  94. inline struct ALsource *LookupSource(ALCcontext *context, ALuint id)
  95. { return (struct ALsource*)LookupUIntMapKeyNoLock(&context->SourceMap, id); }
  96. inline struct ALsource *RemoveSource(ALCcontext *context, ALuint id)
  97. { return (struct ALsource*)RemoveUIntMapKeyNoLock(&context->SourceMap, id); }
  98. void UpdateAllSourceProps(ALCcontext *context);
  99. ALvoid ReleaseALSources(ALCcontext *Context);
  100. #ifdef __cplusplus
  101. }
  102. #endif
  103. #endif