BASS_ChannelFree

Frees a channel, including any sync/DSP/FX it has.

BOOL BASS_ChannelFree(
    DWORD handle
);

Parameters

handleThe channel handle... a HCHANNEL, HMUSIC, HSTREAM, or HRECORD.

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 valid.
BASS_ERROR_FREEINGThe channel is already being freed.
BASS_ERROR_NOTAVAILDevice streams (STREAMPROC_DEVICE) cannot be freed.

Remarks

This function can be used to free all types of channel, instead of using either BASS_StreamFree or BASS_MusicFree or BASS_ChannelStop depending on the channel type.

Channel freeing may be blocked by BASS_ChannelLock and BASS_ChannelRef. When that happens, the channel will be immediately stopped (if playing) and invalidated, but only freed when eventually unblocked by those functions; other function calls on it will fail with a BASS_ERROR_FREEING error. If the channel is locked to the current thread or its reference count is not 0, then the channel will be freed asynchronously (in another thread) once unblocked. The channel will also be freed asynchronously if this function is called from within a callback function where it would otherwise cause a crash.

See also

BASS_ChannelRef