aboutsummaryrefslogtreecommitdiffstats
path: root/OpenAL32
diff options
context:
space:
mode:
Diffstat (limited to 'OpenAL32')
-rw-r--r--OpenAL32/Include/alSource.h11
-rw-r--r--OpenAL32/alSource.c15
2 files changed, 11 insertions, 15 deletions
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));