129 lines
3.0 KiB
C
Raw Normal View History

2007-11-13 18:02:18 -08:00
#ifndef _AL_SOURCE_H_
#define _AL_SOURCE_H_
#include "bool.h"
2012-09-14 02:42:36 -07:00
#include "alMain.h"
#include "alu.h"
#include "hrtf.h"
#include "atomic.h"
2007-11-13 18:02:18 -08:00
#define MAX_SENDS 16
#define DEFAULT_SENDS 2
2007-11-13 18:02:18 -08:00
#ifdef __cplusplus
extern "C" {
#endif
struct ALbuffer;
struct ALsource;
typedef struct ALbufferlistitem {
struct ALbuffer *buffer;
ATOMIC(struct ALbufferlistitem*) next;
2007-11-13 18:02:18 -08:00
} ALbufferlistitem;
typedef struct ALsource {
2012-04-26 03:26:22 -07:00
/** Source properties. */
ALfloat Pitch;
ALfloat Gain;
ALfloat OuterGain;
ALfloat MinGain;
ALfloat MaxGain;
ALfloat InnerAngle;
ALfloat OuterAngle;
ALfloat RefDistance;
ALfloat MaxDistance;
ALfloat RollOffFactor;
ALfloat Position[3];
ALfloat Velocity[3];
ALfloat Direction[3];
ALfloat Orientation[2][3];
ALboolean HeadRelative;
ALboolean Looping;
enum DistanceModel DistanceModel;
enum Resampler Resampler;
ALboolean DirectChannels;
enum SpatializeMode Spatialize;
ALboolean DryGainHFAuto;
ALboolean WetGainAuto;
ALboolean WetGainHFAuto;
ALfloat OuterGainHF;
ALfloat AirAbsorptionFactor;
ALfloat RoomRolloffFactor;
ALfloat DopplerFactor;
2016-03-25 14:40:44 -07:00
/* NOTE: Stereo pan angles are specified in radians, counter-clockwise
* rather than clockwise.
*/
ALfloat StereoPan[2];
2016-03-25 14:40:44 -07:00
ALfloat Radius;
2016-05-14 23:43:40 -07:00
/** Direct filter and auxiliary send info. */
struct {
ALfloat Gain;
ALfloat GainHF;
ALfloat HFReference;
ALfloat GainLF;
ALfloat LFReference;
} Direct;
struct {
struct ALeffectslot *Slot;
ALfloat Gain;
ALfloat GainHF;
ALfloat HFReference;
ALfloat GainLF;
ALfloat LFReference;
} *Send;
2016-05-14 23:43:40 -07:00
2012-04-26 03:26:22 -07:00
/**
* Last user-specified offset, and the offset type (bytes, samples, or
* seconds).
*/
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) */
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) */
ATOMIC(ALenum) state;
2012-04-26 03:26:22 -07:00
/** Source Buffer Queue head. */
2016-07-07 19:48:21 -07:00
RWLock queue_lock;
ALbufferlistitem *queue;
ATOMIC_FLAG PropsClean;
2012-04-26 03:26:22 -07:00
/** Self ID */
ALuint id;
2007-11-13 18:02:18 -08:00
} ALsource;
inline void LockSourcesRead(ALCcontext *context)
{ LockUIntMapRead(&context->SourceMap); }
inline void UnlockSourcesRead(ALCcontext *context)
{ UnlockUIntMapRead(&context->SourceMap); }
inline void LockSourcesWrite(ALCcontext *context)
{ LockUIntMapWrite(&context->SourceMap); }
inline void UnlockSourcesWrite(ALCcontext *context)
{ UnlockUIntMapWrite(&context->SourceMap); }
inline struct ALsource *LookupSource(ALCcontext *context, ALuint id)
{ return (struct ALsource*)LookupUIntMapKeyNoLock(&context->SourceMap, id); }
inline struct ALsource *RemoveSource(ALCcontext *context, ALuint id)
{ return (struct ALsource*)RemoveUIntMapKeyNoLock(&context->SourceMap, id); }
2016-05-14 23:43:40 -07:00
void UpdateAllSourceProps(ALCcontext *context);
ALvoid ReleaseALSources(ALCcontext *Context);
2007-11-13 18:02:18 -08:00
#ifdef __cplusplus
}
#endif
#endif