aboutsummaryrefslogtreecommitdiffstats
path: root/OpenAL32/alSource.c
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2017-03-06 22:58:04 -0800
committerChris Robinson <[email protected]>2017-03-07 00:19:40 -0800
commit190120dfd7ae53e284944fa4971efcf999cc321e (patch)
treec081ca66b3680270c31a667eaa29c1eef3cb4c0b /OpenAL32/alSource.c
parentbc0096365e66b8114a54bb533e818deb794c7601 (diff)
Store the channel count and sample size in the voice
Diffstat (limited to 'OpenAL32/alSource.c')
-rw-r--r--OpenAL32/alSource.c15
1 files changed, 4 insertions, 11 deletions
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));