buffer_seek

This function moves the seek position of a buffer, setting it relative to the start, end or current seek position (that which was last used when reading or writing data).

The seek position is the offset (in bytes) from the start of the buffer where new values are written, and from where values are read. It also moves automatically when you read from or write to a buffer.

Usage Notes

The following constants are accepted as the "base" argument for seeking to:

Buffer Seek Constant
ConstantDescription
buffer_seek_startThe start of the buffer
buffer_seek_relativeA position relative to the current read/write position
buffer_seek_endThe end of the buffer

 

Syntax:

buffer_seek(buffer, base, offset);

ArgumentTypeDescription
bufferBufferThe buffer to use.
baseRealThe base position to seek.
offsetRealThe data offset value.

 

Returns:

Real (the new seek position)

 

Example:

buffer_seek(buff, buffer_seek_start, 0);
buffer_write(buff, buffer_s16, 0);
buffer_write(buff, buffer_s16, x);
buffer_write(buff, buffer_s16, y);

The above code finds the start of the buffer stored in the variable buff then writes a series of signed 16bit integer values to it.