BASS.NET API for the Un4seen BASS Audio Library

BassBASS_ChannelFlags Method

BASS.NET API for the Un4seen BASS Audio Library
Modifies and retrieves a channel's flags.

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

[DllImportAttribute("bass")]
public static BASSFlag BASS_ChannelFlags(
	int handle,
	BASSFlag flags,
	BASSFlag mask
)

Parameters

handle
Type: SystemInt32
The channel handle... a HCHANNEL, HMUSIC, HSTREAM.
flags
Type: Un4seen.BassBASSFlag
A combination of these flags (see BASSFlag):
BASS_SAMPLE_LOOPLoop the channel.
BASS_SAMPLE_MUTEMAXMute the channel when it is at (or beyond) its max distance.
BASS_STREAM_AUTOFREEAutomatically free the channel when playback ends. Note that the BASS_MUSIC_AUTOFREE flag is identical to this flag. (HSTREAM/HMUSIC)
BASS_STREAM_RESTRATERestrict the download rate. (HSTREAM)
BASS_MUSIC_NONINTERUse non-interpolated mixing. (HMUSIC)
BASS_MUSIC_SINCINTERUse sinc interpolated sample mixing. (HMUSIC)
BASS_MUSIC_RAMPUse "normal" ramping. (HMUSIC)
BASS_MUSIC_RAMPSUse "sensitive" ramping. (HMUSIC)
BASS_MUSIC_SURROUNDUse surround sound. (HMUSIC)
BASS_MUSIC_SURROUND2Use surround sound mode 2. (HMUSIC)
BASS_MUSIC_FT2MODUse FastTracker 2 .MOD playback. (HMUSIC)
BASS_MUSIC_PT1MODUse ProTracker 1 .MOD playback. (HMUSIC)
BASS_MUSIC_POSRESETStop all notes when seeking. (HMUSIC)
BASS_MUSIC_POSRESETEXStop all notes and reset BPM/etc when seeking. (HMUSIC)
BASS_MUSIC_STOPBACKStop when a backward jump effect is played. (HMUSIC)
BASS_SPEAKER_xxxSpeaker assignment flags. (HSTREAM/HMUSIC)
Other attributes may be supported by add-ons, see the documentation
mask
Type: Un4seen.BassBASSFlag
The flags (as above) to modify. Flags that are not included in this are left as they are, so it can be set to 0 in order to just retrieve the current flags. To modify the speaker flags, any of the BASS_SPEAKER_xxx flags can be used in the mask (no need to include all of them).

Return Value

Type: BASSFlag
If successful, the channel's updated flags are returned, else -1 is returned. Use BASS_ErrorGetCode to get the error code.
Remarks

Some flags may not be adjustable in some circumstances, so the return value should be checked to confirm any changes. The flags listed above are just the flags that can be modified, and there may be additional flags present in the return value. See the BASS_CHANNELINFO documentation for a full list of flags.

Streams that are created by add-ons may have additional flags available. There is a limited number of possible flag values though, so some add-ons may use the same flag value for different things. This means that when using add-on specific flags with a stream created via the plugin system, it is a good idea to first confirm that the add-on is handling the stream, by checking its ctype via BASS_ChannelGetInfo(Int32, BASS_CHANNELINFO).

During playback, the effects of flag changes are not heard instantaneously, due to buffering. To reduce the delay, use the BASS_CONFIG_BUFFER config option to reduce the buffer length.

ERROR CODEDescription
BASS_ERROR_HANDLEhandle is not a valid channel.

Examples

Toggle looping on a channel:
if ((Bass.BASS_ChannelFlags(channel, BASSFlag.BASS_DEFAULT, BASSFlag.BASS_DEFAULT) & BASSFlag.BASS_SAMPLE_LOOP) == BASSFlag.BASS_SAMPLE_LOOP)
{
  // loop flag was set, so remove it
  Bass.BASS_ChannelFlags(channel, BASSFlag.BASS_DEFAULT, BASSFlag.BASS_SAMPLE_LOOP);
}
else
{
  // loop flag was not set, so set it
  Bass.BASS_ChannelFlags(channel, BASSFlag.BASS_SAMPLE_LOOP, BASSFlag.BASS_SAMPLE_LOOP);
}
See Also

Reference