[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>swiftingly
parent
5f52a4be81
commit
050aaaf852
|
@ -177,14 +177,19 @@ static OSStatus eqRenderCallback(void *inRefCon, AudioUnitRenderActionFlags *ioA
|
||||||
[currentPtsLock unlock];
|
[currentPtsLock unlock];
|
||||||
}
|
}
|
||||||
if(r8bvis) {
|
if(r8bvis) {
|
||||||
size_t inDone = 0;
|
|
||||||
int samplesProcessed;
|
int samplesProcessed;
|
||||||
[currentPtsLock lock];
|
size_t totalDone = 0;
|
||||||
samplesProcessed = (int)r8bstate_resample(r8bvis, &visAudio[0], frameCount, &inDone, &visTemp[0], 8192);
|
size_t inDone = 0;
|
||||||
[currentPtsLock unlock];
|
{
|
||||||
if(samplesProcessed) {
|
[currentPtsLock lock];
|
||||||
[visController postVisPCM:&visTemp[0] amount:samplesProcessed];
|
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) {
|
} else if(r8bvis) {
|
||||||
for(;;) {
|
for(;;) {
|
||||||
|
|
Loading…
Reference in New Issue