Remove a couple redundant local variables
This commit is contained in:
parent
30a7c6d86f
commit
24b43fe852
@ -396,45 +396,42 @@ ALsizei LoadBufferQueue(ALbufferlistitem *BufferListItem, ALbufferlistitem *Buff
|
|||||||
const ALsizei SrcBufferSize)
|
const ALsizei SrcBufferSize)
|
||||||
{
|
{
|
||||||
/* Crawl the buffer queue to fill in the temp buffer */
|
/* Crawl the buffer queue to fill in the temp buffer */
|
||||||
ALbufferlistitem *tmpiter{BufferListItem};
|
while(BufferListItem && SrcBufferSize > FilledAmt)
|
||||||
ALsizei pos{DataPosInt};
|
|
||||||
|
|
||||||
while(tmpiter && SrcBufferSize > FilledAmt)
|
|
||||||
{
|
{
|
||||||
if(pos >= tmpiter->max_samples)
|
if(DataPosInt >= BufferListItem->max_samples)
|
||||||
{
|
{
|
||||||
pos -= tmpiter->max_samples;
|
DataPosInt -= BufferListItem->max_samples;
|
||||||
tmpiter = tmpiter->next.load(std::memory_order_acquire);
|
BufferListItem = BufferListItem->next.load(std::memory_order_acquire);
|
||||||
if(!tmpiter) tmpiter = BufferLoopItem;
|
if(!BufferListItem) BufferListItem = BufferLoopItem;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
const ALsizei SizeToDo{SrcBufferSize - FilledAmt};
|
const ALsizei SizeToDo{SrcBufferSize - FilledAmt};
|
||||||
auto load_buffer = [pos,&SrcData,NumChannels,SampleSize,chan,FilledAmt,SizeToDo](ALsizei CompLen, const ALbuffer *buffer) -> ALsizei
|
auto load_buffer = [DataPosInt,&SrcData,NumChannels,SampleSize,chan,FilledAmt,SizeToDo](ALsizei CompLen, const ALbuffer *buffer) -> ALsizei
|
||||||
{
|
{
|
||||||
if(!buffer) return CompLen;
|
if(!buffer) return CompLen;
|
||||||
ALsizei DataSize{buffer->SampleLen};
|
ALsizei DataSize{buffer->SampleLen};
|
||||||
if(pos >= DataSize) return CompLen;
|
if(DataPosInt >= DataSize) return CompLen;
|
||||||
|
|
||||||
DataSize = mini(SizeToDo, DataSize - pos);
|
DataSize = mini(SizeToDo, DataSize - DataPosInt);
|
||||||
CompLen = maxi(CompLen, DataSize);
|
CompLen = maxi(CompLen, DataSize);
|
||||||
|
|
||||||
const ALbyte *Data{buffer->mData.data()};
|
const ALbyte *Data{buffer->mData.data()};
|
||||||
Data += (pos*NumChannels + chan)*SampleSize;
|
Data += (DataPosInt*NumChannels + chan)*SampleSize;
|
||||||
|
|
||||||
LoadSamples(&SrcData[FilledAmt], Data, NumChannels,
|
LoadSamples(&SrcData[FilledAmt], Data, NumChannels,
|
||||||
buffer->mFmtType, DataSize);
|
buffer->mFmtType, DataSize);
|
||||||
return CompLen;
|
return CompLen;
|
||||||
};
|
};
|
||||||
auto buffers_end = tmpiter->buffers + tmpiter->num_buffers;
|
auto buffers_end = BufferListItem->buffers + BufferListItem->num_buffers;
|
||||||
FilledAmt += std::accumulate(tmpiter->buffers, buffers_end, ALsizei{0},
|
FilledAmt += std::accumulate(BufferListItem->buffers, buffers_end, ALsizei{0},
|
||||||
load_buffer);
|
load_buffer);
|
||||||
|
|
||||||
if(SrcBufferSize <= FilledAmt)
|
if(SrcBufferSize <= FilledAmt)
|
||||||
break;
|
break;
|
||||||
pos = 0;
|
DataPosInt = 0;
|
||||||
tmpiter = tmpiter->next.load(std::memory_order_acquire);
|
BufferListItem = BufferListItem->next.load(std::memory_order_acquire);
|
||||||
if(!tmpiter) tmpiter = BufferLoopItem;
|
if(!BufferListItem) BufferListItem = BufferLoopItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
return FilledAmt;
|
return FilledAmt;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user