BASS.NET API for the Un4seen BASS Audio Library

BassMixBASS_Mixer_ChannelGetPositionEx Method

BASS.NET API for the Un4seen BASS Audio Library
Retrieves the playback position of a mixer source channel, optionally accounting for some latency.

Namespace:  Un4seen.Bass.AddOn.Mix
Assembly:  Bass.Net (in Bass.Net.dll) Version:

public static long BASS_Mixer_ChannelGetPositionEx(
	int handle,
	BASSMode mode,
	int delay


Type: SystemInt32
The mixer source channel handle (which was add via BASS_Mixer_StreamAddChannel(Int32, Int32, BASSFlag) or BASS_Mixer_StreamAddChannelEx(Int32, Int32, BASSFlag, Int64, Int64)) beforehand).
Type: Un4seen.BassBASSMode
How 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 and flags may be supported by add-ons, see the documentation.
Type: SystemInt32
How far back (in bytes) in the mixer output to get the source channel's position from.

Return Value

Type: Int64
If an error occurs, -1 is returned, use BASS_ErrorGetCode to get the error code. If successful, the channel's position is returned.

BASS_Mixer_ChannelGetPosition(Int32, BASSMode) 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.

ERROR CODEDescription
BASS_ERROR_HANDLEhandle is not plugged into a mixer.
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!

See Also