Fixed cuesheet decoding bug where tracks weren't changing if not played through completely.
This commit is contained in:
parent
16f0c942bc
commit
1889973c74
1 changed files with 9 additions and 2 deletions
|
@ -84,8 +84,6 @@
|
||||||
bytesPerFrame = (bitsPerSample/8) * channels;
|
bytesPerFrame = (bitsPerSample/8) * channels;
|
||||||
bytesPerSecond = (int)(bytesPerFrame * sampleRate);
|
bytesPerSecond = (int)(bytesPerFrame * sampleRate);
|
||||||
|
|
||||||
[decoder seekToTime: [track time] * 1000.0];
|
|
||||||
|
|
||||||
if (nextTrack && [[[nextTrack url] absoluteString] isEqualToString:[[track url] absoluteString]]) {
|
if (nextTrack && [[[nextTrack url] absoluteString] isEqualToString:[[track url] absoluteString]]) {
|
||||||
trackEnd = [nextTrack time];
|
trackEnd = [nextTrack time];
|
||||||
}
|
}
|
||||||
|
@ -93,6 +91,8 @@
|
||||||
trackEnd = [[properties objectForKey:@"length"] doubleValue]/1000.0;
|
trackEnd = [[properties objectForKey:@"length"] doubleValue]/1000.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[self seekToTime: 0.0];
|
||||||
|
|
||||||
//Note: Should register for observations of the decoder, but laziness consumes all.
|
//Note: Should register for observations of the decoder, but laziness consumes all.
|
||||||
[self willChangeValueForKey:@"properties"];
|
[self willChangeValueForKey:@"properties"];
|
||||||
[self didChangeValueForKey:@"properties"];
|
[self didChangeValueForKey:@"properties"];
|
||||||
|
@ -184,16 +184,23 @@
|
||||||
long trackByteEnd = trackEnd * bytesPerSecond;
|
long trackByteEnd = trackEnd * bytesPerSecond;
|
||||||
trackByteEnd -= trackByteEnd % (bytesPerFrame);
|
trackByteEnd -= trackByteEnd % (bytesPerFrame);
|
||||||
|
|
||||||
|
// NSLog(@"Position: %i/%i", bytePosition, trackByteEnd);
|
||||||
|
// NSLog(@"Requested: %i", size);
|
||||||
if (bytePosition + size > trackByteEnd) {
|
if (bytePosition + size > trackByteEnd) {
|
||||||
size = trackByteEnd - bytePosition;
|
size = trackByteEnd - bytePosition;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NSLog(@"Revised size: %i", size);
|
||||||
|
|
||||||
if (!size) {
|
if (!size) {
|
||||||
|
NSLog(@"Returning 0");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int n = [decoder fillBuffer:buf ofSize:size];
|
int n = [decoder fillBuffer:buf ofSize:size];
|
||||||
|
|
||||||
|
// NSLog(@"Received: %i", n);
|
||||||
|
|
||||||
bytePosition += n;
|
bytePosition += n;
|
||||||
|
|
||||||
return n;
|
return n;
|
||||||
|
|
Loading…
Reference in a new issue