BASS.NET API for the Un4seen BASS Audio Library

BassBASS_ChannelSetAttribute Method (Int32, BASSAttribute, IntPtr, Int32)

BASS.NET API for the Un4seen BASS Audio Library
Sets the value of a channel's attribute.

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

[DllImportAttribute("bass", EntryPoint = "BASS_ChannelSetAttributeEx")]
public static bool BASS_ChannelSetAttribute(
	int handle,
	BASSAttribute attrib,
	IntPtr value,
	int size
)

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_DOWNLOADPROCInternet stream download callback.
BASS_ATTRIB_SCANINFOScanned info. (HSTREAM only).
BASS_ATTRIB_USERUser-defined info. (HMUSIC/HSTREAM/HRECORD).
Other attributes may be supported by add-ons, see the documentation
value
Type: SystemIntPtr
The pointer to the new attribute data.
size
Type: SystemInt32
The size of the attribute data or one of the following, see BASSAttributeType.

Return Value

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

Natively floating-point attributes can be set as integers and vice versa. A floating-point value (typesize=BASS_ATTRIBTYPE_FLOAT) used to set an integer attribute will be truncated (fractional part removed) and capped to integer range.

If the attribute is currently sliding from a BASS_ChannelSlideAttribute(Int32, BASSAttribute, Single, Int32) call then that will be stopped before applying the new value. BASS_SYNC_SLIDE syncs will be triggered by this.

ERROR CODEDescription
BASS_ERROR_HANDLEhandle is not a valid channel.
BASS_ERROR_ILLTYPEattrib is not valid.
BASS_ERROR_ILLPARAMThe value content or size is not valid.
BASS_ERROR_DENIEDThe attribute is read-only.
Some attributes may have additional error codes, see the documentation

Examples

Transfer scanned info from one stream to another stream of the same file:
// get the size
int size = Bass.BASS_ChannelGetAttribute(stream1, BASSAttribute.BASS_ATTRIB_SCANINFO, IntPtr.Zero, 0);
IntPtr hglobal = Marshal.AllocHGlobal(size);
// get the data
Bass.BASS_ChannelGetAttribute(stream1, BASSAttribute.BASS_ATTRIB_SCANINFO, scaninfo, size);
// apply it to the other stream
Bass.BASS_ChannelSetAttribute(stream2, BASSAttribute.BASS_ATTRIB_SCANINFO, scaninfo, size);
Marshal.FreeHGlobal(hglobal);
See Also

Reference