Sets a sample's default attributes.

BOOL BASS_SampleSetInfo(
    HSAMPLE handle,
    BASS_SAMPLE *info


handleThe sample handle.
infoPointer to the sample information structure.

Return value

If successful, TRUE is returned, else FALSE is returned. Use BASS_ErrorGetCode to get the error code.

Error codes

BASS_ERROR_HANDLEThe handle is invalid.
BASS_ERROR_ILLPARAMThe BASS_SAMPLE max value is invalid.


Use this function and BASS_SampleGetInfo to edit a sample's default attributes. Changing a sample's default attributes does not affect any existing channels, it only affects channels subsequently created via BASS_SampleGetChannel. Use BASS_ChannelSetAttribute and BASS_ChannelSet3DAttributes to change the attributes of an existing sample channel.

The sample's maximum number of simultaneous playbacks can be changed via the max member of the BASS_SAMPLE structure. If the new maximum is lower than the existing number of channels, the channels will remain existing until they are stopped.

The length, origres and chans members of the BASS_SAMPLE structure cannot be modified; any changes are ignored. Only the BASS_SAMPLE_LOOP and BASS_SAMPLE_OVER flags can be changed.


Set a sample's default volume to 0.5.
BASS_SampleGetInfo(sample, &info); // get the sample's current info
info.volume = 0.5; // set the default volume to 0.5
BASS_SampleSetInfo(sample, &info); // set the updated info

See also

BASS_ChannelSet3DAttributes, BASS_ChannelSetAttribute, BASS_SampleGetInfo, BASS_SAMPLE structure