Enable getting Beat position in seconds of the decoded channel using a callback function.
Namespace: Un4seen.Bass.AddOn.Fx
Assembly: Bass.Net (in Bass.Net.dll) Version: 2.4.17.2
Syntax
[DllImportAttribute("bass_fx")] public static bool BASS_FX_BPM_BeatDecodeGet( int channel, double startSec, double endSec, BASSFXBpm flags, BPMBEATPROC proc, IntPtr user )
Parameters
- channel
- Type: SystemInt32
Stream/music/wma/cd/any other supported add-on format using a decoding channel. - startSec
- Type: SystemDouble
Start detecting position in seconds. - endSec
- Type: SystemDouble
End detecting position in seconds (> 0). - flags
- Type: Un4seen.Bass.AddOn.FxBASSFXBpm
Use one of the following (see BASSFXBpm):BASS_FX_BPM_BKGRND If in use, then you can do other stuff while detection's in process. BASS_FX_FREESOURCE Free the source handle as well? - 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: BooleanIf successful, is returned, else is returned. Use BASS_ErrorGetCode to get the error code.
Remarks
ERROR CODE | Description |
---|---|
BASS_ERROR_HANDLE | channel is not valid. |
BASS_ERROR_DECODE | The channel is not a decoding channel. Make sure the channel was created using the BASS_STREAM_DECODE or BASS_MUSIC_DECODE flag. |
BASS_ERROR_ILLPARAM | An illegal parameter was specified. |
BASS_ERROR_ALREADY | Beat detection, for this channel is already in use. |
Examples
private BPMBEATPROC _beatProc; ... int stream = Bass.BASS_StreamCreateFile("test.mp3", 0L, 0L, BASSFlag.BASS_STREAM_DECODE); _beatProc = new BPMBEATPROC(MyBeatProc); BassFx.BASS_FX_BPM_BeatDecodeGet(stream, 0.0, 60.0, BASSFXBpm.BASS_FX_BPM_BKGRND, _beatProc, IntPtr.Zero); BassFx.BASS_FX_BPM_BeatFree(stream); ... private void MyBeatProc(int channel, double beatpos, IntPtr user) { Console.WriteLine("Beat at: {0}", beatpos); }
See Also