aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2016-05-09 16:34:54 -0700
committerChris Robinson <[email protected]>2016-05-09 17:01:18 -0700
commit7dac02148bca67ceae56e880f5f2a490faff1a38 (patch)
tree2aee2e5dd997125cf56b6e3105807f198caf30dc
parent182c0cb61abaff36554653d6a94c8a66fc263411 (diff)
Use the source's offset type to determine if there's an offset
-rw-r--r--Alc/ALc.c2
-rw-r--r--OpenAL32/alSource.c17
2 files changed, 12 insertions, 7 deletions
diff --git a/Alc/ALc.c b/Alc/ALc.c
index f8eda9a5..b8dae07c 100644
--- a/Alc/ALc.c
+++ b/Alc/ALc.c
@@ -1604,7 +1604,7 @@ void ALCcontext_ProcessUpdates(ALCcontext *context)
ALenum new_state;
if((Source->state == AL_PLAYING || Source->state == AL_PAUSED) &&
- Source->Offset >= 0.0)
+ Source->OffsetType != AL_NONE)
{
WriteLock(&Source->queue_lock);
ApplyOffset(Source);
diff --git a/OpenAL32/alSource.c b/OpenAL32/alSource.c
index b4da90cd..749f2ec4 100644
--- a/OpenAL32/alSource.c
+++ b/OpenAL32/alSource.c
@@ -2544,7 +2544,8 @@ static ALvoid InitSourceParams(ALsource *Source)
Source->state = AL_INITIAL;
Source->new_state = AL_NONE;
Source->SourceType = AL_UNDETERMINED;
- Source->Offset = -1.0;
+ Source->OffsetType = AL_NONE;
+ Source->Offset = 0.0;
ATOMIC_INIT(&Source->queue, NULL);
ATOMIC_INIT(&Source->current_buffer, NULL);
@@ -2608,7 +2609,7 @@ ALvoid SetSourceState(ALsource *Source, ALCcontext *Context, ALenum state)
}
// Check if an Offset has been set
- if(Source->Offset >= 0.0)
+ if(Source->OffsetType != AL_NONE)
{
ApplyOffset(Source);
/* discontinuity = AL_TRUE;??? */
@@ -2680,7 +2681,8 @@ ALvoid SetSourceState(ALsource *Source, ALCcontext *Context, ALenum state)
Source->state = AL_STOPPED;
ATOMIC_STORE(&Source->current_buffer, NULL);
}
- Source->Offset = -1.0;
+ Source->OffsetType = AL_NONE;
+ Source->Offset = 0.0;
}
else if(state == AL_INITIAL)
{
@@ -2691,7 +2693,8 @@ ALvoid SetSourceState(ALsource *Source, ALCcontext *Context, ALenum state)
Source->position_fraction = 0;
ATOMIC_STORE(&Source->current_buffer, ATOMIC_LOAD(&Source->queue));
}
- Source->Offset = -1.0;
+ Source->OffsetType = AL_NONE;
+ Source->Offset = 0.0;
}
WriteUnlock(&Source->queue_lock);
}
@@ -2942,7 +2945,8 @@ static ALboolean GetSampleOffset(ALsource *Source, ALuint *offset, ALuint *frac)
}
if(!Buffer)
{
- Source->Offset = -1.0;
+ Source->OffsetType = AL_NONE;
+ Source->Offset = 0.0;
return AL_FALSE;
}
@@ -2980,7 +2984,8 @@ static ALboolean GetSampleOffset(ALsource *Source, ALuint *offset, ALuint *frac)
*frac = (ALuint)mind(dblfrac*FRACTIONONE, FRACTIONONE-1.0);
break;
}
- Source->Offset = -1.0;
+ Source->OffsetType = AL_NONE;
+ Source->Offset = 0.0;
return AL_TRUE;
}