BASS.NET API for the Un4seen BASS Audio LibraryBassAsioBASS_ASIO_SetRate Method BASS.NET API for the Un4seen BASS Audio Library
Sets the Asio device's sample rate.

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

[DllImportAttribute("bassasio.dll", CharSet = CharSet.Auto)]
public static bool BASS_ASIO_SetRate(
	double rate
)

Parameters

rate
Type: SystemDouble
The sample rate.

Return Value

Type: Boolean
If succesful, then is returned, else is returned. Use BASS_ASIO_ErrorGetCode to get the error code.
Remarks

When it's not possible to set the device to the rate wanted, BASS_ASIO_ChannelSetRate(Boolean, Int32, Double) can be used to overcome that.

ERROR CODEDescription
BASS_ERROR_INITBASS_ASIO_Init(Int32, BASSASIOInit) has not been successfully called.
BASS_ERROR_NOTAVAILThe sample rate is not supported by the device/drivers.
BASS_ERROR_UNKNOWNSome other mystery problem!

Examples

Set the Asio device and channel sample rate to the same as the underlying BASS decoding stream, in order to save resampling:
VB
' get the channel info of the decoding stream
Dim info As BASS_CHANNELINFO = Bass.BASS_ChannelGetInfo(streamDecoding)
' set the source rate
BassAsio.BASS_ASIO_ChannelSetRate(False, 0, CDbl(info.freq))
' try to set the device rate too (saves resampling)
BassAsio.BASS_ASIO_SetRate(CDbl(info.freq))
// get the channel info of the decoding stream
BASS_CHANNELINFO info = Bass.BASS_ChannelGetInfo(streamDecoding);
// set the source rate
BassAsio.BASS_ASIO_ChannelSetRate(false, 0, (double)info.freq);
// try to set the device rate too (saves resampling)
BassAsio.BASS_ASIO_SetRate( (double)info.freq );
See Also

Reference