Bug fix for flac files.
parent
60405d6431
commit
678d406879
|
@ -97,6 +97,9 @@ static OSStatus ACInputProc(AudioConverterRef inAudioConverter, UInt32* ioNumber
|
||||||
NSLog(@"INSIZE: %i", amountRead);
|
NSLog(@"INSIZE: %i", amountRead);
|
||||||
amountRead += [self convert:dest + amountRead amount:amount - amountRead];
|
amountRead += [self convert:dest + amountRead amount:amount - amountRead];
|
||||||
}
|
}
|
||||||
|
else if (err != noErr && err != 100) {
|
||||||
|
NSLog(@"Error: %i", err);
|
||||||
|
}
|
||||||
|
|
||||||
return amountRead;
|
return amountRead;
|
||||||
}
|
}
|
||||||
|
|
|
@ -337,10 +337,12 @@
|
||||||
0867D690FE84028FC02AAC07 /* Project object */ = {
|
0867D690FE84028FC02AAC07 /* Project object */ = {
|
||||||
isa = PBXProject;
|
isa = PBXProject;
|
||||||
buildConfigurationList = 1DEB91B108733DA50010E9CD /* Build configuration list for PBXProject "CogAudio" */;
|
buildConfigurationList = 1DEB91B108733DA50010E9CD /* Build configuration list for PBXProject "CogAudio" */;
|
||||||
|
compatibilityVersion = "Xcode 2.4";
|
||||||
hasScannedForEncodings = 1;
|
hasScannedForEncodings = 1;
|
||||||
mainGroup = 0867D691FE84028FC02AAC07 /* CogAudio */;
|
mainGroup = 0867D691FE84028FC02AAC07 /* CogAudio */;
|
||||||
productRefGroup = 034768DFFF38A50411DB9C8B /* Products */;
|
productRefGroup = 034768DFFF38A50411DB9C8B /* Products */;
|
||||||
projectDirPath = "";
|
projectDirPath = "";
|
||||||
|
projectRoot = "";
|
||||||
targets = (
|
targets = (
|
||||||
8DC2EF4F0486A6940098B216 /* CogAudio Framework */,
|
8DC2EF4F0486A6940098B216 /* CogAudio Framework */,
|
||||||
);
|
);
|
||||||
|
|
|
@ -183,6 +183,7 @@
|
||||||
089C1669FE841209C02AAC07 /* Project object */ = {
|
089C1669FE841209C02AAC07 /* Project object */ = {
|
||||||
isa = PBXProject;
|
isa = PBXProject;
|
||||||
buildConfigurationList = 1DEB913E08733D840010E9CD /* Build configuration list for PBXProject "Flac" */;
|
buildConfigurationList = 1DEB913E08733D840010E9CD /* Build configuration list for PBXProject "Flac" */;
|
||||||
|
compatibilityVersion = "Xcode 2.4";
|
||||||
hasScannedForEncodings = 1;
|
hasScannedForEncodings = 1;
|
||||||
mainGroup = 089C166AFE841209C02AAC07 /* Flac */;
|
mainGroup = 089C166AFE841209C02AAC07 /* Flac */;
|
||||||
projectDirPath = "";
|
projectDirPath = "";
|
||||||
|
@ -192,6 +193,7 @@
|
||||||
ProjectRef = 17F5641A0C3BDC460019975C /* flac.xcodeproj */;
|
ProjectRef = 17F5641A0C3BDC460019975C /* flac.xcodeproj */;
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
projectRoot = "";
|
||||||
targets = (
|
targets = (
|
||||||
8D5B49AC048680CD000E48DA /* Flac Plugin */,
|
8D5B49AC048680CD000E48DA /* Flac Plugin */,
|
||||||
);
|
);
|
||||||
|
|
|
@ -90,6 +90,8 @@ FLAC__StreamDecoderWriteStatus WriteCallback(const FLAC__StreamDecoder *decoder,
|
||||||
int sample, channel;
|
int sample, channel;
|
||||||
int32_t audioSample;
|
int32_t audioSample;
|
||||||
|
|
||||||
|
NSLog(@"Bits per sample: %i", frame->header.bits_per_sample);
|
||||||
|
|
||||||
switch(frame->header.bits_per_sample) {
|
switch(frame->header.bits_per_sample) {
|
||||||
case 8:
|
case 8:
|
||||||
// Interleave the audio (no need for byte swapping)
|
// Interleave the audio (no need for byte swapping)
|
||||||
|
@ -198,6 +200,11 @@ void ErrorCallback(const FLAC__StreamDecoder *decoder, FLAC__StreamDecoderErrorS
|
||||||
int count;
|
int count;
|
||||||
int numread;
|
int numread;
|
||||||
|
|
||||||
|
size -= size % ((bitsPerSample/8) * channels);
|
||||||
|
|
||||||
|
NSLog(@"Requesting: %i", size);
|
||||||
|
NSLog(@"Overflow? %i", size % ((bitsPerSample/8) * channels));
|
||||||
|
|
||||||
if (bufferAmount == 0)
|
if (bufferAmount == 0)
|
||||||
{
|
{
|
||||||
if (FLAC__stream_decoder_get_state (decoder) == FLAC__STREAM_DECODER_END_OF_STREAM)
|
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);
|
memmove((char *)buffer, &((char *)buffer)[count], bufferAmount);
|
||||||
|
|
||||||
if (count < size)
|
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
|
else
|
||||||
|
{
|
||||||
numread = 0;
|
numread = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
NSLog(@"Done: %i/%i", count + numread, size);
|
||||||
|
|
||||||
return count + numread;
|
return count + numread;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue