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.
The following constants are accepted as the "base" argument for seeking to:
Buffer Seek Constant | |
---|---|
Constant | Description |
buffer_seek_start | The start of the buffer |
buffer_seek_relative | A position relative to the current read/write position |
buffer_seek_end | The end of the buffer |
buffer_seek(buffer, base, offset);
Argument | Type | Description |
---|---|---|
buffer | Buffer | The buffer to use. |
base | Real | The base position to seek. |
offset | Real | The data offset value. |
Real (the new seek position)
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.