BASS.NET API for the Un4seen BASS Audio Library

BassBASS_ChannelRef Method

BASS.NET API for the Un4seen BASS Audio Library
Changes the reference count of a stream, MOD music or recording channel.

Namespace:  Un4seen.Bass
Assembly:  Bass.Net (in Bass.Net.dll) Version: 2.4.18.0
Syntax

[DllImportAttribute("bass", CharSet = CharSet.Unicode)]
public static bool BASS_ChannelRef(
	int handle,
	bool inc
)

Parameters

handle
Type: SystemInt32
The channel handle... a HMUSIC, HSTREAM or HRECORD handle.
inc
Type: SystemBoolean
Increment or decrement the reference count... = increment, u = decrement.

Return Value

Type: Boolean
If succesful, then is returned, else is returned. Use BASS_ErrorGetCode to get the error code.
Remarks

Increasing a channel's reference count prevents it being freed. When BASS_ChannelFree(Int32) or similar is called to free a channel that does not have a 0 reference count, the channel will be invalidated so that only this function and BASS_ChannelLock(Int32, Boolean) can subsequently be called on it; other functions will fail with a BASS_ERROR_FREEING error. The channel will be freed asynchronously (in another thread) once it has a 0 reference count (and it is unlocked).

This can be useful when accessing the channel's memory (eg. tags) to ensure that it is not freed in the meantime by another thread. The reference count can be incremented and decremented by different threads.

ERROR CODEDescription
BASS_ERROR_HANDLEhandle is not a valid channel.
BASS_ERROR_ALREADYThe channel already has a 0 reference count so cannot be decremented.
BASS_ERROR_FREEINGThe channel's reference count cannot be incremented because it is being freed.

See Also

Reference