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.17.5
Syntax
[DllImportAttribute("bass")] 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. This has no effect on streams with the BASS_STREAM_BLOCK flag set or on recordings.
Return Value
Type: BooleanIf successful, is returned, else is returned. Use BASS_ErrorGetCode to get the error code.
Remarks
If other channels have been linked to the specified channel via BASS_ChannelSetLink(Int32, Int32), this function will attempt to simultaneously start playing them too but if any fail, it will be silently. The return value and error code only reflects what happened with the specified channel. BASS_ChannelIsActive(Int32) can be used to confirm the status of linked channels.
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 CODE | Description |
---|---|
BASS_ERROR_HANDLE | handle is not a valid channel. |
BASS_ERROR_START | The output is paused/stopped, use BASS_Start to start it. |
BASS_ERROR_DECODE | The channel is not playable, it's a "decoding channel". |
BASS_ERROR_BUFLOST | Should not happen... check that a valid window handle was used with BASS_Init(Int32, Int32, BASSInit, IntPtr, IntPtr). |
BASS_ERROR_NOHW | No 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
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