diff options
author | Sven Gothel <[email protected]> | 2014-06-10 05:30:02 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2014-06-10 05:30:02 +0200 |
commit | f95bf4457fbc31112fa82dacbc1b7e094b9fd1cf (patch) | |
tree | 965ba5b8e6fc8e6bfe7a981c1dfb1179bb9adcde /OpenAL32/Include/alSource.h | |
parent | 7297c3214a4c648aaee81a9877da15b88f798197 (diff) | |
parent | c07fb7b45c1e345dbaa439882250de5b2213026f (diff) |
Merge branch 'UPSTREAM' into UPSTREAM_MERGE
Diffstat (limited to 'OpenAL32/Include/alSource.h')
-rw-r--r-- | OpenAL32/Include/alSource.h | 106 |
1 files changed, 32 insertions, 74 deletions
diff --git a/OpenAL32/Include/alSource.h b/OpenAL32/Include/alSource.h index 31a0d229..f87f1672 100644 --- a/OpenAL32/Include/alSource.h +++ b/OpenAL32/Include/alSource.h @@ -5,17 +5,12 @@ #include "alMain.h" #include "alu.h" -#include "alFilter.h" -#include "alBuffer.h" +#include "hrtf.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) - extern enum Resampler DefaultResampler; extern const ALsizei ResamplerPadding[ResamplerMax]; @@ -28,57 +23,32 @@ typedef struct ALbufferlistitem { struct ALbufferlistitem *prev; } ALbufferlistitem; -typedef struct HrtfState { - ALboolean Moving; - ALuint Counter; - ALIGN(16) ALfloat History[MAX_INPUT_CHANNELS][SRC_HISTORY_LENGTH]; - ALIGN(16) ALfloat Values[MAX_INPUT_CHANNELS][HRIR_LENGTH][2]; - ALuint Offset; -} HrtfState; - -typedef struct HrtfParams { - ALfloat Gain; - ALfloat Dir[3]; - ALIGN(16) ALfloat Coeffs[MAX_INPUT_CHANNELS][HRIR_LENGTH][2]; - ALIGN(16) ALfloat CoeffStep[HRIR_LENGTH][2]; - ALuint Delay[MAX_INPUT_CHANNELS][2]; - ALint DelayStep[2]; - ALuint IrSize; -} HrtfParams; - -typedef struct DirectParams { - ALfloat (*OutBuffer)[BUFFERSIZE]; - ALfloat *ClickRemoval; - ALfloat *PendingClicks; - struct { - HrtfParams Params; - HrtfState *State; - } Hrtf; +typedef struct ALactivesource { + struct ALsource *Source; - /* 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. FrontLeft). Not used with HRTF. */ - ALfloat Gains[MAX_INPUT_CHANNELS][MaxChannels]; + /** Method to update mixing parameters. */ + ALvoid (*Update)(struct ALactivesource *self, const ALCcontext *context); - ALfilterState LpFilter[MAX_INPUT_CHANNELS]; -} DirectParams; + /** Current target parameters used for mixing. */ + ResamplerFunc Resample; + union { + DryMixerFunc Mix; + HrtfMixerFunc HrtfMix; + } Dry; + WetMixerFunc WetMix; -typedef struct SendParams { - ALfloat (*OutBuffer)[BUFFERSIZE]; - ALfloat *ClickRemoval; - ALfloat *PendingClicks; + ALboolean IsHrtf; + ALint Step; - /* Gain control, which applies to all input channels to a single (mono) - * output buffer. */ - ALfloat Gain; + ALuint Offset; /* Number of output samples mixed since starting. */ - ALfilterState LpFilter[MAX_INPUT_CHANNELS]; -} SendParams; + DirectParams Direct; + SendParams Send[MAX_SENDS]; +} ALactivesource; -typedef struct ALsource -{ +typedef struct ALsource { /** Source properties. */ volatile ALfloat Pitch; volatile ALfloat Gain; @@ -132,49 +102,37 @@ typedef struct ALsource ALuint position_fraction; /** Source Buffer Queue info. */ - ALbufferlistitem *queue; - ALuint BuffersInQueue; - ALuint BuffersPlayed; + ALbufferlistitem *volatile queue; + ALbufferlistitem *volatile current_buffer; + RWLock queue_lock; /** Current buffer sample info. */ ALuint NumChannels; ALuint SampleSize; /** Direct filter and auxiliary send info. */ - ALfloat DirectGain; - ALfloat DirectGainHF; - + 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[MAX_SENDS]; - /** HRTF info. */ - HrtfState Hrtf; - - /** Current target parameters used for mixing. */ - struct { - ResamplerFunc Resample; - DryMixerFunc DryMix; - WetMixerFunc WetMix; - - ALint Step; - - DirectParams Direct; - - SendParams Send[MAX_SENDS]; - } Params; /** Source needs to update its mixing parameters. */ volatile ALenum NeedsUpdate; - /** Method to update mixing parameters. */ - ALvoid (*Update)(struct ALsource *self, const ALCcontext *context); - /** Self ID */ ALuint id; } ALsource; -#define ALsource_Update(s,a) ((s)->Update(s,a)) inline struct ALsource *LookupSource(ALCcontext *context, ALuint id) { return (struct ALsource*)LookupUIntMapKey(&context->SourceMap, id); } |