BASS_ChannelSetPosition

Sets the playback position of a sample, MOD music, file stream, or CD channel.

BOOL WINAPI BASS_ChannelSetPosition(
    DWORD handle,
    DWORD pos
);

Parameters
handleThe channel handle... a HCHANNEL, HMUSIC, HSTREAM, or CDCHANNEL.
posThe position, as follows.
HCHANNELPosition in bytes.
HMUSICLOWORD = order, HIWORD = row.
HSTREAMPosition in bytes. Obviously, only file streams can have the position moved. MP3s require the use of the BASS_MP3_SETPOS flag with BASS_StreamCreateFile to enable this.
CDCHANNELPosition in milliseconds from the start of the track.

Return value
If succesful, then TRUE is returned, else FALSE is returned. Use BASS_ErrorGetCode to get the error code.

Error codes
BASS_ERROR_HANDLEhandle is not a valid channel.
BASS_ERROR_CDINIT BASS_CDInit has not been successfully called.
BASS_ERROR_POSITIONThe requested position is illegal.
BASS_ERROR_NOTFILEThe stream is not a file stream... it was not created by using BASS_StreamCreateFile.
BASS_ERROR_UNKNOWNSome other mystery problem!

Remarks
Streams are usually encoded in blocks, so it will usually not be possible to seek to the exact byte position requested (positions are rounded down to the beginning of a block). The number of bytes per block can be retrieved with BASS_StreamGetBlockLength.

When changing the position of a MOD music, and the BASS_MUSIC_POSRESET flag is active on the channel, all notes that were playing before the position changed will be stopped. Otherwise, the notes will continue playing until they are stopped in the MOD music.

Example
To set the position of a MOD music to row 20 of order 10.

BASS_ChannelSetPosition(a_music,MAKELONG(10,20));

See also
BASS_ChannelGetPosition, BASS_ChannelIsActive, BASS_MusicGetLength, BASS_StreamGetLength