rtinrepos

INSTRUMENT design – reposition input pointer for arbitrary file-reading

The rtinrepos() function is used in RTcmix instrument design to set the input point for reading. This is done in preparation for a subsequent call to rtgetin. Designed for use by instruments that want to reposition the input file arbitrarily (like REVMIX, which reads a file backwards).

Typically it is used in the INSTRUMENT::run() member function of an instrument. It only works on file input, as arbitrary movement forwards and backwards in real-time isn’t quite possible (yet).

It replaces the older inrepos function used in disk-only cmix.


Usage

int rtinrepos(Instrument *inst, int nframes, int whence)

*\*inst* is a pointer to the INSTRUMENT object being scheduled. Usually this is the token this (i.e. a pointer to the INSTRUMENT calling the rtinrepos() function).
*nframes* is the number of samples to move the input pointer forwards or backwards from a point set by whence. nframes can take a negative value.
*whence* works the same way that the unix lseek() function does:

The rtinrepos() function returns 0 if it is successful, it will exit if there is an error.


Examples


See Also