2007-11-14 02:02:18 +00:00
|
|
|
#ifndef _AL_SOURCE_H_
|
|
|
|
#define _AL_SOURCE_H_
|
|
|
|
|
2010-11-06 22:08:54 +00:00
|
|
|
#define MAX_SENDS 4
|
2007-12-19 02:13:49 +00:00
|
|
|
|
2007-12-18 00:28:16 +00:00
|
|
|
#include "alFilter.h"
|
2008-08-14 12:43:52 +00:00
|
|
|
#include "alu.h"
|
2007-11-14 02:02:18 +00:00
|
|
|
#include "AL/al.h"
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2011-06-17 23:22:39 +00:00
|
|
|
#define SRC_HISTORY_BITS (6)
|
2011-06-03 08:06:00 +00:00
|
|
|
#define SRC_HISTORY_LENGTH (1<<SRC_HISTORY_BITS)
|
|
|
|
#define SRC_HISTORY_MASK (SRC_HISTORY_LENGTH-1)
|
|
|
|
|
2010-01-11 13:37:20 +00:00
|
|
|
typedef enum {
|
2010-01-12 07:47:03 +00:00
|
|
|
POINT_RESAMPLER = 0,
|
|
|
|
LINEAR_RESAMPLER,
|
2010-11-26 07:05:44 +00:00
|
|
|
CUBIC_RESAMPLER,
|
2010-01-11 13:37:20 +00:00
|
|
|
|
2010-01-11 15:02:29 +00:00
|
|
|
RESAMPLER_MAX,
|
|
|
|
RESAMPLER_MIN = -1,
|
2010-01-12 07:47:03 +00:00
|
|
|
RESAMPLER_DEFAULT = LINEAR_RESAMPLER
|
2010-01-11 13:37:20 +00:00
|
|
|
} resampler_t;
|
|
|
|
extern resampler_t DefaultResampler;
|
|
|
|
|
2010-11-29 01:37:14 +00:00
|
|
|
extern const ALsizei ResamplerPadding[RESAMPLER_MAX];
|
|
|
|
extern const ALsizei ResamplerPrePadding[RESAMPLER_MAX];
|
|
|
|
|
2010-11-26 10:53:15 +00:00
|
|
|
|
2007-11-14 02:02:18 +00:00
|
|
|
typedef struct ALbufferlistitem
|
|
|
|
{
|
2009-10-22 16:31:26 +00:00
|
|
|
struct ALbuffer *buffer;
|
2007-11-14 02:02:18 +00:00
|
|
|
struct ALbufferlistitem *next;
|
2010-11-26 02:30:57 +00:00
|
|
|
struct ALbufferlistitem *prev;
|
2007-11-14 02:02:18 +00:00
|
|
|
} ALbufferlistitem;
|
|
|
|
|
2007-12-31 09:09:21 +00:00
|
|
|
typedef struct ALsource
|
2007-11-14 02:02:18 +00:00
|
|
|
{
|
|
|
|
ALfloat flPitch;
|
|
|
|
ALfloat flGain;
|
|
|
|
ALfloat flOuterGain;
|
|
|
|
ALfloat flMinGain;
|
|
|
|
ALfloat flMaxGain;
|
|
|
|
ALfloat flInnerAngle;
|
|
|
|
ALfloat flOuterAngle;
|
|
|
|
ALfloat flRefDistance;
|
|
|
|
ALfloat flMaxDistance;
|
|
|
|
ALfloat flRollOffFactor;
|
|
|
|
ALfloat vPosition[3];
|
|
|
|
ALfloat vVelocity[3];
|
|
|
|
ALfloat vOrientation[3];
|
|
|
|
ALboolean bHeadRelative;
|
|
|
|
ALboolean bLooping;
|
2008-11-26 02:56:10 +00:00
|
|
|
ALenum DistanceModel;
|
2007-11-14 02:02:18 +00:00
|
|
|
|
2010-01-11 13:37:20 +00:00
|
|
|
resampler_t Resampler;
|
|
|
|
|
2007-11-14 02:02:18 +00:00
|
|
|
ALenum state;
|
|
|
|
ALuint position;
|
|
|
|
ALuint position_fraction;
|
2008-08-16 00:43:07 +00:00
|
|
|
|
2009-10-22 16:31:26 +00:00
|
|
|
struct ALbuffer *Buffer;
|
|
|
|
|
2010-11-27 04:35:47 +00:00
|
|
|
ALbufferlistitem *queue; // Linked list of buffers in queue
|
|
|
|
ALuint BuffersInQueue; // Number of buffers in queue
|
|
|
|
ALuint BuffersPlayed; // Number of buffers played on this loop
|
2007-11-14 02:02:18 +00:00
|
|
|
|
2007-12-18 00:28:16 +00:00
|
|
|
ALfilter DirectFilter;
|
|
|
|
|
2007-12-18 23:10:21 +00:00
|
|
|
struct {
|
2008-01-16 22:01:24 +00:00
|
|
|
struct ALeffectslot *Slot;
|
2007-12-18 23:10:21 +00:00
|
|
|
ALfilter WetFilter;
|
2007-12-19 02:13:49 +00:00
|
|
|
} Send[MAX_SENDS];
|
2007-12-18 23:10:21 +00:00
|
|
|
|
2007-12-18 05:33:05 +00:00
|
|
|
ALboolean DryGainHFAuto;
|
2007-12-19 03:13:41 +00:00
|
|
|
ALboolean WetGainAuto;
|
2007-12-19 00:54:22 +00:00
|
|
|
ALboolean WetGainHFAuto;
|
2007-12-18 05:56:31 +00:00
|
|
|
ALfloat OuterGainHF;
|
2007-12-18 05:33:05 +00:00
|
|
|
|
2007-12-18 21:37:07 +00:00
|
|
|
ALfloat AirAbsorptionFactor;
|
2007-12-19 03:03:40 +00:00
|
|
|
ALfloat RoomRolloffFactor;
|
2008-07-15 09:33:05 +00:00
|
|
|
ALfloat DopplerFactor;
|
|
|
|
|
2007-11-14 02:02:18 +00:00
|
|
|
ALint lOffset;
|
|
|
|
ALint lOffsetType;
|
|
|
|
|
|
|
|
// Source Type (Static, Streaming, or Undetermined)
|
|
|
|
ALint lSourceType;
|
|
|
|
|
2011-05-17 20:25:15 +00:00
|
|
|
ALuint NumChannels;
|
2011-05-19 00:02:18 +00:00
|
|
|
ALuint SampleSize;
|
2011-05-17 20:25:15 +00:00
|
|
|
|
2011-05-01 20:21:56 +00:00
|
|
|
/* HRTF info */
|
2011-06-17 23:22:39 +00:00
|
|
|
ALfloat HrtfHistory[MAXCHANNELS][SRC_HISTORY_LENGTH];
|
|
|
|
ALfloat HrtfValues[MAXCHANNELS][HRIR_LENGTH][2];
|
2011-05-01 20:21:56 +00:00
|
|
|
ALuint HrtfOffset;
|
|
|
|
|
2011-06-03 08:06:00 +00:00
|
|
|
/* Current target parameters used for mixing */
|
2009-10-21 21:25:54 +00:00
|
|
|
struct {
|
2010-08-07 12:43:16 +00:00
|
|
|
ALint Step;
|
2009-10-21 21:25:54 +00:00
|
|
|
|
2011-06-03 08:06:00 +00:00
|
|
|
ALfloat HrtfCoeffs[MAXCHANNELS][HRIR_LENGTH][2];
|
|
|
|
ALuint HrtfDelay[MAXCHANNELS][2];
|
2011-05-01 20:21:56 +00:00
|
|
|
|
2010-12-10 00:37:23 +00:00
|
|
|
/* A mixing matrix. First subscript is the channel number of the input
|
|
|
|
* data (regardless of channel configuration) and the second is the
|
|
|
|
* channel target (eg. FRONT_LEFT) */
|
|
|
|
ALfloat DryGains[MAXCHANNELS][MAXCHANNELS];
|
2011-06-03 08:06:00 +00:00
|
|
|
|
2010-11-24 18:01:50 +00:00
|
|
|
FILTER iirFilter;
|
2010-12-02 02:33:17 +00:00
|
|
|
ALfloat history[MAXCHANNELS*2];
|
2010-11-24 18:01:50 +00:00
|
|
|
|
2009-10-21 21:25:54 +00:00
|
|
|
struct {
|
2010-11-24 18:01:50 +00:00
|
|
|
ALfloat WetGain;
|
2009-10-21 21:25:54 +00:00
|
|
|
FILTER iirFilter;
|
2010-12-02 02:33:17 +00:00
|
|
|
ALfloat history[MAXCHANNELS];
|
2009-10-21 21:25:54 +00:00
|
|
|
} Send[MAX_SENDS];
|
|
|
|
} Params;
|
2011-06-03 08:06:00 +00:00
|
|
|
ALboolean NeedsUpdate;
|
2010-09-26 08:15:27 +00:00
|
|
|
|
2010-08-04 06:10:00 +00:00
|
|
|
ALvoid (*Update)(struct ALsource *self, const ALCcontext *context);
|
2011-05-06 07:20:40 +00:00
|
|
|
ALvoid (*DoMix)(struct ALsource *self, ALCdevice *Device,
|
|
|
|
const ALvoid *RESTRICT data,
|
|
|
|
ALuint *DataPosInt, ALuint *DataPosFrac,
|
|
|
|
ALuint OutPos, ALuint SamplesToDo, ALuint BufferSize);
|
|
|
|
ALvoid (*DoHrtfMix)(struct ALsource *self, ALCdevice *Device,
|
|
|
|
const ALvoid *RESTRICT data,
|
|
|
|
ALuint *DataPosInt, ALuint *DataPosFrac,
|
|
|
|
ALuint OutPos, ALuint SamplesToDo, ALuint BufferSize);
|
2009-10-21 21:25:54 +00:00
|
|
|
|
|
|
|
// Index to itself
|
|
|
|
ALuint source;
|
2007-11-14 02:02:18 +00:00
|
|
|
} ALsource;
|
2011-05-06 07:20:40 +00:00
|
|
|
#define ALsource_Update(s,a) ((s)->Update(s,a))
|
|
|
|
#define ALsource_DoMix(s,a,b,c,d,e,f,g) ((s)->DoMix(s,a,b,c,d,e,f,g))
|
|
|
|
#define ALsource_DoHrtfMix(s,a,b,c,d,e,f,g) ((s)->DoHrtfMix(s,a,b,c,d,e,f,g))
|
2007-11-14 02:02:18 +00:00
|
|
|
|
2008-01-16 21:27:15 +00:00
|
|
|
ALvoid ReleaseALSources(ALCcontext *Context);
|
|
|
|
|
2007-11-14 02:02:18 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif
|