Ejemplo n.º 1
0
        public DeckViewModel()
        {
            _progressBarTimer          = new Timer(100);
            _progressBarTimer.Elapsed += (s, e) =>
            {
                if (!IsDragging)
                {
                    OnPropertyChanged(nameof(Position));
                }
            };

            Player.MediaEnded += (s, e) =>
            {
                Player.Stop();
                Position = Player.Reverse ? Player.Duration.TotalSeconds : 0;
                _progressBarTimer.Stop();
            };

            Reverb.ApplyOn(Player);
            Distortion.ApplyOn(Player);
            Echo.ApplyOn(Player);
            AutoWah.ApplyOn(Player);
            Rotate.ApplyOn(Player);

            #region Commands
            PlayCommand = new DelegateCommand(Play);
            StopCommand = new DelegateCommand(Stop);

            SoftDistortionCommand     = new DelegateCommand(Distortion.Soft);
            MediumDistortionCommand   = new DelegateCommand(Distortion.Medium);
            HardDistortionCommand     = new DelegateCommand(Distortion.Hard);
            VeryHardDistortionCommand = new DelegateCommand(Distortion.VeryHard);

            ManyEchoesCommand    = new DelegateCommand(Echo.ManyEchoes);
            ReverseEchoesCommand = new DelegateCommand(Echo.ReverseEchoes);
            RoboticEchoesCommand = new DelegateCommand(Echo.RoboticVoice);
            SmallEchoesCommand   = new DelegateCommand(Echo.Small);

            SlowAutoWahCommand   = new DelegateCommand(AutoWah.Slow);
            FastAutoWahCommand   = new DelegateCommand(AutoWah.Fast);
            HiFastAutoWahCommand = new DelegateCommand(AutoWah.HiFast);

            ResetPitchCommand     = new DelegateCommand(() => Player.Pitch = 0);
            ResetFrequencyCommand = new DelegateCommand(() => Player.Frequency = 44100);
            ResetPanCommand       = new DelegateCommand(() => Player.Balance = 0);
            ResetTempoCommand     = new DelegateCommand(() => Player.Tempo = 0);
            #endregion
        }