how to interpret tell_off, and the right way to use sox_seek

Dan Hitt <[email protected]>
Newsgroups gmane.comp.audio.sox
Message-ID <CAOphizLnrajpe-7TGuxyp2pt8+_ZbVU9yc9oemNAtrybbRNqRw@mail.gmail.com>
I'm on a debian stretch box, using what i imagine is version 14, 4, 1
based on sox.h (SOX_LIB_VERSION(14, 4, 1)).

I need to seek back and forth in a file, ultimately reading the same
samples multiple times.

When i seek backwards, via a call to sox_seek(*,*, SOX_SEEK_SET) with
an offset less than the current position, the file pointer is moved,
according to ftell() applied to ->fp in the sox format structure.

But the ->tell_off field doesn't budge.

And then when i've hauled out a count of samples equal to what the
file holds (but nowhere near the end of the file, according to
ftell()) i get this error message about a premature end of the file,
and my reading stops.

Because of the great age of sox this can hardly be an unknown effect
but i can't find any mention of it on google.

So . . . what's the best way to handle it?

Should i go in and manhandle the ->tell_off field to match what i
think it should be?

Or should i reopen the file each time it has gone through its quota of samples?

Or maybe i'm just crazily wrong and i have to do something extra for sox_seek?

Anyhow, would appreciate any advice, especially if it sounds like i'm
just not making the call right.

TIA!!

dan

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.