Example #1
0
        public override async Task <(bool Changed, SongData song)> Execute(SongData song)
        {
            int stream = Bass.BASS_StreamCreateFile(song.FullFileName, 0, 0, BASSFlag.BASS_STREAM_DECODE);

            if (stream == 0)
            {
                log.Error("BPM: Could not create stream for {0}. {1}", song.FullFileName, Bass.BASS_ErrorGetCode().ToString());
                return(false, song);
            }

            _bpmProc = BpmProgressProc;

            double len = Bass.BASS_ChannelBytes2Seconds(stream, Bass.BASS_ChannelGetLength(stream));
            float  bpm = BassFx.BASS_FX_BPM_DecodeGet(stream, 0.0, len, 0, BASSFXBpm.BASS_FX_BPM_BKGRND | BASSFXBpm.BASS_FX_FREESOURCE | BASSFXBpm.BASS_FX_BPM_MULT2,
                                                      _bpmProc, IntPtr.Zero);

            song.BPM = Convert.ToInt32(bpm);
            BassFx.BASS_FX_BPM_Free(stream);
            return(true, song);
        }
Example #2
0
 public static extern float BASS_FX_BPM_DecodeGet(int channel, double startSec, double endSec, int minMaxBPM, BASSFXBpm flags, BPMPROGRESSPROC proc, IntPtr user);