aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2020-02-17 04:50:00 -0800
committerChris Robinson <[email protected]>2020-02-17 04:50:00 -0800
commitc8dfd248185359d86410340741122943524ed10b (patch)
tree18a0910189f4f6cc44fbc48d31816cad6dfd9cb7
parenta221f8671e8e1424d623222d64f0555c51342525 (diff)
Add a callback flag for voices
-rw-r--r--alc/voice.cpp14
-rw-r--r--alc/voice.h9
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 {