diff options
author | Chris Robinson <[email protected]> | 2018-01-09 22:01:46 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2018-01-09 22:01:46 -0800 |
commit | 9e2eb5dc231d835bf78a7225b6b0def74d0220ef (patch) | |
tree | b3ee84e409790e4b930ca40ca7109cbddfc83eb8 | |
parent | 5d1207104ae4bb1a20ccf72bcdf6b3406c0db6ff (diff) |
Rename the device's temp buffer storage to be more generic
-rw-r--r-- | Alc/ALu.c | 3 | ||||
-rw-r--r-- | Alc/mixer.c | 15 | ||||
-rw-r--r-- | OpenAL32/Include/alMain.h | 7 |
3 files changed, 13 insertions, 12 deletions
@@ -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) diff --git a/Alc/mixer.c b/Alc/mixer.c index a7f0f302..4a1230a7 100644 --- a/Alc/mixer.c +++ b/Alc/mixer.c @@ -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 ); diff --git a/OpenAL32/Include/alMain.h b/OpenAL32/Include/alMain.h index 37baabed..74b01b09 100644 --- a/OpenAL32/Include/alMain.h +++ b/OpenAL32/Include/alMain.h @@ -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 { |