Position measurement

Started by grv575,

grv575

Is this an nBass problem?  I'm trying to get the current byte position of playback but stream.Position gives me something like bytes * 7.3.  I notice that BASS_ChannelGetPosition returns a QWORD.  Some casting problem with the library?  Can someone verify that bass returns byte measurements when reading the channel position from a playing file.

grv575

OK, I do realize what a brilliant post the previous was  :D
It's obviously PCM data that the stream position is showing.  So is there a way to get the mp3 file position of the currently heard sound?

Ian @ un4seen

Do you mean the position in time (eg. seconds)? If so, you can pass the byte position to BASS_ChannelBytes2Seconds.

grv575

I'm trying to use the library to cut an mp3 at a certain spot.  Right now I've just estimated it as the position in stream / length of stream * mp3 filesize.  Just wondering if there was something more accurate.

Ian @ un4seen

BASS_StreamGetFilePosition(BASS_FILEPOS_DECODE) will give you the current file offset, but that does not include ID3v2 tags (or any rubbish at the head of the file). So if you use this function to chop up a file, you'll have to find the offset of the first frame, and add that.