alSource.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. #ifndef _AL_SOURCE_H_
  2. #define _AL_SOURCE_H_
  3. #define MAX_SENDS 4
  4. #include "alFilter.h"
  5. #include "alu.h"
  6. #include "AL/al.h"
  7. #ifdef __cplusplus
  8. extern "C" {
  9. #endif
  10. typedef enum {
  11. POINT_RESAMPLER = 0,
  12. LINEAR_RESAMPLER,
  13. CUBIC_RESAMPLER,
  14. RESAMPLER_MAX,
  15. RESAMPLER_MIN = -1,
  16. RESAMPLER_DEFAULT = LINEAR_RESAMPLER
  17. } resampler_t;
  18. extern resampler_t DefaultResampler;
  19. extern const ALsizei ResamplerPadding[RESAMPLER_MAX];
  20. extern const ALsizei ResamplerPrePadding[RESAMPLER_MAX];
  21. typedef struct ALbufferlistitem
  22. {
  23. struct ALbuffer *buffer;
  24. struct ALbufferlistitem *next;
  25. struct ALbufferlistitem *prev;
  26. } ALbufferlistitem;
  27. typedef struct ALsource
  28. {
  29. ALfp flPitch;
  30. ALfp flGain;
  31. ALfp flOuterGain;
  32. ALfp flMinGain;
  33. ALfp flMaxGain;
  34. ALfp flInnerAngle;
  35. ALfp flOuterAngle;
  36. ALfp flRefDistance;
  37. ALfp flMaxDistance;
  38. ALfp flRollOffFactor;
  39. ALfp vPosition[3];
  40. ALfp vVelocity[3];
  41. ALfp vOrientation[3];
  42. ALboolean bHeadRelative;
  43. ALboolean bLooping;
  44. ALenum DistanceModel;
  45. // Apportably Extension
  46. ALuint priority;
  47. resampler_t Resampler;
  48. ALenum state;
  49. ALuint position;
  50. ALuint position_fraction;
  51. struct ALbuffer *Buffer;
  52. ALbufferlistitem *queue; // Linked list of buffers in queue
  53. ALuint BuffersInQueue; // Number of buffers in queue
  54. ALuint BuffersPlayed; // Number of buffers played on this loop
  55. ALfilter DirectFilter;
  56. struct {
  57. struct ALeffectslot *Slot;
  58. ALfilter WetFilter;
  59. } Send[MAX_SENDS];
  60. ALboolean DryGainHFAuto;
  61. ALboolean WetGainAuto;
  62. ALboolean WetGainHFAuto;
  63. ALfp OuterGainHF;
  64. ALfp AirAbsorptionFactor;
  65. ALfp RoomRolloffFactor;
  66. ALfp DopplerFactor;
  67. ALint lOffset;
  68. ALint lOffsetType;
  69. // Source Type (Static, Streaming, or Undetermined)
  70. ALint lSourceType;
  71. // Current target parameters used for mixing
  72. ALboolean NeedsUpdate;
  73. struct {
  74. ALint Step;
  75. /* A mixing matrix. First subscript is the channel number of the input
  76. * data (regardless of channel configuration) and the second is the
  77. * channel target (eg. FRONT_LEFT) */
  78. ALfp DryGains[MAXCHANNELS][MAXCHANNELS];
  79. FILTER iirFilter;
  80. ALfp history[MAXCHANNELS*2];
  81. struct {
  82. ALfp WetGain;
  83. FILTER iirFilter;
  84. ALfp history[MAXCHANNELS];
  85. } Send[MAX_SENDS];
  86. } Params;
  87. ALvoid (*Update)(struct ALsource *self, const ALCcontext *context);
  88. // Index to itself
  89. ALuint source;
  90. } ALsource;
  91. #define ALsource_Update(s,a) ((s)->Update(s,a))
  92. ALvoid ReleaseALSources(ALCcontext *Context);
  93. #ifdef __cplusplus
  94. }
  95. #endif
  96. #endif