aboutsummaryrefslogtreecommitdiffstats
path: root/OpenAL32
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2017-04-08 14:29:08 -0700
committerChris Robinson <[email protected]>2017-04-08 14:29:08 -0700
commitaef774a7a03485a645edc79ea292abe8c634b8e9 (patch)
tree4bc9a436fa578c3801cb6e5bbd42eb829a98da7f /OpenAL32
parent319d0971986309d7882a9be42a5aef7dc612945d (diff)
Handle the source offset fraction as an ALsizei
Diffstat (limited to 'OpenAL32')
-rw-r--r--OpenAL32/Include/alu.h4
-rw-r--r--OpenAL32/alSource.c16
2 files changed, 11 insertions, 9 deletions
diff --git a/OpenAL32/Include/alu.h b/OpenAL32/Include/alu.h
index 7a29915f..4d0ee196 100644
--- a/OpenAL32/Include/alu.h
+++ b/OpenAL32/Include/alu.h
@@ -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
);
diff --git a/OpenAL32/alSource.c b/OpenAL32/alSource.c
index 071ac8d4..a8c4ce2f 100644
--- a/OpenAL32/alSource.c
+++ b/OpenAL32/alSource.c
@@ -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;