Minor changes that may or may not have any impact on gaplessness

CQTexperiment
Chris Moeller 2013-10-18 05:33:38 -07:00
parent b9ce8462c4
commit 8c80981827
3 changed files with 12 additions and 9 deletions

View File

@ -134,9 +134,15 @@
if (amountInBuffer < CHUNK_SIZE) {
int framesToRead = (CHUNK_SIZE - amountInBuffer)/bytesPerFrame;
int framesRead = [decoder readAudio:((char *)inputBuffer) + amountInBuffer frames:framesToRead];
amountInBuffer += (framesRead * bytesPerFrame);
if (framesRead <= 0)
if (framesRead > 0)
{
amountInBuffer += (framesRead * bytesPerFrame);
[self writeData:inputBuffer amount:amountInBuffer];
amountInBuffer = 0;
}
if (framesRead < framesToRead)
{
if (initialBufferFilled == NO) {
[controller initialBufferFilled:self];
@ -163,10 +169,7 @@
break;
}
}
[self writeData:inputBuffer amount:amountInBuffer];
amountInBuffer = 0;
}
}
}
if (shouldClose)

View File

@ -105,7 +105,7 @@
[readLock lock];
availInput = [[previousNode buffer] lengthAvailableToReadReturningPointer:&readPtr];
if (availInput <= amount && [previousNode endOfStream] == YES)
if (availInput < amount && [previousNode endOfStream] == YES)
{
// [previousNode release];
//If it is the outputNode, [soundController newInputChain];

View File

@ -54,6 +54,8 @@
[self setPreviousNode:[[controller bufferChain] finalNode]];
n = [super readData:ptr amount:amount];
amountPlayed += n;
if (endOfStream == YES)
{
amountPlayed = 0;
@ -64,8 +66,6 @@
DLog(@"Output Buffer dry!");
}
*/
amountPlayed += n;
[pool release];
return n;