BASS.NET API for the Un4seen BASS Audio Library

BassFxBASS_FX_BPM_Translate Method

BASS.NET API for the Un4seen BASS Audio Library
Translate the given BPM to FREQ/PERCENT and vice versa or multiply BPM by 2.

Namespace:  Un4seen.Bass.AddOn.Fx
Assembly:  Bass.Net (in Bass.Net.dll) Version: 2.4.17.5
Syntax

[DllImportAttribute("bass_fx")]
public static float BASS_FX_BPM_Translate(
	int handle,
	float val2tran,
	BASSFXBpmTrans trans
)

Parameters

handle
Type: SystemInt32
Stream/music/wma/cd/any other supported add-on format.
val2tran
Type: SystemSingle
Specify a value to translate to a given option (no matter if used X2).
trans
Type: Un4seen.Bass.AddOn.FxBASSFXBpmTrans
Any of the following translation options (see BASSFXBpmTrans):
BASS_FX_BPM_TRAN_X2Multiply the original BPM value by 2. This may be used only once, and will change the original BPM as well.
BASS_FX_BPM_TRAN_2FREQBPM value to Frequency.
BASS_FX_BPM_TRAN_FREQ2Frequency to BPM value.
BASS_FX_BPM_TRAN_2PERCENTPercents to BPM value.
BASS_FX_BPM_TRAN_PERCENT2BPM value to Percents.

Return Value

Type: Single
If successful, the newly calculated value is returned, else -1 is returned. Use BASS_ErrorGetCode to get the error code.
Remarks

This function will not detect the BPM, it will just translate the detected original BPM value of a given handle.

ERROR CODEDescription
BASS_ERROR_HANDLEhandle is not valid.
BASS_ERROR_ILLPARAMAn illegal parameter was specified.
BASS_ERROR_ALREADYBASS_FX_BPM_TRAN_X2 already used on this handle.

Examples

The following method does a simple translation assuming you have calculated the original BPM on a source channel:
private float GetNewBPM(int sourceChannel, int tempoChannel)
{
  return BassFx.BASS_FX_BPM_Translate(sourceChannel, 
                                      BassFx.BASS_FX_TempoGetRateRatio(tempoChannel) * 100f, 
                                      BASSFXBpmTrans.BASS_FX_BPM_PERCENT2);
}
See Also

Reference