Beispiel #1
0
        public void Evaluate(int SpreadMax)
        {
            bool resetprms = false;

            if (this.FPinInHandle.PinIsChanged)
            {
                this.ClearUp();
                double dhandle;
                this.FPinInHandle.GetValue(0, out dhandle);
                int ihandle = Convert.ToInt32(Math.Round(dhandle));

                if (this.FManager.Exists(ihandle))
                {
                    this.FChannel         = this.FManager.GetChannel(ihandle);
                    this.FChannel.OnInit += new EventHandler(FCHannel_OnInit);
                    if (this.FChannel.BassHandle.HasValue)
                    {
                        this.Setup();
                        resetprms = true;
                    }
                }
            }

            if (this.FPinInCenter.PinIsChanged || this.FPinInRelease.PinIsChanged || this.FPinInBandWidth.PinIsChanged || resetprms)
            {
                if (this.FChannel != null)
                {
                    if (this.FChannel.BassHandle.HasValue)
                    {
                        double band, center, release;

                        this.FPinInBandWidth.GetValue(0, out band);
                        this.FPinInCenter.GetValue(0, out center);
                        this.FPinInRelease.GetValue(0, out release);

                        BassFx.BASS_FX_BPM_BeatSetParameters(this.FChannel.BassHandle.Value, (float)band, (float)center, (float)release);
                    }
                }
            }

            if (this.FOnBeat)
            {
                this.FPinOutOnBeat.SliceCount = 1;
                this.FPinOutOnBeat.SetValue(0, 1);
                this.FOnBeat = false;
            }
            else
            {
                this.FPinOutOnBeat.SliceCount = 1;
                this.FPinOutOnBeat.SetValue(0, 0);
            }
        }
Beispiel #2
0
        private void Scan()
        {
            long pos = Bass.BASS_ChannelGetLength(this.handle);

            this.len  = Bass.BASS_ChannelBytes2Seconds(this.handle, pos);
            _beatProc = new BPMBEATPROC(MyBeatProc);

            BassFx.BASS_FX_BPM_BeatCallbackSet(this.handle, _beatProc, IntPtr.Zero);
            BassFx.BASS_FX_BPM_BeatSetParameters(this.handle, this.parameters.Width, this.parameters.Center, this.parameters.Release);
            BassFx.BASS_FX_BPM_BeatDecodeGet(this.handle, 0.0, this.len, BASSFXBpm.BASS_FX_BPM_BKGRND, _beatProc, IntPtr.Zero);


            Bass.BASS_StreamFree(this.handle);
            if (OnComplete != null)
            {
                OnComplete(this.parameters.Index);
            }
        }
Beispiel #3
0
        private void Setup()
        {
            if (this.FChannel != null)
            {
                if (this.FChannel.BassHandle.HasValue)
                {
                    _beatProc = new BPMBEATPROC(MyBeatProc);
                    BassFx.BASS_FX_BPM_BeatCallbackSet(this.FChannel.BassHandle.Value, _beatProc, IntPtr.Zero);

                    double band, center, release;

                    this.FPinInBandWidth.GetValue(0, out band);
                    this.FPinInCenter.GetValue(0, out center);
                    this.FPinInRelease.GetValue(0, out release);

                    BassFx.BASS_FX_BPM_BeatSetParameters(this.FChannel.BassHandle.Value, (float)band, (float)center, (float)release);
                }
            }
        }