Bug fix for flac files.

CQTexperiment
vspader 2007-11-04 03:08:41 +00:00
parent 60405d6431
commit 678d406879
4 changed files with 23 additions and 1 deletions

View File

@ -97,6 +97,9 @@ static OSStatus ACInputProc(AudioConverterRef inAudioConverter, UInt32* ioNumber
NSLog(@"INSIZE: %i", amountRead);
amountRead += [self convert:dest + amountRead amount:amount - amountRead];
}
else if (err != noErr && err != 100) {
NSLog(@"Error: %i", err);
}
return amountRead;
}

View File

@ -337,10 +337,12 @@
0867D690FE84028FC02AAC07 /* Project object */ = {
isa = PBXProject;
buildConfigurationList = 1DEB91B108733DA50010E9CD /* Build configuration list for PBXProject "CogAudio" */;
compatibilityVersion = "Xcode 2.4";
hasScannedForEncodings = 1;
mainGroup = 0867D691FE84028FC02AAC07 /* CogAudio */;
productRefGroup = 034768DFFF38A50411DB9C8B /* Products */;
projectDirPath = "";
projectRoot = "";
targets = (
8DC2EF4F0486A6940098B216 /* CogAudio Framework */,
);

View File

@ -183,6 +183,7 @@
089C1669FE841209C02AAC07 /* Project object */ = {
isa = PBXProject;
buildConfigurationList = 1DEB913E08733D840010E9CD /* Build configuration list for PBXProject "Flac" */;
compatibilityVersion = "Xcode 2.4";
hasScannedForEncodings = 1;
mainGroup = 089C166AFE841209C02AAC07 /* Flac */;
projectDirPath = "";
@ -192,6 +193,7 @@
ProjectRef = 17F5641A0C3BDC460019975C /* flac.xcodeproj */;
},
);
projectRoot = "";
targets = (
8D5B49AC048680CD000E48DA /* Flac Plugin */,
);

View File

@ -90,6 +90,8 @@ FLAC__StreamDecoderWriteStatus WriteCallback(const FLAC__StreamDecoder *decoder,
int sample, channel;
int32_t audioSample;
NSLog(@"Bits per sample: %i", frame->header.bits_per_sample);
switch(frame->header.bits_per_sample) {
case 8:
// Interleave the audio (no need for byte swapping)
@ -198,6 +200,11 @@ void ErrorCallback(const FLAC__StreamDecoder *decoder, FLAC__StreamDecoderErrorS
int count;
int numread;
size -= size % ((bitsPerSample/8) * channels);
NSLog(@"Requesting: %i", size);
NSLog(@"Overflow? %i", size % ((bitsPerSample/8) * channels));
if (bufferAmount == 0)
{
if (FLAC__stream_decoder_get_state (decoder) == FLAC__STREAM_DECODER_END_OF_STREAM)
@ -221,9 +228,17 @@ void ErrorCallback(const FLAC__StreamDecoder *decoder, FLAC__StreamDecoderErrorS
memmove((char *)buffer, &((char *)buffer)[count], bufferAmount);
if (count < size)
numread = [self fillBuffer:(&((char *)buf)[count]) ofSize:(size - count)];
{
NSLog(@"Recursing: %i/%i", count, size);
numread = [self fillBuffer:(((char *)buf) + count) ofSize:(size - count)];
}
else
{
numread = 0;
}
NSLog(@"Done: %i/%i", count + numread, size);
return count + numread;