BASS.NET API for the Un4seen BASS Audio LibraryBassBASS_ChannelSetAttribute Method (Int32, BASSAttribute, Single)BASS.NET API for the Un4seen BASS Audio Library
Sets the value of an attribute of a sample, stream or MOD music.

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_ChannelSetAttribute(
	int handle,
	BASSAttribute attrib,
	float value
)

Parameters

handle
Type: SystemInt32
The channel handle... a HCHANNEL, HMUSIC, HSTREAM or HRECORD.
attrib
Type: Un4seen.BassBASSAttribute
The attribute to set the value of (one of the following, see BASSAttribute):
BASS_ATTRIB_FREQThe sample rate, 100 (min) to 100000 (max), 0 = original rate (when the channel was created).
BASS_ATTRIB_PANThe panning/balance position, -1 (full left) to +1 (full right), 0 = centre.
BASS_ATTRIB_VOLThe volume level, 0 (silent) to 1 (full).
BASS_ATTRIB_SRCSample rate conversion quality.
BASS_ATTRIB_EAXMIXEAX wet/dry mix, 0 (full dry) to 1 (full wet), -1 = automatically calculate the mix based on the distance (the default).
BASS_ATTRIB_MUSIC_AMPLIFYThe amplification level, 0 (min) to 100 (max) rounded down to a whole number. (HMUSIC)
BASS_ATTRIB_MUSIC_BPMThe BPM, 1 (min) to 255 (max) rounded down to a whole number. (HMUSIC)
BASS_ATTRIB_MUSIC_PANSEPThe Pan separation level, 0 (min) to 100 (max), 50 = linear rounded down to a whole number. (HMUSIC)
BASS_ATTRIB_MUSIC_PSCALERThe Position scaler, 1 (min) to 256 (max) rounded down to a whole number. (HMUSIC)
BASS_ATTRIB_MUSIC_SPEEDThe Speed, 0 (min) to 255 (max) rounded down to a whole number. (HMUSIC)
BASS_ATTRIB_MUSIC_VOL_CHANA channel volume level, 0 (silent) to 1 (full). (HMUSIC)
BASS_ATTRIB_MUSIC_VOL_GLOBALGlobal volume level. (HMUSIC)
BASS_ATTRIB_MUSIC_VOL_INSTAn instrument/sample volume level, 0 (min) to 64 (max, 128 for IT format) rounded down to a whole number. (HMUSIC)
Other attributes may be supported by add-ons, e.g. BASS_FX:
BASS_ATTRIB_TEMPOThe tempo of a channel, [-95%...0...+5000%] percents.
BASS_ATTRIB_TEMPO_PITCHThe pitch of a channel, [-60...0...+60] semitones.
BASS_ATTRIB_TEMPO_FREQThe sample rate of a channel in Hz, but calculates by the same % as BASS_ATTRIB_TEMPO.
BASS_ATTRIB_TEMPO_OPTION_USE_AA_FILTERUse the AA Filter for a tempo channel (=1, =0).
BASS_ATTRIB_TEMPO_OPTION_AA_FILTER_LENGTHSets the AA Filter length in taps (between 8 and 128).
BASS_ATTRIB_TEMPO_OPTION_USE_QUICKALGOUse the tempo quick algorithm for a tempo channel (=1, =0).
BASS_ATTRIB_TEMPO_OPTION_SEQUENCE_MSSets the tempo sequence in ms. of a tempo channel (default = 82).
BASS_ATTRIB_TEMPO_OPTION_SEEKWINDOW_MSSets the tempo seek window in ms. of a tempo channel (default = 82).
BASS_ATTRIB_TEMPO_OPTION_OVERLAP_MSSets the tempo overlap in ms. of a tempo channel (default = 12).
BASS_ATTRIB_REVERSE_DIRSets the playback direction of a reverse channel (-1=reverse, 1=forward, or use one of the BASSFXReverse flags).
value
Type: SystemSingle
The new attribute value. See the attribute's documentation for details on the possible values.

Return Value

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

The actual attribute value may not be exactly the same as requested, due to precision differences. For example, an attribute might only allow whole number values. BASS_ChannelGetAttribute(Int32, BASSAttribute, Single) can be used to confirm what the value is.

ERROR CODEDescription
BASS_ERROR_HANDLEhandle is not a valid channel.
BASS_ERROR_ILLTYPEattrib is not valid.
BASS_ERROR_ILLPARAMvalue is not valid. See the attribute's documentation for the valid range of values.
Some attributes may have additional error codes, see the documentation

Examples

Change the volume of a channel to 50%:
VB
Dim stream As Integer = Bass.BASS_StreamCreateFile("afile.mp3", 0, 0, BASSFlag.BASS_DEFAULT)
Bass.BASS_ChannelPlay(stream, False)
...
Bass.BASS_ChannelSetAttribute(stream, BASSAttribute.BASS_ATTRIB_VOL, 0.5F)
int stream = Bass.BASS_StreamCreateFile("afile.mp3", 0, 0, BASSFlag.BASS_DEFAULT);
Bass.BASS_ChannelPlay(stream, false);
...
Bass.BASS_ChannelSetAttribute(stream, BASSAttribute.BASS_ATTRIB_VOL, 0.5f);
See Also

Reference