[Visualization] Resample more audio if present

If upsampling the audio by a significant factor, it may be necessary to
process more than one buffer at a time, rather than lose input.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
lastfm
Christopher Snowhill 2022-06-26 01:09:55 -07:00
parent aa3673ed33
commit 378f710cee
1 changed files with 12 additions and 7 deletions

View File

@ -177,14 +177,19 @@ static OSStatus eqRenderCallback(void *inRefCon, AudioUnitRenderActionFlags *ioA
[currentPtsLock unlock];
}
if(r8bvis) {
size_t inDone = 0;
int samplesProcessed;
size_t totalDone = 0;
size_t inDone = 0;
{
[currentPtsLock lock];
samplesProcessed = (int)r8bstate_resample(r8bvis, &visAudio[0], frameCount, &inDone, &visTemp[0], 8192);
samplesProcessed = (int)r8bstate_resample(r8bvis, &visAudio[totalDone], frameCount, &inDone, &visTemp[0], 8192);
[currentPtsLock unlock];
if(samplesProcessed) {
[visController postVisPCM:&visTemp[0] amount:samplesProcessed];
}
totalDone += inDone;
frameCount -= inDone;
} while(samplesProcessed && frameCount);
}
} else if(r8bvis) {
for(;;) {