diff options
author | Chris Robinson <[email protected]> | 2012-04-27 00:45:42 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2012-04-27 01:36:13 -0700 |
commit | 549d542a316c1f557c8042d9fc2b409bcd999872 (patch) | |
tree | 16b02e7a55e3bd045df8ea8336e5ee5ebd371c11 /OpenAL32 | |
parent | 2cdb58fb850f085b801c3d33b82512efd083020c (diff) |
Reorganize some ALsource fields
Diffstat (limited to 'OpenAL32')
-rw-r--r-- | OpenAL32/Include/alSource.h | 50 | ||||
-rw-r--r-- | OpenAL32/alSource.c | 34 |
2 files changed, 47 insertions, 37 deletions
diff --git a/OpenAL32/Include/alSource.h b/OpenAL32/Include/alSource.h index c3ae3fe7..98803115 100644 --- a/OpenAL32/Include/alSource.h +++ b/OpenAL32/Include/alSource.h @@ -28,6 +28,23 @@ typedef struct ALbufferlistitem struct ALbufferlistitem *prev; } ALbufferlistitem; +typedef struct HrtfParams { + ALfloat Gain; + ALfloat Dir[3]; + ALfloat Coeffs[MAXCHANNELS][HRIR_LENGTH][2]; + ALuint Delay[MAXCHANNELS][2]; + ALfloat CoeffStep[HRIR_LENGTH][2]; + ALint DelayStep[2]; +} HrtfParams; + +typedef struct HrtfState { + ALboolean Moving; + ALuint Counter; + ALfloat History[MAXCHANNELS][SRC_HISTORY_LENGTH]; + ALfloat Values[MAXCHANNELS][HRIR_LENGTH][2]; + ALuint Offset; +} HrtfState; + typedef struct ALsource { /** Source properties. */ @@ -97,16 +114,12 @@ typedef struct ALsource struct { struct ALeffectslot *Slot; - ALfloat WetGain; - ALfloat WetGainHF; + ALfloat Gain; + ALfloat GainHF; } Send[MAX_SENDS]; /** HRTF info. */ - ALboolean HrtfMoving; - ALuint HrtfCounter; - ALfloat HrtfHistory[MAXCHANNELS][SRC_HISTORY_LENGTH]; - ALfloat HrtfValues[MAXCHANNELS][HRIR_LENGTH][2]; - ALuint HrtfOffset; + HrtfState Hrtf; /** Current target parameters used for mixing. */ struct { @@ -114,24 +127,21 @@ typedef struct ALsource 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]; + HrtfParams Hrtf; - /* 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]; + struct { + /* 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 Gains[MAXCHANNELS][MAXCHANNELS]; - FILTER iirFilter; - ALfloat history[MAXCHANNELS*2]; + FILTER iirFilter; + ALfloat history[MAXCHANNELS*2]; + } Direct; struct { struct ALeffectslot *Slot; - ALfloat WetGain; + ALfloat Gain; FILTER iirFilter; ALfloat history[MAXCHANNELS]; } Send[MAX_SENDS]; diff --git a/OpenAL32/alSource.c b/OpenAL32/alSource.c index 5f52322f..7d0e51d6 100644 --- a/OpenAL32/alSource.c +++ b/OpenAL32/alSource.c @@ -686,13 +686,13 @@ AL_API void AL_APIENTRY alSource3i(ALuint source, ALenum param, ALint value1, AL if(!filter) { /* Disable filter */ - Source->Send[value2].WetGain = 1.0f; - Source->Send[value2].WetGainHF = 1.0f; + Source->Send[value2].Gain = 1.0f; + Source->Send[value2].GainHF = 1.0f; } else { - Source->Send[value2].WetGain = filter->Gain; - Source->Send[value2].WetGainHF = filter->GainHF; + Source->Send[value2].Gain = filter->Gain; + Source->Send[value2].GainHF = filter->GainHF; } Source->NeedsUpdate = AL_TRUE; UnlockContext(Context); @@ -1633,14 +1633,14 @@ static ALvoid InitSourceParams(ALsource *Source) Source->DirectGainHF = 1.0f; for(i = 0;i < MAX_SENDS;i++) { - Source->Send[i].WetGain = 1.0f; - Source->Send[i].WetGainHF = 1.0f; + Source->Send[i].Gain = 1.0f; + Source->Send[i].GainHF = 1.0f; } Source->NeedsUpdate = AL_TRUE; - Source->HrtfMoving = AL_FALSE; - Source->HrtfCounter = 0; + Source->Hrtf.Moving = AL_FALSE; + Source->Hrtf.Counter = 0; } @@ -1670,11 +1670,11 @@ ALvoid SetSourceState(ALsource *Source, ALCcontext *Context, ALenum state) for(j = 0;j < MAXCHANNELS;j++) { for(k = 0;k < SRC_HISTORY_LENGTH;k++) - Source->HrtfHistory[j][k] = 0.0f; + Source->Hrtf.History[j][k] = 0.0f; for(k = 0;k < HRIR_LENGTH;k++) { - Source->HrtfValues[j][k][0] = 0.0f; - Source->HrtfValues[j][k][1] = 0.0f; + Source->Hrtf.Values[j][k][0] = 0.0f; + Source->Hrtf.Values[j][k][1] = 0.0f; } } } @@ -1714,8 +1714,8 @@ ALvoid SetSourceState(ALsource *Source, ALCcontext *Context, ALenum state) if(Source->state == AL_PLAYING) { Source->state = AL_PAUSED; - Source->HrtfMoving = AL_FALSE; - Source->HrtfCounter = 0; + Source->Hrtf.Moving = AL_FALSE; + Source->Hrtf.Counter = 0; } } else if(state == AL_STOPPED) @@ -1724,8 +1724,8 @@ ALvoid SetSourceState(ALsource *Source, ALCcontext *Context, ALenum state) { Source->state = AL_STOPPED; Source->BuffersPlayed = Source->BuffersInQueue; - Source->HrtfMoving = AL_FALSE; - Source->HrtfCounter = 0; + Source->Hrtf.Moving = AL_FALSE; + Source->Hrtf.Counter = 0; } Source->Offset = -1.0; } @@ -1737,8 +1737,8 @@ ALvoid SetSourceState(ALsource *Source, ALCcontext *Context, ALenum state) Source->position = 0; Source->position_fraction = 0; Source->BuffersPlayed = 0; - Source->HrtfMoving = AL_FALSE; - Source->HrtfCounter = 0; + Source->Hrtf.Moving = AL_FALSE; + Source->Hrtf.Counter = 0; } Source->Offset = -1.0; } |