BASS_Mixer_ChannelGetPositionEx

Retrieves the playback position of a mixer source channel, optionally accounting for some latency.

QWORD BASS_Mixer_ChannelGetPositionEx(
    DWORD handle,
    DWORD mode,
    DWORD delay
);

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)
other modes may be supported by add-ons, see the documentation.
delayHow far back (in bytes) in the mixer output to get the source channel's position from.

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 mode is not available, or delay goes beyond where the mixer has record of the source channel's position.
BASS_ERROR_UNKNOWNSome other mystery problem!

Remarks

BASS_Mixer_ChannelGetPosition compensates for the mixer's playback buffering to give the position that is currently being heard, but if the mixer is feeding some other output system, it will not know how to compensate for that. This function fills that gap by allowing the latency to be specified in the call. This functionality requires the mixer to keep a record of its sources' position going back some time, and that is enabled via the BASS_MIXER_POSEX flag when a mixer is created, with the BASS_CONFIG_MIXER_POSEX config option determining how far back the position record goes. If the mixer is not a decoding channel (not using the BASS_STREAM_DECODE flag) then it will automatically have a position record at least equal to its playback buffer length.

See also

BASS_Mixer_ChannelGetPosition, BASS_CONFIG_MIXER_POSEX

BASS_ChannelGetPosition