2007-11-13 18:02:18 -08:00
|
|
|
#ifndef _AL_SOURCE_H_
|
|
|
|
#define _AL_SOURCE_H_
|
|
|
|
|
2010-11-06 15:08:54 -07:00
|
|
|
#define MAX_SENDS 4
|
2007-12-18 18:13:49 -08:00
|
|
|
|
2012-09-14 02:42:36 -07:00
|
|
|
#include "alMain.h"
|
2008-08-14 05:43:52 -07:00
|
|
|
#include "alu.h"
|
2014-02-23 21:11:01 -08:00
|
|
|
#include "hrtf.h"
|
2007-11-13 18:02:18 -08:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2011-07-02 21:33:53 -07:00
|
|
|
extern enum Resampler DefaultResampler;
|
2010-01-11 05:37:20 -08:00
|
|
|
|
2012-02-12 08:45:19 -08:00
|
|
|
extern const ALsizei ResamplerPadding[ResamplerMax];
|
|
|
|
extern const ALsizei ResamplerPrePadding[ResamplerMax];
|
2010-11-28 17:37:14 -08:00
|
|
|
|
2010-11-26 02:53:15 -08:00
|
|
|
|
2013-10-07 05:41:41 -07:00
|
|
|
typedef struct ALbufferlistitem {
|
2009-10-22 09:31:26 -07:00
|
|
|
struct ALbuffer *buffer;
|
2007-11-13 18:02:18 -08:00
|
|
|
struct ALbufferlistitem *next;
|
2010-11-25 18:30:57 -08:00
|
|
|
struct ALbufferlistitem *prev;
|
2007-11-13 18:02:18 -08:00
|
|
|
} ALbufferlistitem;
|
|
|
|
|
2014-03-18 19:56:25 -07:00
|
|
|
|
2014-03-19 13:14:11 -07:00
|
|
|
typedef struct ALactivesource {
|
|
|
|
struct ALsource *Source;
|
|
|
|
|
|
|
|
/** Method to update mixing parameters. */
|
|
|
|
ALvoid (*Update)(struct ALactivesource *self, const ALCcontext *context);
|
|
|
|
|
|
|
|
/** Current target parameters used for mixing. */
|
|
|
|
ResamplerFunc Resample;
|
|
|
|
DryMixerFunc DryMix;
|
|
|
|
WetMixerFunc WetMix;
|
|
|
|
|
|
|
|
ALint Step;
|
|
|
|
|
|
|
|
DirectParams Direct;
|
|
|
|
SendParams Send[MAX_SENDS];
|
|
|
|
} ALactivesource;
|
|
|
|
|
|
|
|
|
2014-03-18 19:56:25 -07:00
|
|
|
typedef struct ALsource {
|
2012-04-26 03:26:22 -07:00
|
|
|
/** Source properties. */
|
2012-04-19 21:46:29 -07:00
|
|
|
volatile ALfloat Pitch;
|
|
|
|
volatile ALfloat Gain;
|
|
|
|
volatile ALfloat OuterGain;
|
|
|
|
volatile ALfloat MinGain;
|
|
|
|
volatile ALfloat MaxGain;
|
|
|
|
volatile ALfloat InnerAngle;
|
|
|
|
volatile ALfloat OuterAngle;
|
|
|
|
volatile ALfloat RefDistance;
|
|
|
|
volatile ALfloat MaxDistance;
|
|
|
|
volatile ALfloat RollOffFactor;
|
|
|
|
volatile ALfloat Position[3];
|
|
|
|
volatile ALfloat Velocity[3];
|
|
|
|
volatile ALfloat Orientation[3];
|
|
|
|
volatile ALboolean HeadRelative;
|
|
|
|
volatile ALboolean Looping;
|
2011-09-11 01:18:57 -07:00
|
|
|
volatile enum DistanceModel DistanceModel;
|
2012-02-09 23:35:17 -08:00
|
|
|
volatile ALboolean DirectChannels;
|
2007-11-13 18:02:18 -08:00
|
|
|
|
2011-09-11 01:18:57 -07:00
|
|
|
volatile ALboolean DryGainHFAuto;
|
|
|
|
volatile ALboolean WetGainAuto;
|
|
|
|
volatile ALboolean WetGainHFAuto;
|
|
|
|
volatile ALfloat OuterGainHF;
|
2007-12-17 21:33:05 -08:00
|
|
|
|
2011-09-11 01:18:57 -07:00
|
|
|
volatile ALfloat AirAbsorptionFactor;
|
|
|
|
volatile ALfloat RoomRolloffFactor;
|
|
|
|
volatile ALfloat DopplerFactor;
|
2008-07-15 02:33:05 -07:00
|
|
|
|
2012-04-26 03:26:22 -07:00
|
|
|
enum Resampler Resampler;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Last user-specified offset, and the offset type (bytes, samples, or
|
|
|
|
* seconds).
|
|
|
|
*/
|
2012-04-16 22:11:03 -07:00
|
|
|
ALdouble Offset;
|
|
|
|
ALenum OffsetType;
|
2007-11-13 18:02:18 -08:00
|
|
|
|
2012-04-26 03:26:22 -07:00
|
|
|
/** Source type (static, streaming, or undetermined) */
|
2012-04-19 21:46:29 -07:00
|
|
|
volatile ALint SourceType;
|
2007-11-13 18:02:18 -08:00
|
|
|
|
2012-04-26 03:26:22 -07:00
|
|
|
/** Source state (initial, playing, paused, or stopped) */
|
|
|
|
volatile ALenum state;
|
|
|
|
ALenum new_state;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Source offset in samples, relative to the currently playing buffer, NOT
|
|
|
|
* the whole queue, and the fractional (fixed-point) offset to the next
|
|
|
|
* sample.
|
|
|
|
*/
|
|
|
|
ALuint position;
|
|
|
|
ALuint position_fraction;
|
|
|
|
|
|
|
|
/** Source Buffer Queue info. */
|
|
|
|
ALbufferlistitem *queue;
|
|
|
|
ALuint BuffersInQueue;
|
|
|
|
ALuint BuffersPlayed;
|
|
|
|
|
|
|
|
/** Current buffer sample info. */
|
2011-05-17 13:25:15 -07:00
|
|
|
ALuint NumChannels;
|
2011-05-18 17:02:18 -07:00
|
|
|
ALuint SampleSize;
|
2011-05-17 13:25:15 -07:00
|
|
|
|
2012-04-26 03:26:22 -07:00
|
|
|
/** Direct filter and auxiliary send info. */
|
|
|
|
ALfloat DirectGain;
|
|
|
|
ALfloat DirectGainHF;
|
|
|
|
|
|
|
|
struct {
|
|
|
|
struct ALeffectslot *Slot;
|
2012-04-27 00:45:42 -07:00
|
|
|
ALfloat Gain;
|
|
|
|
ALfloat GainHF;
|
2012-04-26 03:26:22 -07:00
|
|
|
} Send[MAX_SENDS];
|
|
|
|
|
|
|
|
/** Source needs to update its mixing parameters. */
|
2011-08-29 13:43:59 -07:00
|
|
|
volatile ALenum NeedsUpdate;
|
2010-09-26 01:15:27 -07:00
|
|
|
|
2012-04-26 03:26:22 -07:00
|
|
|
/** Self ID */
|
2012-04-19 22:28:01 -07:00
|
|
|
ALuint id;
|
2007-11-13 18:02:18 -08:00
|
|
|
} ALsource;
|
|
|
|
|
2013-11-04 13:51:19 -08:00
|
|
|
inline struct ALsource *LookupSource(ALCcontext *context, ALuint id)
|
|
|
|
{ return (struct ALsource*)LookupUIntMapKey(&context->SourceMap, id); }
|
|
|
|
inline struct ALsource *RemoveSource(ALCcontext *context, ALuint id)
|
|
|
|
{ return (struct ALsource*)RemoveUIntMapKey(&context->SourceMap, id); }
|
|
|
|
|
2011-08-20 06:31:10 -07:00
|
|
|
ALvoid SetSourceState(ALsource *Source, ALCcontext *Context, ALenum state);
|
2011-08-21 00:49:04 -07:00
|
|
|
ALboolean ApplyOffset(ALsource *Source);
|
|
|
|
|
2008-01-16 13:27:15 -08:00
|
|
|
ALvoid ReleaseALSources(ALCcontext *Context);
|
|
|
|
|
2007-11-13 18:02:18 -08:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif
|