BASS_Mixer_ChannelGetPosition

Retrieves the playback position of a mixer source channel.

QWORD BASS_Mixer_ChannelGetPosition(
    DWORD handle,
    DWORD mode
);

Parameters

handleThe channel handle.
modeHow to retrieve the position. One of the following.
BASS_POS_BYTEGet the position in bytes.
BASS_POS_MUSIC_ORDERGet the position in orders and rows... LOWORD = order, HIWORD = row * scaler (BASS_ATTRIB_MUSIC_PSCALER). (HMUSIC only)
BASS_POS_MIXER_DELAYGet the amount remaining of any start delay that was set via BASS_Mixer_StreamAddChannelEx.
other modes may be supported by add-ons, see the documentation.

Return value

If successful, then the channel's position is returned, else -1 is returned. Use BASS_ErrorGetCode to get the error code.

Error codes

BASS_ERROR_HANDLEhandle is not a mixer source.
BASS_ERROR_NOTAVAILThe requested position is not available.
BASS_ERROR_UNKNOWNSome other mystery problem!

Remarks

This function is like the standard BASS_ChannelGetPosition, but it compensates for the mixer's playback buffering to return the position that is currently being heard. If the mixer is not being played by BASS, it is possible to account for any other output system latency with the BASS_ATTRIB_MIXER_LATENCY option or the BASS_Mixer_ChannelGetPositionEx function.

If the mixer is a submixer (source of another mixer) without its own latency set via the BASS_ATTRIB_MIXER_LATENCY option then the parent mixer's latency will be used. If the parent mixer is also a submixer then the process will be repeated, and so on, until a final latency value is obtained (if possible). This is only possible if the submixer(s) have the BASS_MIXER_POSEX flag set, to enable keeping a record of source positions.

See also

BASS_Mixer_ChannelGetPositionEx, BASS_Mixer_ChannelIsActive, BASS_Mixer_ChannelSetPosition, BASS_Mixer_ChannelSetSync, BASS_ATTRIB_MIXER_LATENCY

BASS_ChannelGetPosition