aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/ALu.c
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2017-02-14 19:59:39 -0800
committerChris Robinson <[email protected]>2017-02-14 19:59:39 -0800
commit5a50c46c22e7e6c5f119613584d826bc7b7b4a61 (patch)
tree2c0420dd6bc84dda8efabb5bd099abe85ee58b84 /Alc/ALu.c
parent69dd57096183c4e381cc3f5c0a8ac4e33048b346 (diff)
Make ALsourceProps' Send array dynamically sized
ALsourceProps' Send[] array is placed at the end of the struct, and given an indeterminate size. Extra space is allocated at the end of each struct given the number of auxiliary sends set for the device.
Diffstat (limited to 'Alc/ALu.c')
-rw-r--r--Alc/ALu.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/Alc/ALu.c b/Alc/ALu.c
index 31dd6271..3cb02f84 100644
--- a/Alc/ALu.c
+++ b/Alc/ALu.c
@@ -807,14 +807,6 @@ static void CalcAttnSourceParams(ALvoice *voice, const struct ALsourceProps *pro
ALint NumSends;
ALint i;
- DryGainHF = 1.0f;
- DryGainLF = 1.0f;
- for(i = 0;i < MAX_SENDS;i++)
- {
- WetGainHF[i] = 1.0f;
- WetGainLF[i] = 1.0f;
- }
-
/* Get context/device properties */
DopplerFactor = Listener->Params.DopplerFactor;
SpeedOfSound = Listener->Params.SpeedOfSound;
@@ -989,8 +981,14 @@ static void CalcAttnSourceParams(ALvoice *voice, const struct ALsourceProps *pro
/* Source Gain + Attenuation */
DryGain = SourceVolume * Attenuation;
+ DryGainHF = 1.0f;
+ DryGainLF = 1.0f;
for(i = 0;i < NumSends;i++)
+ {
WetGain[i] = SourceVolume * RoomAttenuation[i];
+ WetGainHF[i] = 1.0f;
+ WetGainLF[i] = 1.0f;
+ }
/* Distance-based air absorption */
if(AirAbsorptionFactor > 0.0f && ClampedDist > MinDist)
@@ -1284,7 +1282,9 @@ static void CalcSourceParams(ALvoice *voice, ALCcontext *context, ALboolean forc
if(props)
{
- voice->Props = *props;
+ memcpy(voice->Props, props,
+ offsetof(struct ALsourceProps, Send[context->Device->NumAuxSends])
+ );
ATOMIC_REPLACE_HEAD(struct ALsourceProps*, &source->FreeList, props);
}
@@ -1296,9 +1296,9 @@ static void CalcSourceParams(ALvoice *voice, ALCcontext *context, ALboolean forc
if((buffer=BufferListItem->buffer) != NULL)
{
if(buffer->FmtChannels == FmtMono)
- CalcAttnSourceParams(voice, &voice->Props, buffer, context);
+ CalcAttnSourceParams(voice, voice->Props, buffer, context);
else
- CalcNonAttnSourceParams(voice, &voice->Props, buffer, context);
+ CalcNonAttnSourceParams(voice, voice->Props, buffer, context);
break;
}
BufferListItem = BufferListItem->next;