Updated vorbis decoder to make it better.

CQTexperiment
vspader 2007-03-03 23:05:15 +00:00
parent c810d2f492
commit 1e5c5f54e3
1 changed files with 15 additions and 10 deletions

View File

@ -80,6 +80,7 @@ long sourceTell(void *datasource)
- (int)fillBuffer:(void *)buf ofSize:(UInt32)size
{
int numread;
int total = 0;
if (currentSection != lastSection) {
vorbis_info *vi;
@ -93,18 +94,22 @@ long sourceTell(void *datasource)
NSLog(@"Format changed...");
[self willChangeValueForKey:@"properties"];
[self didChangeValueForKey:@"properties"];
NSLog(@"Done with format change...");
}
lastSection = currentSection;
do {
numread = ov_read(&vorbisRef, (char *)buf, size, 0, bitsPerSample/8, 1, &currentSection);
if (numread < 0) {
NSLog(@"SOME KINDA ERROR!");
}
} while (numread < 0);
return numread;
do {
lastSection = currentSection;
numread = ov_read(&vorbisRef, &((char *)buf)[total], size - total, 0, bitsPerSample/8, 1, &currentSection);
if (numread > 0) {
total += numread;
}
if (currentSection != lastSection) {
break;
}
} while (total != size && numread != 0);
return total;
}
- (void)close