BASS_ChannelFlags
Modifies and retrieves a channel's flags.
DWORD BASS_ChannelFlags(
DWORD handle,
DWORD flags,
DWORD mask
);
Parameters
handle | The channel handle... a HCHANNEL, HMUSIC, HSTREAM.
|
flags | A combination of these flags.
| BASS_SAMPLE_LOOP | Loop the channel.
| BASS_SAMPLE_MUTEMAX | Mute the channel when it is at (or beyond) its max distance.
| | BASS_STREAM_AUTOFREE | Automatically free the channel when playback ends. Note that the BASS_MUSIC_AUTOFREE flag is identical to this flag. (HSTREAM/HMUSIC only)
| BASS_STREAM_RESTRATE | Restrict the download rate. (HSTREAM)
| BASS_MUSIC_NONINTER | Use non-interpolated sample mixing. (HMUSIC)
| BASS_MUSIC_SINCINTER | Use sinc interpolated sample mixing. (HMUSIC)
| BASS_MUSIC_RAMP | Use "normal" ramping. (HMUSIC)
| BASS_MUSIC_RAMPS | Use "sensitive" ramping. (HMUSIC)
| BASS_MUSIC_SURROUND | Use surround sound. (HMUSIC)
| BASS_MUSIC_SURROUND2 | Use surround sound mode 2. (HMUSIC)
| BASS_MUSIC_FT2MOD | Use FastTracker 2 .MOD playback. (HMUSIC)
| BASS_MUSIC_PT1MOD | Use ProTracker 1 .MOD playback. (HMUSIC)
| BASS_MUSIC_POSRESET | Stop all notes when seeking. (HMUSIC)
| BASS_MUSIC_POSRESETEX | Stop all notes and reset BPM/etc when seeking. (HMUSIC)
| BASS_MUSIC_STOPBACK | Stop when a backward jump effect is played. (HMUSIC)
| BASS_SPEAKER_xxx | Speaker assignment flags.
|
other flags may be supported by add-ons, see the documentation.
|
mask | 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
If successful, the channel's updated flags are returned, else -1 is returned. Use BASS_ErrorGetCode to get the error code.
Error codes
BASS_ERROR_HANDLE | handle is not a valid channel.
|
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.
During playback, the effects of flag changes are not heard instantaneously, due to buffering. This latency can be reduced via the BASS_ATTRIB_BUFFER attribute.
Example
Toggle looping on a channel.
if (BASS_ChannelFlags(channel, 0, 0) & BASS_SAMPLE_LOOP) // looping is currently enabled
BASS_ChannelFlags(channel, 0, BASS_SAMPLE_LOOP); // remove the LOOP flag
else // looping is currently disabled
BASS_ChannelFlags(channel, BASS_SAMPLE_LOOP, BASS_SAMPLE_LOOP); // set the LOOP flag
See also
BASS_ChannelGetAttribute, BASS_ChannelGetInfo, BASS_ChannelSetAttribute