aboutsummaryrefslogtreecommitdiffstats
path: root/OpenAL32
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2016-02-14 01:22:01 -0800
committerChris Robinson <[email protected]>2016-02-14 01:22:01 -0800
commit25732d0895cc4d320472fc50cd74302d91b24a0c (patch)
treef2a6d757dceaef243881c1e942208db1bebb7d4e /OpenAL32
parenta9135ec39d8722502e92fc5141661c3479d877d9 (diff)
Calculate channel gain stepping just before mixing
Diffstat (limited to 'OpenAL32')
-rw-r--r--OpenAL32/Include/alSource.h3
-rw-r--r--OpenAL32/Include/alu.h20
-rw-r--r--OpenAL32/alSource.c9
3 files changed, 16 insertions, 16 deletions
diff --git a/OpenAL32/Include/alSource.h b/OpenAL32/Include/alSource.h
index 253cd05f..bf589e8d 100644
--- a/OpenAL32/Include/alSource.h
+++ b/OpenAL32/Include/alSource.h
@@ -30,6 +30,9 @@ typedef struct ALvoice {
/** Current target parameters used for mixing. */
ALint Step;
+ /* If not 'moving', gain/coefficients are set directly without fading. */
+ ALboolean Moving;
+
ALboolean IsHrtf;
ALuint Offset; /* Number of output samples mixed since starting. */
diff --git a/OpenAL32/Include/alu.h b/OpenAL32/Include/alu.h
index eb2ea534..50ef1f5e 100644
--- a/OpenAL32/Include/alu.h
+++ b/OpenAL32/Include/alu.h
@@ -143,13 +143,10 @@ typedef struct DirectParams {
ALfloat (*OutBuffer)[BUFFERSIZE];
ALuint OutChannels;
- /* If not 'moving', gain/coefficients are set directly without fading. */
- ALboolean Moving;
- /* Stepping counter for gain/coefficient fading. */
- ALuint Counter;
/* Last direction (relative to listener) and gain of a moving source. */
aluVector LastDir;
ALfloat LastGain;
+ ALuint HrtfCounter;
struct {
enum ActiveFilters ActiveType;
@@ -161,22 +158,27 @@ typedef struct DirectParams {
HrtfParams Params;
HrtfState State;
} Hrtf[MAX_INPUT_CHANNELS];
- MixGains Gains[MAX_INPUT_CHANNELS][MAX_OUTPUT_CHANNELS];
+
+ struct {
+ ALfloat Current[MAX_OUTPUT_CHANNELS];
+ ALfloat Target[MAX_OUTPUT_CHANNELS];
+ } Gains[MAX_INPUT_CHANNELS];
} DirectParams;
typedef struct SendParams {
ALfloat (*OutBuffer)[BUFFERSIZE];
ALuint OutChannels;
- ALboolean Moving;
- ALuint Counter;
-
struct {
enum ActiveFilters ActiveType;
ALfilterState LowPass;
ALfilterState HighPass;
} Filters[MAX_INPUT_CHANNELS];
- MixGains Gains[MAX_INPUT_CHANNELS][MAX_EFFECT_CHANNELS];
+
+ struct {
+ ALfloat Current[MAX_OUTPUT_CHANNELS];
+ ALfloat Target[MAX_OUTPUT_CHANNELS];
+ } Gains[MAX_INPUT_CHANNELS];
} SendParams;
diff --git a/OpenAL32/alSource.c b/OpenAL32/alSource.c
index d31a0377..f742e1fe 100644
--- a/OpenAL32/alSource.c
+++ b/OpenAL32/alSource.c
@@ -2640,8 +2640,8 @@ ALvoid SetSourceState(ALsource *Source, ALCcontext *Context, ALenum state)
if(discontinuity)
memset(voice->PrevSamples, 0, sizeof(voice->PrevSamples));
- voice->Direct.Moving = AL_FALSE;
- voice->Direct.Counter = 0;
+ voice->Moving = AL_FALSE;
+ voice->Direct.HrtfCounter = 0;
for(i = 0;i < MAX_INPUT_CHANNELS;i++)
{
ALsizei j;
@@ -2653,11 +2653,6 @@ ALvoid SetSourceState(ALsource *Source, ALCcontext *Context, ALenum state)
voice->Direct.Hrtf[i].State.Values[j][1] = 0.0f;
}
}
- for(i = 0;i < (ALsizei)device->NumAuxSends;i++)
- {
- voice->Send[i].Moving = AL_FALSE;
- voice->Send[i].Counter = 0;
- }
if(BufferList->buffer->FmtChannels == FmtMono)
voice->Update = CalcSourceParams;