BASS_ChannelIsActive


Checks if a sample, stream, or MOD music is active (playing) or stalled. Can also check if a recording is in progress.

DWORD BASS_ChannelIsActive(
    DWORD handle
);

Parameters

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

Return value

The return value is one of the following.
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 a lack of sample data. Playback will automatically resume once there is 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 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 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).

Platform-specific

When DirectSound output is used on Windows, if the device stops unexpectedly then it will need to be reinitialized with BASS_Free and BASS_Init to get it working again.

See also

BASS_ChannelGetLevel, BASS_ChannelPlay, BASS_ChannelSetSync, BASS_IsStarted, BASS_ATTRIB_NET_RESUME