Topic: Track does not change from time to time

This applies to newly invented CUE and APL file support: sometimes track does not change and underlying file continues to play beyond track (to next track in image...).
Noticed corellation: when track is played trough chances for bug are higher, when same track is scrolled to near end it changes properly.

Proposal: do you use floating point addition and comparison by '=='?
Try this little demonstration:

#include <iostream>
int main (int argc, char * const argv[]) {
    float a = 0.0;
    for (int i = 0; i < 1000000; i++) a += 0.000001;
    if (a == 1.0) std::cout << "you're very lucky\n";
    else std::cout << "la-la-la! 1 !=" << a << "\n";
        
    std::cout << "You think doubles are solution?\n";
    double d = 0.0;
    for (int i = 0; i < 1000000; i++) d += 0.000001;
    if (d == 1.0) std::cout << "you're very lucky\n";
    else std::cout << "la-la-la! 1 !=" << d << "\n";
    return 0;
}

it outputs things like this:

[Session started at 2007-10-19 01:27:57 +0400.]
la-la-la! 1 !=1.00904
You think doubles are solution?
la-la-la! 1 !=1

test has exited with status 0.

Re: Track does not change from time to time

I doubt the problem is caused by comparing floating points.

Is this a problem with the APL code by you? Or the normal cue sheet (.cue) plugin?

Re: Track does not change from time to time

Re: Track does not change from time to time

I think here the problem is:

- (int)fillBuffer:(void *)buf ofSize:(UInt32)size
{
    long trackByteEnd = trackEnd * bytesPerSecond;    
    trackByteEnd -= trackByteEnd % (bytesPerFrame);
    
    if (bytePosition + size > trackByteEnd) {
        size = trackByteEnd - bytePosition;
    }

    if (!size) {
        return 0;
    }

    int n = [decoder fillBuffer:buf ofSize:size];
    
    bytePosition += n;
    
    return n;
}

bytesPerSecond is set once during file opening, but bitrate may vary in compressed files... (and on APEs with classical music bug seen more often)

Re: Track does not change from time to time

Re: Track does not change from time to time

bytesPerSecond is the number of audio bytes per second, not the number in the source file. How long are these files?

Re: Track does not change from time to time

10-19 02:17:48.510 Cog[20426] DEALLOCATING SOURCE
2007-10-19 02:17:48.510 Cog[20426] DEALLOCATING SOURCE
2007-10-19 02:17:48.510 Cog[20426] DEALLOCATING SOURCE
2007-10-19 02:17:48.511 Cog[20426] DEALLOCATING SOURCE
2007-10-19 02:17:48.511 Cog[20426] DEALLOCATING SOURCE
2007-10-19 02:17:51.161 Cog[20426] Opening: file://localhost/Volumes/WEST%3BSERVER/Music/classical%20crossover/Hayley%20Westenra/Hayley%20Westenra%20-%20Treasure%20(2007)/Hayley.Westenra.-.%5BTreasure%5D.cue#06
2007-10-19 02:17:51.161 Cog[20426] SETTING OUTPUT FORMAT!
2007-10-19 02:17:51.161 Cog[20426] REGISTERING OBSERVERS
2007-10-19 02:17:51.163 Cog[20426] GENRE!
2007-10-19 02:17:51.163 Cog[20426] UNQUOTED
2007-10-19 02:17:51.163 Cog[20426] DATE!
2007-10-19 02:17:51.173 Cog[20426] SOMETHING CHANGED!
2007-10-19 02:17:51.173 Cog[20426] FORMAT DID CHANGE!
2007-10-19 02:17:51.173 Cog[20426] FORMAT CHANGED
2007-10-19 02:17:51.173 Cog[20426] Properties: {
    bitsPerSample = 16; 
    channels = 2; 
    endian = big; 
    length = 238413.2690429688; 
    sampleRate = 44100; 
    seekable = 1; 
}
2007-10-19 02:17:51.176 Cog[20426] DEALLOCATING SOURCE
2007-10-19 02:17:51.579 Cog[20426] INITIAL BUFFER FILLED
2007-10-19 02:17:52.076 Cog[20426] INITIAL BUFFER FILLED
<whole track passed>
<here bug happened>

Re: Track does not change from time to time

Ok, this bug should be fixed as of r589.

Re: Track does not change from time to time

yes, seems to be fixed