diff options
-rw-r--r-- | Alc/mixer.c | 4 | ||||
-rw-r--r-- | OpenAL32/Include/alSource.h | 11 | ||||
-rw-r--r-- | OpenAL32/alSource.c | 15 |
3 files changed, 13 insertions, 17 deletions
diff --git a/Alc/mixer.c b/Alc/mixer.c index 393d9210..1c503a92 100644 --- a/Alc/mixer.c +++ b/Alc/mixer.c @@ -389,8 +389,8 @@ ALboolean MixSource(ALvoice *voice, ALsource *Source, ALCdevice *Device, ALsizei DataPosFrac = ATOMIC_LOAD(&voice->position_fraction, almemory_order_relaxed); BufferListItem = ATOMIC_LOAD(&voice->current_buffer, almemory_order_relaxed); Looping = ATOMIC_LOAD(&Source->looping, almemory_order_relaxed); - NumChannels = Source->NumChannels; - SampleSize = Source->SampleSize; + NumChannels = voice->NumChannels; + SampleSize = voice->SampleSize; increment = voice->Step; IrSize = (Device->Hrtf.Handle ? Device->Hrtf.Handle->irSize : 0); diff --git a/OpenAL32/Include/alSource.h b/OpenAL32/Include/alSource.h index c33d6d1a..2525f107 100644 --- a/OpenAL32/Include/alSource.h +++ b/OpenAL32/Include/alSource.h @@ -94,6 +94,13 @@ typedef struct ALvoice { ATOMIC(ALuint) position; ATOMIC(ALuint) position_fraction; + /** + * Number of channels and bytes-per-sample for the attached source's + * buffer(s). + */ + ALsizei NumChannels; + ALsizei SampleSize; + /** Current target parameters used for mixing. */ ALint Step; @@ -197,10 +204,6 @@ typedef struct ALsource { ATOMIC(ALboolean) looping; - /** Current buffer sample info. */ - ALsizei NumChannels; - ALsizei SampleSize; - ALenum NeedsUpdate; ATOMIC(struct ALsourceProps*) Update; diff --git a/OpenAL32/alSource.c b/OpenAL32/alSource.c index 024d7918..ca4f3811 100644 --- a/OpenAL32/alSource.c +++ b/OpenAL32/alSource.c @@ -719,11 +719,6 @@ static ALboolean SetSourceiv(ALsource *Source, ALCcontext *Context, SourceProp p /* Source is now Static */ Source->SourceType = AL_STATIC; - - ReadLock(&buffer->lock); - Source->NumChannels = ChannelsFromFmt(buffer->FmtChannels); - Source->SampleSize = BytesFromFmt(buffer->FmtType); - ReadUnlock(&buffer->lock); } else { @@ -2582,12 +2577,7 @@ AL_API ALvoid AL_APIENTRY alSourceQueueBuffers(ALuint src, ALsizei nb, const ALu IncrementRef(&buffer->ref); if(BufferFmt == NULL) - { BufferFmt = buffer; - - source->NumChannels = ChannelsFromFmt(buffer->FmtChannels); - source->SampleSize = BytesFromFmt(buffer->FmtType); - } else if(BufferFmt->Frequency != buffer->Frequency || BufferFmt->OriginalChannels != buffer->OriginalChannels || BufferFmt->OriginalType != buffer->OriginalType) @@ -2990,6 +2980,7 @@ ALvoid SetSourceState(ALsource *Source, ALCcontext *Context, ALenum state) { ALCdevice *device = Context->Device; ALbufferlistitem *BufferList; + ALbuffer *buffer = NULL; ALsizei i; /* Check that there is a queue containing at least one valid, non zero @@ -2997,7 +2988,6 @@ ALvoid SetSourceState(ALsource *Source, ALCcontext *Context, ALenum state) BufferList = ATOMIC_LOAD_SEQ(&Source->queue); while(BufferList) { - ALbuffer *buffer; if((buffer=BufferList->buffer) != NULL && buffer->SampleLen > 0) break; BufferList = BufferList->next; @@ -3064,6 +3054,9 @@ ALvoid SetSourceState(ALsource *Source, ALCcontext *Context, ALenum state) if(Source->OffsetType != AL_NONE) ApplyOffset(Source, voice); + voice->NumChannels = ChannelsFromFmt(buffer->FmtChannels); + voice->SampleSize = BytesFromFmt(buffer->FmtType); + /* Clear previous samples. */ memset(voice->PrevSamples, 0, sizeof(voice->PrevSamples)); |