AuroraOpenALSoft/OpenAL32/Include/alSource.h

143 lines
3.6 KiB
C
Raw Normal View History

2007-11-14 02:02:18 +00:00
#ifndef _AL_SOURCE_H_
#define _AL_SOURCE_H_
#define MAX_SENDS 4
#include "alFilter.h"
#include "alu.h"
2007-11-14 02:02:18 +00:00
#include "AL/al.h"
#ifdef __cplusplus
extern "C" {
#endif
#define SRC_HISTORY_BITS (6)
#define SRC_HISTORY_LENGTH (1<<SRC_HISTORY_BITS)
#define SRC_HISTORY_MASK (SRC_HISTORY_LENGTH-1)
2011-07-03 04:33:53 +00:00
extern enum Resampler DefaultResampler;
2010-01-11 13:37:20 +00:00
extern const ALsizei ResamplerPadding[RESAMPLER_MAX];
extern const ALsizei ResamplerPrePadding[RESAMPLER_MAX];
2007-11-14 02:02:18 +00:00
typedef struct ALbufferlistitem
{
struct ALbuffer *buffer;
2007-11-14 02:02:18 +00:00
struct ALbufferlistitem *next;
struct ALbufferlistitem *prev;
2007-11-14 02:02:18 +00:00
} ALbufferlistitem;
typedef struct ALsource
2007-11-14 02:02:18 +00:00
{
2011-09-11 08:18:57 +00:00
volatile ALfloat flPitch;
volatile ALfloat flGain;
volatile ALfloat flOuterGain;
volatile ALfloat flMinGain;
volatile ALfloat flMaxGain;
volatile ALfloat flInnerAngle;
volatile ALfloat flOuterAngle;
volatile ALfloat flRefDistance;
volatile ALfloat flMaxDistance;
volatile ALfloat flRollOffFactor;
volatile ALfloat vPosition[3];
volatile ALfloat vVelocity[3];
volatile ALfloat vOrientation[3];
volatile ALboolean bHeadRelative;
volatile ALboolean bLooping;
volatile enum DistanceModel DistanceModel;
volatile ALboolean VirtualChannels;
2007-11-14 02:02:18 +00:00
2011-07-03 04:33:53 +00:00
enum Resampler Resampler;
2010-01-11 13:37:20 +00:00
2011-09-11 08:18:57 +00:00
volatile ALenum state;
ALenum new_state;
ALuint position;
ALuint position_fraction;
2008-08-16 00:43:07 +00:00
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
ALfloat DirectGain;
ALfloat DirectGainHF;
2007-12-18 23:10:21 +00:00
struct {
struct ALeffectslot *Slot;
ALfloat WetGain;
ALfloat WetGainHF;
} Send[MAX_SENDS];
2007-12-18 23:10:21 +00:00
2011-09-11 08:18:57 +00:00
volatile ALboolean DryGainHFAuto;
volatile ALboolean WetGainAuto;
volatile ALboolean WetGainHFAuto;
volatile ALfloat OuterGainHF;
2011-09-11 08:18:57 +00:00
volatile ALfloat AirAbsorptionFactor;
volatile ALfloat RoomRolloffFactor;
volatile ALfloat DopplerFactor;
2011-09-11 08:18:57 +00:00
ALint lOffset;
ALint lOffsetType;
2007-11-14 02:02:18 +00:00
// Source Type (Static, Streaming, or Undetermined)
2011-09-11 08:18:57 +00:00
volatile ALint lSourceType;
2007-11-14 02:02:18 +00:00
ALuint NumChannels;
ALuint SampleSize;
2011-05-01 20:21:56 +00:00
/* HRTF info */
ALboolean HrtfMoving;
ALuint HrtfCounter;
ALfloat HrtfHistory[MAXCHANNELS][SRC_HISTORY_LENGTH];
ALfloat HrtfValues[MAXCHANNELS][HRIR_LENGTH][2];
2011-05-01 20:21:56 +00:00
ALuint HrtfOffset;
/* Current target parameters used for mixing */
struct {
MixerFunc DoMix;
ALint Step;
ALfloat HrtfGain;
ALfloat HrtfDir[3];
ALfloat HrtfCoeffs[MAXCHANNELS][HRIR_LENGTH][2];
ALuint HrtfDelay[MAXCHANNELS][2];
ALfloat HrtfCoeffStep[HRIR_LENGTH][2];
ALint HrtfDelayStep[2];
2011-05-01 20:21:56 +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];
2010-11-24 18:01:50 +00:00
FILTER iirFilter;
ALfloat history[MAXCHANNELS*2];
2010-11-24 18:01:50 +00:00
struct {
struct ALeffectslot *Slot;
2010-11-24 18:01:50 +00:00
ALfloat WetGain;
FILTER iirFilter;
ALfloat history[MAXCHANNELS];
} Send[MAX_SENDS];
} Params;
2011-08-29 20:43:59 +00:00
volatile ALenum NeedsUpdate;
ALvoid (*Update)(struct ALsource *self, const ALCcontext *context);
// Index to itself
ALuint source;
2007-11-14 02:02:18 +00:00
} ALsource;
#define ALsource_Update(s,a) ((s)->Update(s,a))
2007-11-14 02:02:18 +00:00
ALvoid SetSourceState(ALsource *Source, ALCcontext *Context, ALenum state);
ALboolean ApplyOffset(ALsource *Source);
ALvoid ReleaseALSources(ALCcontext *Context);
2007-11-14 02:02:18 +00:00
#ifdef __cplusplus
}
#endif
#endif