BASS_ChannelSetLink


Links two MOD music or stream channels together.

BOOL BASS_ChannelSetLink(
    DWORD handle,
    DWORD chan
);

Parameters

handleThe channel handle... a HMUSIC or HSTREAM.
chanThe handle of the channel to have linked with it... a HMUSIC or HSTREAM.

Return value

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

Error codes

BASS_ERROR_HANDLEAt least one of handle and chan is not a valid channel.
BASS_ERROR_DECODEAt least one of handle and chan is a "decoding channel", so cannot be linked.
BASS_ERROR_ALREADYchan is already linked to handle.
BASS_ERROR_UNKNOWNSome other mystery problem!

Remarks

Linked channels are started/stopped/paused/resumed together. Links are one-way; for example, channel chan will be started by channel handle, but not vice versa unless another link has been set in that direction.

If a linked channel has reached the end, it will not be restarted when a channel it is linked to is started. If you want a linked channel to be restarted, you need to have resetted its position using BASS_ChannelSetPosition beforehand.

Platform-specific

Except for on Windows, linked channels on the same device are guaranteed to start playing simultaneously. On Windows, it is possible for there to be a slight gap between them, but it will generally be shorter (and never longer) than starting them individually.

Example

Link 2 streams and play them together.
BASS_ChannelSetLink(stream1, stream2); // link stream2 to stream1
BASS_ChannelPlay(stream1, FALSE); // start both streams together

See also

BASS_ChannelRemoveLink