BASS_ChannelLock

Locks a stream, MOD music or recording channel to the current thread.

BOOL BASS_ChannelLock(
    DWORD handle,
    BOOL lock
);

Parameters

handleThe channel handle... a HMUSIC, HSTREAM or HRECORD.
lockIf FALSE, unlock the channel, else lock it.

Return value

If successful, 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.

Remarks

Locking a channel prevents other threads from performing most functions on it, including buffer updates. Other threads wanting to access a locked channel will block until it is unlocked, so a channel should only be locked very briefly. A channel must be unlocked in the same thread that it was locked.

Example

Lock a channel to ensure that 2 DSP functions start together.
BASS_ChannelLock(channel, TRUE); // lock channel
BASS_ChannelSetDSP(channel, DspProc1, NULL, 0); // set 1st DSP
BASS_ChannelSetDSP(channel, DspProc2, NULL, 0); // set 2nd DSP
BASS_ChannelLock(channel, FALSE); // unlock channel