Add a callback flag for voices

This commit is contained in:
Chris Robinson
2020-02-17 04:50:00 -08:00
parent a221f8671e
commit c8dfd24818
2 changed files with 17 additions and 6 deletions
+11 -3
View File
@@ -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 */
+6 -3
View File
@@ -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 {