Store the voice output buffers separate from the params
This commit is contained in:
@@ -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)
|
||||
{
|
||||
|
||||
+14
-14
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,6 +41,16 @@ typedef struct ALvoice {
|
||||
|
||||
BsincState SincState;
|
||||
|
||||
struct {
|
||||
ALfloat (*Buffer)[BUFFERSIZE];
|
||||
ALuint Channels;
|
||||
} DirectOut;
|
||||
|
||||
struct {
|
||||
ALfloat (*Buffer)[BUFFERSIZE];
|
||||
ALuint Channels;
|
||||
} SendOut[MAX_SENDS];
|
||||
|
||||
DirectParams Direct;
|
||||
SendParams Send[MAX_SENDS];
|
||||
} ALvoice;
|
||||
|
||||
@@ -125,9 +125,6 @@ typedef struct MixHrtfParams {
|
||||
} MixHrtfParams;
|
||||
|
||||
typedef struct DirectParams {
|
||||
ALfloat (*OutBuffer)[BUFFERSIZE];
|
||||
ALuint OutChannels;
|
||||
|
||||
struct {
|
||||
enum ActiveFilters ActiveType;
|
||||
ALfilterState LowPass;
|
||||
@@ -147,9 +144,6 @@ typedef struct DirectParams {
|
||||
} DirectParams;
|
||||
|
||||
typedef struct SendParams {
|
||||
ALfloat (*OutBuffer)[BUFFERSIZE];
|
||||
ALuint OutChannels;
|
||||
|
||||
struct {
|
||||
enum ActiveFilters ActiveType;
|
||||
ALfilterState LowPass;
|
||||
|
||||
Reference in New Issue
Block a user