From 14166264d6fc59386d9cbbfcd12c78ffab5989fb Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Mon, 11 Jul 2016 23:30:32 -0700 Subject: Store the voice output buffers separate from the params --- Alc/ALu.c | 40 ++++++++++++++++++++-------------------- Alc/mixer.c | 28 ++++++++++++++-------------- 2 files changed, 34 insertions(+), 34 deletions(-) (limited to 'Alc') diff --git a/Alc/ALu.c b/Alc/ALu.c index ac958d41..ecf89d59 100644 --- a/Alc/ALu.c +++ b/Alc/ALu.c @@ -418,8 +418,8 @@ static void CalcNonAttnSourceParams(ALvoice *voice, const struct ALsourceProps * StereoMap[0].angle = -ATOMIC_LOAD(&props->StereoPan[0], almemory_order_relaxed); StereoMap[1].angle = -ATOMIC_LOAD(&props->StereoPan[1], almemory_order_relaxed); - voice->Direct.OutBuffer = Device->Dry.Buffer; - voice->Direct.OutChannels = Device->Dry.NumChannels; + voice->DirectOut.Buffer = Device->Dry.Buffer; + voice->DirectOut.Channels = Device->Dry.NumChannels; for(i = 0;i < NumSends;i++) { SendSlots[i] = ATOMIC_LOAD(&props->Send[i].Slot, almemory_order_relaxed); @@ -428,13 +428,13 @@ static void CalcNonAttnSourceParams(ALvoice *voice, const struct ALsourceProps * if(!SendSlots[i] || SendSlots[i]->Params.EffectType == AL_EFFECT_NULL) { SendSlots[i] = NULL; - voice->Send[i].OutBuffer = NULL; - voice->Send[i].OutChannels = 0; + voice->SendOut[i].Buffer = NULL; + voice->SendOut[i].Channels = 0; } else { - voice->Send[i].OutBuffer = SendSlots[i]->WetBuffer; - voice->Send[i].OutChannels = SendSlots[i]->NumChannels; + voice->SendOut[i].Buffer = SendSlots[i]->WetBuffer; + voice->SendOut[i].Channels = SendSlots[i]->NumChannels; } } voice->Looping = ATOMIC_LOAD(&props->Looping, almemory_order_relaxed); @@ -544,8 +544,8 @@ static void CalcNonAttnSourceParams(ALvoice *voice, const struct ALsourceProps * 0.0f, -V[0]*scale, V[1]*scale, -V[2]*scale ); - voice->Direct.OutBuffer = Device->FOAOut.Buffer; - voice->Direct.OutChannels = Device->FOAOut.NumChannels; + voice->DirectOut.Buffer = Device->FOAOut.Buffer; + voice->DirectOut.Channels = Device->FOAOut.NumChannels; for(c = 0;c < num_channels;c++) ComputeFirstOrderGains(Device->FOAOut, matrix.m[c], DryGain, voice->Direct.Gains[c].Target); @@ -580,8 +580,8 @@ static void CalcNonAttnSourceParams(ALvoice *voice, const struct ALsourceProps * if(DirectChannels) { /* Skip the virtual channels and write inputs to the real output. */ - voice->Direct.OutBuffer = Device->RealOut.Buffer; - voice->Direct.OutChannels = Device->RealOut.NumChannels; + voice->DirectOut.Buffer = Device->RealOut.Buffer; + voice->DirectOut.Channels = Device->RealOut.NumChannels; for(c = 0;c < num_channels;c++) { int idx; @@ -620,8 +620,8 @@ static void CalcNonAttnSourceParams(ALvoice *voice, const struct ALsourceProps * /* Full HRTF rendering. Skip the virtual channels and render each * input channel to the real outputs. */ - voice->Direct.OutBuffer = Device->RealOut.Buffer; - voice->Direct.OutChannels = Device->RealOut.NumChannels; + voice->DirectOut.Buffer = Device->RealOut.Buffer; + voice->DirectOut.Channels = Device->RealOut.NumChannels; for(c = 0;c < num_channels;c++) { if(chans[c].channel == LFE) @@ -864,8 +864,8 @@ static void CalcAttnSourceParams(ALvoice *voice, const struct ALsourceProps *pro WetGainHFAuto = ATOMIC_LOAD(&props->WetGainHFAuto, almemory_order_relaxed); RoomRolloffBase = ATOMIC_LOAD(&props->RoomRolloffFactor, almemory_order_relaxed); - voice->Direct.OutBuffer = Device->Dry.Buffer; - voice->Direct.OutChannels = Device->Dry.NumChannels; + voice->DirectOut.Buffer = Device->Dry.Buffer; + voice->DirectOut.Channels = Device->Dry.NumChannels; for(i = 0;i < NumSends;i++) { SendSlots[i] = ATOMIC_LOAD(&props->Send[i].Slot, almemory_order_relaxed); @@ -897,13 +897,13 @@ static void CalcAttnSourceParams(ALvoice *voice, const struct ALsourceProps *pro if(!SendSlots[i]) { - voice->Send[i].OutBuffer = NULL; - voice->Send[i].OutChannels = 0; + voice->SendOut[i].Buffer = NULL; + voice->SendOut[i].Channels = 0; } else { - voice->Send[i].OutBuffer = SendSlots[i]->WetBuffer; - voice->Send[i].OutChannels = SendSlots[i]->NumChannels; + voice->SendOut[i].Buffer = SendSlots[i]->WetBuffer; + voice->SendOut[i].Channels = SendSlots[i]->NumChannels; } } voice->Looping = ATOMIC_LOAD(&props->Looping, almemory_order_relaxed); @@ -1138,8 +1138,8 @@ static void CalcAttnSourceParams(ALvoice *voice, const struct ALsourceProps *pro ALfloat coeffs[MAX_AMBI_COEFFS]; ALfloat spread = 0.0f; - voice->Direct.OutBuffer = Device->RealOut.Buffer; - voice->Direct.OutChannels = Device->RealOut.NumChannels; + voice->DirectOut.Buffer = Device->RealOut.Buffer; + voice->DirectOut.Channels = Device->RealOut.NumChannels; if(Distance > FLT_EPSILON) { diff --git a/Alc/mixer.c b/Alc/mixer.c index 094d3768..748a2357 100644 --- a/Alc/mixer.c +++ b/Alc/mixer.c @@ -569,7 +569,7 @@ ALvoid MixSource(ALvoice *voice, ALsource *Source, ALCdevice *Device, ALuint Sam if(!Counter) { - for(j = 0;j < parms->OutChannels;j++) + for(j = 0;j < voice->DirectOut.Channels;j++) { gains[j].Target = targets[j]; gains[j].Current = gains[j].Target; @@ -578,7 +578,7 @@ ALvoid MixSource(ALvoice *voice, ALsource *Source, ALCdevice *Device, ALuint Sam } else { - for(j = 0;j < parms->OutChannels;j++) + for(j = 0;j < voice->DirectOut.Channels;j++) { ALfloat diff; gains[j].Target = targets[j]; @@ -594,10 +594,10 @@ ALvoid MixSource(ALvoice *voice, ALsource *Source, ALCdevice *Device, ALuint Sam } } - MixSamples(samples, parms->OutChannels, parms->OutBuffer, gains, - Counter, OutPos, DstBufferSize); + MixSamples(samples, voice->DirectOut.Channels, voice->DirectOut.Buffer, + gains, Counter, OutPos, DstBufferSize); - for(j = 0;j < parms->OutChannels;j++) + for(j = 0;j < voice->DirectOut.Channels;j++) currents[j] = gains[j].Current; } else @@ -639,9 +639,9 @@ ALvoid MixSource(ALvoice *voice, ALsource *Source, ALCdevice *Device, ALuint Sam ridx = GetChannelIdxByName(Device->RealOut, FrontRight); assert(lidx != -1 && ridx != -1); - MixHrtfSamples(parms->OutBuffer, lidx, ridx, samples, Counter, voice->Offset, - OutPos, IrSize, &hrtfparams, &parms->Hrtf[chan].State, - DstBufferSize); + MixHrtfSamples(voice->DirectOut.Buffer, lidx, ridx, samples, Counter, + voice->Offset, OutPos, IrSize, &hrtfparams, + &parms->Hrtf[chan].State, DstBufferSize); } } @@ -653,7 +653,7 @@ ALvoid MixSource(ALvoice *voice, ALsource *Source, ALCdevice *Device, ALuint Sam MixGains gains[MAX_OUTPUT_CHANNELS]; const ALfloat *samples; - if(!parms->OutBuffer) + if(!voice->SendOut[j].Buffer) continue; samples = DoFilters( @@ -664,7 +664,7 @@ ALvoid MixSource(ALvoice *voice, ALsource *Source, ALCdevice *Device, ALuint Sam if(!Counter) { - for(j = 0;j < parms->OutChannels;j++) + for(j = 0;j < voice->SendOut[j].Channels;j++) { gains[j].Target = targets[j]; gains[j].Current = gains[j].Target; @@ -673,7 +673,7 @@ ALvoid MixSource(ALvoice *voice, ALsource *Source, ALCdevice *Device, ALuint Sam } else { - for(j = 0;j < parms->OutChannels;j++) + for(j = 0;j < voice->SendOut[j].Channels;j++) { ALfloat diff; gains[j].Target = targets[j]; @@ -689,10 +689,10 @@ ALvoid MixSource(ALvoice *voice, ALsource *Source, ALCdevice *Device, ALuint Sam } } - MixSamples(samples, parms->OutChannels, parms->OutBuffer, gains, - Counter, OutPos, DstBufferSize); + MixSamples(samples, voice->SendOut[j].Channels, voice->SendOut[j].Buffer, + gains, Counter, OutPos, DstBufferSize); - for(j = 0;j < parms->OutChannels;j++) + for(j = 0;j < voice->SendOut[j].Channels;j++) currents[j] = gains[j].Current; } } -- cgit v1.2.3