Rename the device's temp buffer storage to be more generic

This commit is contained in:
Chris Robinson 2018-01-09 22:01:46 -08:00
parent 5d1207104a
commit 9e2eb5dc23
3 changed files with 13 additions and 12 deletions

View File

@ -1814,8 +1814,7 @@ void aluMixData(ALCdevice *device, ALvoid *OutBuffer, ALsizei NumSamples)
SamplesToDo, Channels);
}
/* Use NFCtrlData for temp value storage. */
ApplyDistanceComp(Buffer, device->ChannelDelay, device->NFCtrlData,
ApplyDistanceComp(Buffer, device->ChannelDelay, device->TempBuffer[0],
SamplesToDo, Channels);
if(device->Limiter)

View File

@ -268,6 +268,11 @@ static const ALfloat *DoFilters(ALfilterState *lpfilter, ALfilterState *hpfilter
}
/* This function uses these device temp buffers. */
#define SOURCE_DATA_BUF 0
#define RESAMPLED_BUF 1
#define FILTERED_BUF 2
#define NFC_DATA_BUF 3
ALboolean MixSource(ALvoice *voice, ALsource *Source, ALCdevice *Device, ALsizei SamplesToDo)
{
ALbufferlistitem *BufferListItem;
@ -337,7 +342,7 @@ ALboolean MixSource(ALvoice *voice, ALsource *Source, ALCdevice *Device, ALsizei
for(chan = 0;chan < NumChannels;chan++)
{
const ALfloat *ResampledData;
ALfloat *SrcData = Device->SourceData;
ALfloat *SrcData = Device->TempBuffer[SOURCE_DATA_BUF];
ALsizei FilledAmt;
/* Load the previous samples into the source data first, and clear the rest. */
@ -489,14 +494,14 @@ ALboolean MixSource(ALvoice *voice, ALsource *Source, ALCdevice *Device, ALsizei
/* Now resample, then filter and mix to the appropriate outputs. */
ResampledData = Resample(&voice->ResampleState,
&SrcData[MAX_PRE_SAMPLES], DataPosFrac, increment,
Device->ResampledData, DstBufferSize
Device->TempBuffer[RESAMPLED_BUF], DstBufferSize
);
{
DirectParams *parms = &voice->Direct.Params[chan];
const ALfloat *samples;
samples = DoFilters(
&parms->LowPass, &parms->HighPass, Device->FilteredData,
&parms->LowPass, &parms->HighPass, Device->TempBuffer[FILTERED_BUF],
ResampledData, DstBufferSize, voice->Direct.FilterType
);
if(!(voice->Flags&VOICE_HAS_HRTF))
@ -511,7 +516,7 @@ ALboolean MixSource(ALvoice *voice, ALsource *Source, ALCdevice *Device, ALsizei
);
else
{
ALfloat *nfcsamples = Device->NFCtrlData;
ALfloat *nfcsamples = Device->TempBuffer[NFC_DATA_BUF];
ALsizei chanoffset = 0;
MixSamples(samples,
@ -635,7 +640,7 @@ ALboolean MixSource(ALvoice *voice, ALsource *Source, ALCdevice *Device, ALsizei
continue;
samples = DoFilters(
&parms->LowPass, &parms->HighPass, Device->FilteredData,
&parms->LowPass, &parms->HighPass, Device->TempBuffer[FILTERED_BUF],
ResampledData, DstBufferSize, voice->Send[send].FilterType
);

View File

@ -748,11 +748,8 @@ struct ALCdevice_struct
ALuint64 ClockBase;
ALuint SamplesDone;
/* Temp storage used for each source when mixing. */
alignas(16) ALfloat SourceData[BUFFERSIZE];
alignas(16) ALfloat ResampledData[BUFFERSIZE];
alignas(16) ALfloat FilteredData[BUFFERSIZE];
alignas(16) ALfloat NFCtrlData[BUFFERSIZE];
/* Temp storage used for mixer processing. */
alignas(16) ALfloat TempBuffer[4][BUFFERSIZE];
/* The "dry" path corresponds to the main output. */
struct {