BASS.NET API for the Un4seen BASS Audio LibraryBassBASS_ChannelPlay Method BASS.NET API for the Un4seen BASS Audio Library
Starts (or resumes) playback of a sample, stream, MOD music, or recording.

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

[DllImportAttribute("bass.dll", CharSet = CharSet.Unicode)]
public static bool BASS_ChannelPlay(
	int handle,
	bool restart
)

Parameters

handle
Type: SystemInt32
The channel handle... a HCHANNEL / HMUSIC / HSTREAM / HRECORD handle.
restart
Type: SystemBoolean
Restart playback from the beginning? If handle is a user stream, it's current buffer contents are flushed. If it's a MOD music, it's BPM/etc are automatically reset to their initial values.

Return Value

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

When streaming in blocks (BASS_STREAM_BLOCK), the restart parameter is ignored as it's not possible to go back to the start. The restart parameter is also of no consequence with recording channels.

ERROR CODEDescription
BASS_ERROR_HANDLEhandle is not a valid channel.
BASS_ERROR_STARTThe output is paused/stopped, use BASS_Start to start it.
BASS_ERROR_DECODEThe channel is not playable, it's a "decoding channel".
BASS_ERROR_BUFLOSTShould not happen... check that a valid window handle was used with BASS_Init(Int32, Int32, BASSInit, IntPtr, IntPtr).
BASS_ERROR_NOHWNo hardware voices are available (HCHANNEL only). This only occurs if the sample was loaded/created with the BASS_SAMPLE_VAM flag, and BASS_VAM_HARDWARE is set in the sample's VAM mode, and there are no hardware voices available to play it.

Examples

VB
Bass.BASS_Init(- 1, 44100, BASSInit.BASS_DEVICE_DEFAULT, IntPtr.Zero)
' create the stream
Dim stream As Integer = Bass.BASS_StreamCreateFile("test.mp3", 0, 0, BASSFlag.BASS_DEFAULT)
Bass.BASS_ChannelPlay(stream, False)
...
Bass.BASS_StreamFree(stream)
Bass.BASS_Init(-1, 44100, BASSInit.BASS_DEVICE_DEFAULT, IntPtr.Zero);
// create the stream
int stream = Bass.BASS_StreamCreateFile("test.mp3", 0, 0, BASSFlag.BASS_DEFAULT);
Bass.BASS_ChannelPlay(stream, false);
...
Bass.BASS_StreamFree(stream);
See Also

Reference