double CAAudioFileReader::GetCurrentPosition() const { return double(GetCurrentFrame()) / double(GetNumberFrames()); #if 0 double nFrames = double(GetNumberFrames()); // +1 to account for leftovers from decoder if (!mRunning) return double(GetCurrentFrame()) / nFrames; if (mEndOfStream) { //printf("EOF\n"); return 1.0; } const FileReadBuffer *b = static_cast<const FileReadBuffer *>(GetCurrentBuffer()); // the buffer from which we're reading UInt32 startFrame, endFrame; b->GetLocation(startFrame, endFrame); //printf("%qd + %ld / %.f\n", b->mBufferStartFileFrame, startFrame, nFrames); return double(b->mBufferStartFileFrame + startFrame) / nFrames; //if (endFrame > 0) { //double frac = (double(startFrame) / double(endFrame)) * double(endPacket - startPacket); //packetIndex += frac; //printf("frames %ld-%ld, packets %qd-%qd, frac %.3f\n", // startFrame, endFrame, startPacket, endPacket, frac); //} //double pos = packetIndex / nPacketsPlus1; //printf("%.3f / %.0f = %.3f\n", packetIndex, nPacketsPlus1, pos); //return pos; //return double(GetCurrentFrame()) / nFrames; #endif }
SInt64 ZKMORFileReader::GetCurrentFrame() const { // if (!mRunning) return mFile->Tell(); if (mEndOfStream) return GetNumberFrames(); const FileReadBuffer *b = static_cast<const FileReadBuffer *>(GetCurrentBuffer()); // the buffer from which we're reading UInt32 startFrame, endFrame; b->GetLocation(startFrame, endFrame); return b->mBufferStartFileFrame + startFrame; }
SInt64 CAAudioFileReader::GetCurrentFrame() const { if (!mRunning) return mFile->Tell(); if (mEndOfStream) return GetNumberFrames(); const FileReadBuffer *b = static_cast<const FileReadBuffer *>(GetCurrentBuffer()); // the buffer from which we're reading UInt32 startFrame, endFrame; b->GetLocation(startFrame, endFrame); //printf("%qd + %ld / %.f\n", b->mBufferStartFileFrame, startFrame, nFrames); return b->mBufferStartFileFrame + startFrame; }
double ZKMORFileReader::GetCurrentPosition() const { return (GetCurrentFrame() < 0) ? 0. : double(GetCurrentFrame()) / double(GetNumberFrames()); }