Handle the source offset fraction as an ALsizei
This commit is contained in:
parent
319d097198
commit
aef774a7a0
@ -41,7 +41,7 @@
|
||||
static_assert((INT_MAX>>FRACTIONBITS)/MAX_PITCH > BUFFERSIZE,
|
||||
"MAX_PITCH and/or BUFFERSIZE are too large for FRACTIONBITS!");
|
||||
|
||||
extern inline void InitiatePositionArrays(ALuint frac, ALint increment, ALuint *restrict frac_arr, ALint *restrict pos_arr, ALsizei size);
|
||||
extern inline void InitiatePositionArrays(ALsizei frac, ALint increment, ALsizei *restrict frac_arr, ALint *restrict pos_arr, ALsizei size);
|
||||
|
||||
|
||||
enum Resampler {
|
||||
@ -280,7 +280,7 @@ ALboolean MixSource(ALvoice *voice, ALsource *Source, ALCdevice *Device, ALsizei
|
||||
ALsizei NumChannels, SampleSize;
|
||||
ResamplerFunc Resample;
|
||||
ALsizei DataPosInt;
|
||||
ALuint DataPosFrac;
|
||||
ALsizei DataPosFrac;
|
||||
ALint64 DataSize64;
|
||||
ALint increment;
|
||||
ALsizei Counter;
|
||||
|
@ -8,16 +8,16 @@
|
||||
#include "alAuxEffectSlot.h"
|
||||
|
||||
|
||||
static inline ALfloat point32(const ALfloat *restrict vals, ALuint UNUSED(frac))
|
||||
static inline ALfloat point32(const ALfloat *restrict vals, ALsizei UNUSED(frac))
|
||||
{ return vals[0]; }
|
||||
static inline ALfloat lerp32(const ALfloat *restrict vals, ALuint frac)
|
||||
static inline ALfloat lerp32(const ALfloat *restrict vals, ALsizei frac)
|
||||
{ return lerp(vals[0], vals[1], frac * (1.0f/FRACTIONONE)); }
|
||||
static inline ALfloat fir4_32(const ALfloat *restrict vals, ALuint frac)
|
||||
static inline ALfloat fir4_32(const ALfloat *restrict vals, ALsizei frac)
|
||||
{ return resample_fir4(vals[-1], vals[0], vals[1], vals[2], frac); }
|
||||
|
||||
|
||||
const ALfloat *Resample_copy32_C(const InterpState* UNUSED(state),
|
||||
const ALfloat *restrict src, ALuint UNUSED(frac), ALint UNUSED(increment),
|
||||
const ALfloat *restrict src, ALsizei UNUSED(frac), ALint UNUSED(increment),
|
||||
ALfloat *restrict dst, ALsizei numsamples)
|
||||
{
|
||||
#if defined(HAVE_SSE) || defined(HAVE_NEON)
|
||||
@ -31,7 +31,7 @@ const ALfloat *Resample_copy32_C(const InterpState* UNUSED(state),
|
||||
|
||||
#define DECL_TEMPLATE(Sampler) \
|
||||
const ALfloat *Resample_##Sampler##_C(const InterpState* UNUSED(state), \
|
||||
const ALfloat *restrict src, ALuint frac, ALint increment, \
|
||||
const ALfloat *restrict src, ALsizei frac, ALint increment, \
|
||||
ALfloat *restrict dst, ALsizei numsamples) \
|
||||
{ \
|
||||
ALsizei i; \
|
||||
@ -53,7 +53,7 @@ DECL_TEMPLATE(fir4_32)
|
||||
#undef DECL_TEMPLATE
|
||||
|
||||
const ALfloat *Resample_bsinc32_C(const InterpState *state, const ALfloat *restrict src,
|
||||
ALuint frac, ALint increment, ALfloat *restrict dst,
|
||||
ALsizei frac, ALint increment, ALfloat *restrict dst,
|
||||
ALsizei dstlen)
|
||||
{
|
||||
const ALfloat *fil, *scd, *phd, *spd;
|
||||
@ -79,8 +79,7 @@ const ALfloat *Resample_bsinc32_C(const InterpState *state, const ALfloat *restr
|
||||
// Apply the scale and phase interpolated filter.
|
||||
r = 0.0f;
|
||||
for(j_f = 0;j_f < m;j_f++)
|
||||
r += (fil[j_f] + sf*scd[j_f] + pf*(phd[j_f] + sf*spd[j_f])) *
|
||||
src[j_f];
|
||||
r += (fil[j_f] + sf*scd[j_f] + pf*(phd[j_f] + sf*spd[j_f])) * src[j_f];
|
||||
dst[i] = r;
|
||||
|
||||
frac += increment;
|
||||
|
@ -12,11 +12,11 @@ struct MixHrtfParams;
|
||||
struct HrtfState;
|
||||
|
||||
/* C resamplers */
|
||||
const ALfloat *Resample_copy32_C(const InterpState *state, const ALfloat *restrict src, ALuint frac, ALint increment, ALfloat *restrict dst, ALsizei dstlen);
|
||||
const ALfloat *Resample_point32_C(const InterpState *state, const ALfloat *restrict src, ALuint frac, ALint increment, ALfloat *restrict dst, ALsizei dstlen);
|
||||
const ALfloat *Resample_lerp32_C(const InterpState *state, const ALfloat *restrict src, ALuint frac, ALint increment, ALfloat *restrict dst, ALsizei dstlen);
|
||||
const ALfloat *Resample_fir4_32_C(const InterpState *state, const ALfloat *restrict src, ALuint frac, ALint increment, ALfloat *restrict dst, ALsizei dstlen);
|
||||
const ALfloat *Resample_bsinc32_C(const InterpState *state, const ALfloat *restrict src, ALuint frac, ALint increment, ALfloat *restrict dst, ALsizei dstlen);
|
||||
const ALfloat *Resample_copy32_C(const InterpState *state, const ALfloat *restrict src, ALsizei frac, ALint increment, ALfloat *restrict dst, ALsizei dstlen);
|
||||
const ALfloat *Resample_point32_C(const InterpState *state, const ALfloat *restrict src, ALsizei frac, ALint increment, ALfloat *restrict dst, ALsizei dstlen);
|
||||
const ALfloat *Resample_lerp32_C(const InterpState *state, const ALfloat *restrict src, ALsizei frac, ALint increment, ALfloat *restrict dst, ALsizei dstlen);
|
||||
const ALfloat *Resample_fir4_32_C(const InterpState *state, const ALfloat *restrict src, ALsizei frac, ALint increment, ALfloat *restrict dst, ALsizei dstlen);
|
||||
const ALfloat *Resample_bsinc32_C(const InterpState *state, const ALfloat *restrict src, ALsizei frac, ALint increment, ALfloat *restrict dst, ALsizei dstlen);
|
||||
|
||||
|
||||
/* C mixers */
|
||||
@ -52,7 +52,7 @@ void MixRow_SSE(ALfloat *OutBuffer, const ALfloat *Gains,
|
||||
ALsizei InPos, ALsizei BufferSize);
|
||||
|
||||
/* SSE resamplers */
|
||||
inline void InitiatePositionArrays(ALuint frac, ALint increment, ALuint *restrict frac_arr, ALint *restrict pos_arr, ALsizei size)
|
||||
inline void InitiatePositionArrays(ALsizei frac, ALint increment, ALsizei *restrict frac_arr, ALint *restrict pos_arr, ALsizei size)
|
||||
{
|
||||
ALsizei i;
|
||||
|
||||
@ -67,21 +67,21 @@ inline void InitiatePositionArrays(ALuint frac, ALint increment, ALuint *restric
|
||||
}
|
||||
|
||||
const ALfloat *Resample_lerp32_SSE2(const InterpState *state, const ALfloat *restrict src,
|
||||
ALuint frac, ALint increment, ALfloat *restrict dst,
|
||||
ALsizei frac, ALint increment, ALfloat *restrict dst,
|
||||
ALsizei numsamples);
|
||||
const ALfloat *Resample_lerp32_SSE41(const InterpState *state, const ALfloat *restrict src,
|
||||
ALuint frac, ALint increment, ALfloat *restrict dst,
|
||||
ALsizei frac, ALint increment, ALfloat *restrict dst,
|
||||
ALsizei numsamples);
|
||||
|
||||
const ALfloat *Resample_fir4_32_SSE3(const InterpState *state, const ALfloat *restrict src,
|
||||
ALuint frac, ALint increment, ALfloat *restrict dst,
|
||||
ALsizei frac, ALint increment, ALfloat *restrict dst,
|
||||
ALsizei numsamples);
|
||||
const ALfloat *Resample_fir4_32_SSE41(const InterpState *state, const ALfloat *restrict src,
|
||||
ALuint frac, ALint increment, ALfloat *restrict dst,
|
||||
ALsizei frac, ALint increment, ALfloat *restrict dst,
|
||||
ALsizei numsamples);
|
||||
|
||||
const ALfloat *Resample_bsinc32_SSE(const InterpState *state, const ALfloat *restrict src,
|
||||
ALuint frac, ALint increment, ALfloat *restrict dst,
|
||||
ALsizei frac, ALint increment, ALfloat *restrict dst,
|
||||
ALsizei dstlen);
|
||||
|
||||
/* Neon mixers */
|
||||
@ -102,13 +102,13 @@ void MixRow_Neon(ALfloat *OutBuffer, const ALfloat *Gains,
|
||||
|
||||
/* Neon resamplers */
|
||||
const ALfloat *Resample_lerp32_Neon(const InterpState *state, const ALfloat *restrict src,
|
||||
ALuint frac, ALint increment, ALfloat *restrict dst,
|
||||
ALsizei frac, ALint increment, ALfloat *restrict dst,
|
||||
ALsizei numsamples);
|
||||
const ALfloat *Resample_fir4_32_Neon(const InterpState *state, const ALfloat *restrict src,
|
||||
ALuint frac, ALint increment, ALfloat *restrict dst,
|
||||
ALsizei frac, ALint increment, ALfloat *restrict dst,
|
||||
ALsizei numsamples);
|
||||
const ALfloat *Resample_bsinc32_Neon(const InterpState *state, const ALfloat *restrict src,
|
||||
ALuint frac, ALint increment, ALfloat *restrict dst,
|
||||
ALsizei frac, ALint increment, ALfloat *restrict dst,
|
||||
ALsizei dstlen);
|
||||
|
||||
#endif /* MIXER_DEFS_H */
|
||||
|
@ -11,21 +11,21 @@
|
||||
|
||||
|
||||
const ALfloat *Resample_lerp32_Neon(const InterpState* UNUSED(state),
|
||||
const ALfloat *restrict src, ALuint frac, ALint increment,
|
||||
const ALfloat *restrict src, ALsizei frac, ALint increment,
|
||||
ALfloat *restrict dst, ALsizei numsamples)
|
||||
{
|
||||
const int32x4_t increment4 = vdupq_n_s32(increment*4);
|
||||
const float32x4_t fracOne4 = vdupq_n_f32(1.0f/FRACTIONONE);
|
||||
const uint32x4_t fracMask4 = vdupq_n_u32(FRACTIONMASK);
|
||||
const int32x4_t fracMask4 = vdupq_n_s32(FRACTIONMASK);
|
||||
alignas(16) ALint pos_[4];
|
||||
alignas(16) ALuint frac_[4];
|
||||
alignas(16) ALsizei frac_[4];
|
||||
int32x4_t pos4;
|
||||
uint32x4_t frac4;
|
||||
int32x4_t frac4;
|
||||
ALsizei i;
|
||||
|
||||
InitiatePositionArrays(frac, increment, frac_, pos_, 4);
|
||||
|
||||
frac4 = vld1q_u32(frac_);
|
||||
frac4 = vld1q_s32(frac_);
|
||||
pos4 = vld1q_s32(pos_);
|
||||
|
||||
for(i = 0;numsamples-i > 3;i += 4)
|
||||
@ -35,14 +35,14 @@ const ALfloat *Resample_lerp32_Neon(const InterpState* UNUSED(state),
|
||||
|
||||
/* val1 + (val2-val1)*mu */
|
||||
const float32x4_t r0 = vsubq_f32(val2, val1);
|
||||
const float32x4_t mu = vmulq_f32(vcvtq_f32_u32(frac4), fracOne4);
|
||||
const float32x4_t mu = vmulq_f32(vcvtq_f32_s32(frac4), fracOne4);
|
||||
const float32x4_t out = vmlaq_f32(val1, mu, r0);
|
||||
|
||||
vst1q_f32(&dst[i], out);
|
||||
|
||||
frac4 = vaddq_u32(frac4, (uint32x4_t)increment4);
|
||||
pos4 = vaddq_s32(pos4, (int32x4_t)vshrq_n_u32(frac4, FRACTIONBITS));
|
||||
frac4 = vandq_u32(frac4, fracMask4);
|
||||
frac4 = vaddq_s32(frac4, increment4);
|
||||
pos4 = vaddq_s32(pos4, vshrq_n_s32(frac4, FRACTIONBITS));
|
||||
frac4 = vandq_s32(frac4, fracMask4);
|
||||
|
||||
vst1q_s32(pos_, pos4);
|
||||
}
|
||||
@ -54,7 +54,7 @@ const ALfloat *Resample_lerp32_Neon(const InterpState* UNUSED(state),
|
||||
* resample.
|
||||
*/
|
||||
ALint pos = pos_[0];
|
||||
frac = vgetq_lane_u32(frac4, 0);
|
||||
frac = vgetq_lane_s32(frac4, 0);
|
||||
do {
|
||||
dst[i] = lerp(src[pos], src[pos+1], frac * (1.0f/FRACTIONONE));
|
||||
|
||||
@ -67,20 +67,20 @@ const ALfloat *Resample_lerp32_Neon(const InterpState* UNUSED(state),
|
||||
}
|
||||
|
||||
const ALfloat *Resample_fir4_32_Neon(const InterpState* UNUSED(state),
|
||||
const ALfloat *restrict src, ALuint frac, ALint increment,
|
||||
const ALfloat *restrict src, ALsizei frac, ALint increment,
|
||||
ALfloat *restrict dst, ALsizei numsamples)
|
||||
{
|
||||
const int32x4_t increment4 = vdupq_n_s32(increment*4);
|
||||
const uint32x4_t fracMask4 = vdupq_n_u32(FRACTIONMASK);
|
||||
const int32x4_t fracMask4 = vdupq_n_s32(FRACTIONMASK);
|
||||
alignas(16) ALint pos_[4];
|
||||
alignas(16) ALuint frac_[4];
|
||||
alignas(16) ALsizei frac_[4];
|
||||
int32x4_t pos4;
|
||||
uint32x4_t frac4;
|
||||
int32x4_t frac4;
|
||||
ALsizei i;
|
||||
|
||||
InitiatePositionArrays(frac, increment, frac_, pos_, 4);
|
||||
|
||||
frac4 = vld1q_u32(frac_);
|
||||
frac4 = vld1q_s32(frac_);
|
||||
pos4 = vld1q_s32(pos_);
|
||||
|
||||
--src;
|
||||
@ -109,12 +109,12 @@ const ALfloat *Resample_fir4_32_Neon(const InterpState* UNUSED(state),
|
||||
|
||||
vst1q_f32(&dst[i], out);
|
||||
|
||||
frac4 = vaddq_u32(frac4, (uint32x4_t)increment4);
|
||||
pos4 = vaddq_s32(pos4, (int32x4_t)vshrq_n_u32(frac4, FRACTIONBITS));
|
||||
frac4 = vandq_u32(frac4, fracMask4);
|
||||
frac4 = vaddq_s32(frac4, increment4);
|
||||
pos4 = vaddq_s32(pos4, vshrq_n_s32(frac4, FRACTIONBITS));
|
||||
frac4 = vandq_s32(frac4, fracMask4);
|
||||
|
||||
vst1q_s32(pos_, pos4);
|
||||
vst1q_u32(frac_, frac4);
|
||||
vst1q_s32(frac_, frac4);
|
||||
}
|
||||
|
||||
if(i < numsamples)
|
||||
@ -137,7 +137,7 @@ const ALfloat *Resample_fir4_32_Neon(const InterpState* UNUSED(state),
|
||||
}
|
||||
|
||||
const ALfloat *Resample_bsinc32_Neon(const InterpState *state,
|
||||
const ALfloat *restrict src, ALuint frac, ALint increment,
|
||||
const ALfloat *restrict src, ALsizei frac, ALint increment,
|
||||
ALfloat *restrict dst, ALsizei dstlen)
|
||||
{
|
||||
const float32x4_t sf4 = vdupq_n_f32(state->bsinc.sf);
|
||||
|
@ -13,7 +13,7 @@
|
||||
|
||||
|
||||
const ALfloat *Resample_bsinc32_SSE(const InterpState *state, const ALfloat *restrict src,
|
||||
ALuint frac, ALint increment, ALfloat *restrict dst,
|
||||
ALsizei frac, ALint increment, ALfloat *restrict dst,
|
||||
ALsizei dstlen)
|
||||
{
|
||||
const __m128 sf4 = _mm_set1_ps(state->bsinc.sf);
|
||||
|
@ -28,14 +28,14 @@
|
||||
|
||||
|
||||
const ALfloat *Resample_lerp32_SSE2(const InterpState* UNUSED(state),
|
||||
const ALfloat *restrict src, ALuint frac, ALint increment,
|
||||
const ALfloat *restrict src, ALsizei frac, ALint increment,
|
||||
ALfloat *restrict dst, ALsizei numsamples)
|
||||
{
|
||||
const __m128i increment4 = _mm_set1_epi32(increment*4);
|
||||
const __m128 fracOne4 = _mm_set1_ps(1.0f/FRACTIONONE);
|
||||
const __m128i fracMask4 = _mm_set1_epi32(FRACTIONMASK);
|
||||
union { alignas(16) ALint i[4]; float f[4]; } pos_;
|
||||
union { alignas(16) ALuint i[4]; float f[4]; } frac_;
|
||||
union { alignas(16) ALsizei i[4]; float f[4]; } frac_;
|
||||
__m128i frac4, pos4;
|
||||
ALint pos;
|
||||
ALsizei i;
|
||||
|
@ -32,13 +32,13 @@
|
||||
|
||||
|
||||
const ALfloat *Resample_fir4_32_SSE3(const InterpState* UNUSED(state),
|
||||
const ALfloat *restrict src, ALuint frac, ALint increment,
|
||||
const ALfloat *restrict src, ALsizei frac, ALint increment,
|
||||
ALfloat *restrict dst, ALsizei numsamples)
|
||||
{
|
||||
const __m128i increment4 = _mm_set1_epi32(increment*4);
|
||||
const __m128i fracMask4 = _mm_set1_epi32(FRACTIONMASK);
|
||||
union { alignas(16) ALint i[4]; float f[4]; } pos_;
|
||||
union { alignas(16) ALuint i[4]; float f[4]; } frac_;
|
||||
union { alignas(16) ALsizei i[4]; float f[4]; } frac_;
|
||||
__m128i frac4, pos4;
|
||||
ALint pos;
|
||||
ALsizei i;
|
||||
|
@ -29,14 +29,14 @@
|
||||
|
||||
|
||||
const ALfloat *Resample_lerp32_SSE41(const InterpState* UNUSED(state),
|
||||
const ALfloat *restrict src, ALuint frac, ALint increment,
|
||||
const ALfloat *restrict src, ALsizei frac, ALint increment,
|
||||
ALfloat *restrict dst, ALsizei numsamples)
|
||||
{
|
||||
const __m128i increment4 = _mm_set1_epi32(increment*4);
|
||||
const __m128 fracOne4 = _mm_set1_ps(1.0f/FRACTIONONE);
|
||||
const __m128i fracMask4 = _mm_set1_epi32(FRACTIONMASK);
|
||||
union { alignas(16) ALint i[4]; float f[4]; } pos_;
|
||||
union { alignas(16) ALuint i[4]; float f[4]; } frac_;
|
||||
union { alignas(16) ALsizei i[4]; float f[4]; } frac_;
|
||||
__m128i frac4, pos4;
|
||||
ALint pos;
|
||||
ALsizei i;
|
||||
@ -86,13 +86,13 @@ const ALfloat *Resample_lerp32_SSE41(const InterpState* UNUSED(state),
|
||||
}
|
||||
|
||||
const ALfloat *Resample_fir4_32_SSE41(const InterpState* UNUSED(state),
|
||||
const ALfloat *restrict src, ALuint frac, ALint increment,
|
||||
const ALfloat *restrict src, ALsizei frac, ALint increment,
|
||||
ALfloat *restrict dst, ALsizei numsamples)
|
||||
{
|
||||
const __m128i increment4 = _mm_set1_epi32(increment*4);
|
||||
const __m128i fracMask4 = _mm_set1_epi32(FRACTIONMASK);
|
||||
union { alignas(16) ALint i[4]; float f[4]; } pos_;
|
||||
union { alignas(16) ALuint i[4]; float f[4]; } frac_;
|
||||
union { alignas(16) ALsizei i[4]; float f[4]; } frac_;
|
||||
__m128i frac4, pos4;
|
||||
ALint pos;
|
||||
ALsizei i;
|
||||
|
@ -173,7 +173,7 @@ typedef struct ALvoice {
|
||||
* sample.
|
||||
*/
|
||||
ATOMIC(ALuint) position;
|
||||
ATOMIC(ALuint) position_fraction;
|
||||
ATOMIC(ALsizei) position_fraction;
|
||||
|
||||
/**
|
||||
* Number of channels and bytes-per-sample for the attached source's
|
||||
@ -211,7 +211,7 @@ typedef struct ALvoice {
|
||||
|
||||
|
||||
typedef const ALfloat* (*ResamplerFunc)(const InterpState *state,
|
||||
const ALfloat *restrict src, ALuint frac, ALint increment,
|
||||
const ALfloat *restrict src, ALsizei frac, ALint increment,
|
||||
ALfloat *restrict dst, ALsizei dstlen
|
||||
);
|
||||
|
||||
|
@ -53,7 +53,7 @@ static void UpdateSourceProps(ALsource *source, ALsizei num_sends);
|
||||
static ALint64 GetSourceSampleOffset(ALsource *Source, ALCcontext *context, ALuint64 *clocktime);
|
||||
static ALdouble GetSourceSecOffset(ALsource *Source, ALCcontext *context, ALuint64 *clocktime);
|
||||
static ALdouble GetSourceOffset(ALsource *Source, ALenum name, ALCcontext *context);
|
||||
static ALboolean GetSampleOffset(ALsource *Source, ALuint *offset, ALuint *frac);
|
||||
static ALboolean GetSampleOffset(ALsource *Source, ALuint *offset, ALsizei *frac);
|
||||
static ALboolean ApplyOffset(ALsource *Source, ALvoice *voice);
|
||||
|
||||
typedef enum SourceProp {
|
||||
@ -3158,7 +3158,7 @@ static ALint64 GetSourceSampleOffset(ALsource *Source, ALCcontext *context, ALui
|
||||
Current = ATOMIC_LOAD(&voice->current_buffer, almemory_order_relaxed);
|
||||
|
||||
readPos = (ALuint64)ATOMIC_LOAD(&voice->position, almemory_order_relaxed) << 32;
|
||||
readPos |= ATOMIC_LOAD(&voice->position_fraction, almemory_order_relaxed) <<
|
||||
readPos |= (ALuint64)ATOMIC_LOAD(&voice->position_fraction, almemory_order_relaxed) <<
|
||||
(32-FRACTIONBITS);
|
||||
}
|
||||
ATOMIC_THREAD_FENCE(almemory_order_acquire);
|
||||
@ -3258,7 +3258,8 @@ static ALdouble GetSourceOffset(ALsource *Source, ALenum name, ALCcontext *conte
|
||||
const ALbufferlistitem *Current;
|
||||
const ALbuffer *Buffer = NULL;
|
||||
ALboolean readFin = AL_FALSE;
|
||||
ALuint readPos, readPosFrac;
|
||||
ALuint readPos;
|
||||
ALsizei readPosFrac;
|
||||
ALuint totalBufferLen;
|
||||
ALboolean looping;
|
||||
ALuint refcount;
|
||||
@ -3367,7 +3368,8 @@ static ALboolean ApplyOffset(ALsource *Source, ALvoice *voice)
|
||||
ALbufferlistitem *BufferList;
|
||||
const ALbuffer *Buffer;
|
||||
ALuint bufferLen, totalBufferLen;
|
||||
ALuint offset=0, frac=0;
|
||||
ALuint offset = 0;
|
||||
ALsizei frac = 0;
|
||||
|
||||
/* Get sample frame offset */
|
||||
if(!GetSampleOffset(Source, &offset, &frac))
|
||||
@ -3405,7 +3407,7 @@ static ALboolean ApplyOffset(ALsource *Source, ALvoice *voice)
|
||||
* or Second offset supplied by the application). This takes into account the
|
||||
* fact that the buffer format may have been modifed since.
|
||||
*/
|
||||
static ALboolean GetSampleOffset(ALsource *Source, ALuint *offset, ALuint *frac)
|
||||
static ALboolean GetSampleOffset(ALsource *Source, ALuint *offset, ALsizei *frac)
|
||||
{
|
||||
const ALbuffer *Buffer = NULL;
|
||||
const ALbufferlistitem *BufferList;
|
||||
@ -3454,13 +3456,13 @@ static ALboolean GetSampleOffset(ALsource *Source, ALuint *offset, ALuint *frac)
|
||||
case AL_SAMPLE_OFFSET:
|
||||
dblfrac = modf(Source->Offset, &dbloff);
|
||||
*offset = (ALuint)mind(dbloff, UINT_MAX);
|
||||
*frac = (ALuint)mind(dblfrac*FRACTIONONE, FRACTIONONE-1.0);
|
||||
*frac = (ALsizei)mind(dblfrac*FRACTIONONE, FRACTIONONE-1.0);
|
||||
break;
|
||||
|
||||
case AL_SEC_OFFSET:
|
||||
dblfrac = modf(Source->Offset*Buffer->Frequency, &dbloff);
|
||||
*offset = (ALuint)mind(dbloff, UINT_MAX);
|
||||
*frac = (ALuint)mind(dblfrac*FRACTIONONE, FRACTIONONE-1.0);
|
||||
*frac = (ALsizei)mind(dblfrac*FRACTIONONE, FRACTIONONE-1.0);
|
||||
break;
|
||||
}
|
||||
Source->OffsetType = AL_NONE;
|
||||
|
Loading…
Reference in New Issue
Block a user