From c8dfd248185359d86410340741122943524ed10b Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Mon, 17 Feb 2020 04:50:00 -0800 Subject: Add a callback flag for voices --- alc/voice.cpp | 14 +++++++++++--- alc/voice.h | 9 ++++++--- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/alc/voice.cpp b/alc/voice.cpp index 1bcde31c..752f13a9 100644 --- a/alc/voice.cpp +++ b/alc/voice.cpp @@ -531,7 +531,7 @@ void ALvoice::mix(const State vstate, ALCcontext *Context, const ALuint SamplesT ASSUME(SamplesToDo > 0); /* Get voice info */ - const bool isstatic{(mFlags&VOICE_IS_STATIC) != 0}; + const ALuint vtype{mFlags&VOICE_TYPE_MASK}; ALuint DataPosInt{mPosition.load(std::memory_order_relaxed)}; ALuint DataPosFrac{mPositionFrac.load(std::memory_order_relaxed)}; ALbufferlistitem *BufferListItem{mCurrentBuffer.load(std::memory_order_relaxed)}; @@ -649,9 +649,13 @@ void ALvoice::mix(const State vstate, ALCcontext *Context, const ALuint SamplesT if UNLIKELY(!BufferListItem) srciter = std::copy(chandata.mPrevSamples.begin()+(MAX_RESAMPLER_PADDING>>1), chandata.mPrevSamples.end(), srciter); - else if(isstatic) + else if(vtype == VOICE_IS_STATIC) srciter = LoadBufferStatic(BufferListItem, BufferLoopItem, NumChannels, SampleSize, chan, DataPosInt, {srciter, SrcData.end()}); + else if(vtype == VOICE_IS_CALLBACK) + { + /* Not Yet Implemented. */ + } else srciter = LoadBufferQueue(BufferListItem, BufferLoopItem, NumChannels, SampleSize, chan, DataPosInt, {srciter, SrcData.end()}); @@ -745,7 +749,7 @@ void ALvoice::mix(const State vstate, ALCcontext *Context, const ALuint SamplesT { /* Do nothing extra when there's no buffers. */ } - else if(isstatic) + else if(vtype == VOICE_IS_STATIC) { if(BufferLoopItem) { @@ -769,6 +773,10 @@ void ALvoice::mix(const State vstate, ALCcontext *Context, const ALuint SamplesT } } } + else if(vtype == VOICE_IS_CALLBACK) + { + /* Do nothing extra for callback buffers. */ + } else { /* Handle streaming source */ diff --git a/alc/voice.h b/alc/voice.h index 07abe0eb..a5b6fac5 100644 --- a/alc/voice.h +++ b/alc/voice.h @@ -181,10 +181,13 @@ struct ALvoiceProps : public ALvoicePropsBase { }; #define VOICE_IS_STATIC (1u<<0) -#define VOICE_IS_FADING (1u<<1) /* Fading sources use gain stepping for smooth transitions. */ +#define VOICE_IS_CALLBACK (1u<<1) #define VOICE_IS_AMBISONIC (1u<<2) /* Voice needs HF scaling for ambisonic upsampling. */ -#define VOICE_HAS_HRTF (1u<<3) -#define VOICE_HAS_NFC (1u<<4) +#define VOICE_IS_FADING (1u<<3) /* Fading sources use gain stepping for smooth transitions. */ +#define VOICE_HAS_HRTF (1u<<4) +#define VOICE_HAS_NFC (1u<<5) + +#define VOICE_TYPE_MASK (VOICE_IS_STATIC | VOICE_IS_CALLBACK) struct ALvoice { enum State { -- cgit v1.2.3