BASS.NET API for the Un4seen BASS Audio Library

BassFxBASS_FX_BPM_BeatCallbackSet Method

BASS.NET API for the Un4seen BASS Audio Library
Enable getting Beat position in seconds in real-time.

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

[DllImportAttribute("bass_fx")]
public static bool BASS_FX_BPM_BeatCallbackSet(
	int handle,
	BPMBEATPROC proc,
	IntPtr user
)

Parameters

handle
Type: SystemInt32
Stream/music/wma/cd/any other supported add-on format.
proc
Type: Un4seen.Bass.AddOn.FxBPMBEATPROC
User defined function to receive the beat position values (see BPMBEATPROC).
user
Type: SystemIntPtr
User instance data to pass to the callback function.

Return Value

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

This method works on real-time (buffered) as well as on decoding channels and might also be used together with Tempo channels.

BASS_FX_BPM_BeatFree(Int32) must be called at the end to free the real-time beat position callback and resources.

Note: You should call BASS_FX_BPM_BeatCallbackReset(Int32) after you have changed the position of the stream when called from a "mixtime" SYNCPROC.

ERROR CODEDescription
BASS_ERROR_HANDLEhandle is not valid.

Examples

Get all the beat positions of the first minute of a track:
private BPMBEATPROC _beatProc;
...
int stream = Bass.BASS_StreamCreateFile("test.mp3", 0L, 0L, BASSFlag.BASS_DEFAULT);
_beatProc = new BPMBEATPROC(MyBeatProc);
BassFx.BASS_FX_BPM_BeatCallbackSet(stream, _beatProc, IntPtr.Zero);
Bass.BASS_ChannelPlay(stream, false);
...
private void MyBeatProc(int channel, double beatpos, IntPtr user)
{
  Console.WriteLine("Beat at: {0}", beatpos);
}
See Also

Reference