BASS_ASIO_Lock

Locks the device to the current thread.

BOOL BASS_ASIO_Lock(
    BOOL lock
);

Parameters

lockIf FALSE, unlock the device, else lock it.

Return value

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

Error codes

BASS_ERROR_INITBASS_ASIO_Init has not been successfully called.

Remarks

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

Example

Lock the device to ensure that 2 channels change rate simultaneously.
BASS_ASIO_Lock(TRUE); // lock the device
BASS_ASIO_ChannelSetRate(FALSE, 0, 48000); // set 1st channel's rate
BASS_ASIO_ChannelSetRate(FALSE, 1, 48000); // set 2nd channel's rate
BASS_ASIO_Lock(FALSE); // unlock the device