Store the source state locally after making sure it needs mixing

This commit is contained in:
Chris Robinson 2009-12-09 11:56:53 -08:00
parent bd696a6b37
commit 368ef1cea9

View File

@ -904,8 +904,7 @@ static void MixSomeSources(ALCcontext *ALContext, float (*DryBuffer)[OUTPUTCHANN
rampLength = max(rampLength, SamplesToDo);
another_source:
State = ALSource->state;
if(State != AL_PLAYING)
if(ALSource->state != AL_PLAYING)
{
if((ALSource=ALSource->next) != NULL)
goto another_source;
@ -931,11 +930,6 @@ another_source:
BufferListItem = BufferListItem->next;
}
/* Get source info */
BuffersPlayed = ALSource->BuffersPlayed;
DataPosInt = ALSource->position;
DataPosFrac = ALSource->position_fraction;
if(ALSource->NeedsUpdate)
{
//Only apply 3D calculations for mono buffers
@ -946,6 +940,12 @@ another_source:
ALSource->NeedsUpdate = AL_FALSE;
}
/* Get source info */
State = ALSource->state;
BuffersPlayed = ALSource->BuffersPlayed;
DataPosInt = ALSource->position;
DataPosFrac = ALSource->position_fraction;
/* Compute 18.14 fixed point step */
Pitch = (ALSource->Params.Pitch*Frequency) / DeviceFreq;
if(Pitch > (float)MAX_PITCH) Pitch = (float)MAX_PITCH;