diff options
author | Chris Robinson <[email protected]> | 2016-05-09 16:34:54 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2016-05-09 17:01:18 -0700 |
commit | 7dac02148bca67ceae56e880f5f2a490faff1a38 (patch) | |
tree | 2aee2e5dd997125cf56b6e3105807f198caf30dc /OpenAL32/alSource.c | |
parent | 182c0cb61abaff36554653d6a94c8a66fc263411 (diff) |
Use the source's offset type to determine if there's an offset
Diffstat (limited to 'OpenAL32/alSource.c')
-rw-r--r-- | OpenAL32/alSource.c | 17 |
1 files changed, 11 insertions, 6 deletions
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; } |