BASS.NET API for the Un4seen BASS Audio Library

BassBASS_ChannelIsActive Method

BASS.NET API for the Un4seen BASS Audio Library
Checks if a sample, stream, or MOD music is active (playing) or stalled. Can also check if a recording is in progress.

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

[DllImportAttribute("bass")]
public static BASSActive BASS_ChannelIsActive(
	int handle
)

Parameters

handle
Type: SystemInt32
The channel handle... a HCHANNEL, HMUSIC, HSTREAM, or HRECORD.

Return Value

Type: BASSActive
The return value is one of the folowing (see BASSActive):
BASS_ACTIVE_STOPPEDThe channel is not active, or handle is not a valid channel.
BASS_ACTIVE_PLAYINGThe channel is playing (or recording).
BASS_ACTIVE_PAUSEDThe channel is paused.
BASS_ACTIVE_PAUSED_DEVICEThe channel's device is paused.
BASS_ACTIVE_STALLEDPlayback of the stream has been stalled due to there not being enough sample data to continue playing. The playback will automatically resume once there's sufficient data to do so.
Remarks

When using this function with a decoding channel, BASS_ACTIVE_PLAYING will be returned while there is still data to decode. Once the end has been reached, BASS_ACTIVE_STOPPED will be returned. BASS_ACTIVE_STALLED is never returned for decoding channels; you can tell a decoding channel is stalled if BASS_ChannelGetData(Int32, IntPtr, Int32) returns less data than requested, and this function still returns BASS_ACTIVE_PLAYING.

The BASS_ACTIVE_PAUSED_DEVICE state can be the result of a BASS_Pause call or of the device stopping unexpectedly (eg. a USB soundcard being disconnected). In either case, playback will be resumed by BASS_Start.

BASS_ErrorGetCode can be used to differentiate a stopped channel from an invalid channel. The error code will be BASS_OK if the channel is valid and stopped. Syncs can be set via BASS_ChannelSetSync(Int32, BASSSync, Int64, SYNCPROC, IntPtr) to be notified when a channel reaches the end(BASS_SYNC_END sync) or stalls/resumes(BASS_SYNC_STALL sync) or pauses due to device failure(BASS_SYNC_DEV_FAIL sync).

Examples

BASSActive status = BASS_ChannelIsActive(stream);
if (status == BASSActive.BASS_ACTIVE_PLAYING)
{
  // the stream is still playing
  ...
}
See Also

Reference