예제 #1
0
파일: Cycler.cs 프로젝트: ninjawerk/Safire2
        public static void PrevSong()
        {
            if (Items.trackSource != null)
            {
                int ind = 0;
                if (Items.trackSource.Tag != null)
                {
                    ind = (int)Items.trackSource.Tag;
                    ind--;


                    if (ind < 0)
                    {
                        return;
                    }
                    Items.trackSource.Tag = ind;
                    var tracky = Items.trackSource.Items[ind] as TrackViewModel;

                    if (tracky != null && File.Exists(tracky.Path))
                    {
                        var aw = new AudioWave(tracky.Path, OutputMode.DirectSound, 1.0f);
                        aw.ReactorUsageLocked = true;
                        aw.Play();
                        aw.ReactorUsageLocked = false;
                        var fader = new PanFade(aw, Player.Instance.Wave, 10, 2000, true,
                                                Player.Instance.Volume);
                        fader.StartAndKill();

                        Player.Instance.NewMedia(ref aw);
                        //Player.Instance.Play();
                    }
                }
            }
        }
예제 #2
0
        void lst_PreviewMouseDoubleClick(object sender, System.Windows.Input.MouseButtonEventArgs e)
        {
            var track = lst.SelectedItem as Web.LFM.TopTracks.Track;

            if (track != null && !String.IsNullOrEmpty(track.Available))
            {
                var aw = new AudioWave(track.Path, OutputMode.DirectSound, Player.Instance.Volume);
                aw.ReactorUsageLocked = true;
                aw.Play();
                aw.ReactorUsageLocked = false;
                var fader = new PanFade(aw, Player.Instance.Wave, 10, 2000, true, Player.Instance.Volume);
                fader.StartAndKill();

                Player.Instance.NewMedia(ref aw);
            }
        }
예제 #3
0
        private void tracklist_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            tracklist.Tag     = tracklist.SelectedIndex;
            Items.trackSource = tracklist;
            var tracky = tracklist.SelectedItem as TrackViewModel;

            if (tracky != null && File.Exists(tracky.Path))
            {
                var aw = new AudioWave(tracky.Path, OutputMode.DirectSound, Player.Instance.Volume);
                aw.ReactorUsageLocked = true;
                aw.Play();
                aw.ReactorUsageLocked = false;
                var fader = new PanFade(aw, Player.Instance.Wave, 10, 2000, true, Player.Instance.Volume);
                fader.StartAndKill();
                Player.Instance.NewMedia(ref aw);
                //Player.Instance.Play();
            }
        }
예제 #4
0
        public bool SignalExternalCommandLineArgs(IList <string> args)
        {
            if (args.Count > 1)
            {
                var cm1 = args[1];
                if (!string.IsNullOrEmpty(cm1))
                {
                    var aw = new AudioWave(cm1, OutputMode.DirectSound, Player.Instance.Volume);
                    aw.ReactorUsageLocked = true;
                    aw.Play();
                    aw.ReactorUsageLocked = false;
                    var fader = new PanFade(aw, Player.Instance.Wave, 10, 2000, true, Player.Instance.Volume);
                    fader.StartAndKill();

                    Player.Instance.NewMedia(ref aw);
                }
            }
            return(true);
        }
예제 #5
0
        void nt_Click(object sender, RoutedEventArgs e)
        {
            var fluidLink = sender as FluidLink;

            if (fluidLink != null)
            {
                var track = fluidLink.Tag.ToString();
                if (track != null)
                {
                    var aw = new AudioWave(track, OutputMode.DirectSound, Player.Instance.Volume);
                    aw.ReactorUsageLocked = true;
                    aw.Play();
                    aw.ReactorUsageLocked = false;
                    var fader = new PanFade(aw, Player.Instance.Wave, 10, 2000, true, Player.Instance.Volume);
                    fader.StartAndKill();

                    Player.Instance.NewMedia(ref aw);
                }
            }
        }
예제 #6
0
파일: Cycler.cs 프로젝트: ninjawerk/Safire2
        static void Instance_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
        {
            try
            {
                if (e.PropertyName == "TrackEnded" && !Player.Instance.Wave.Stopped)
                {
                    switch (Mode)
                    {
                    case CycleMode.Repeat:
                    {
                        if (CoreMain.CurrentTrack != null)
                        {
                            var tracky = CoreMain.CurrentTrack;

                            if (tracky != null && File.Exists(tracky.Path))
                            {
                                var aw = new AudioWave(tracky.Path, OutputMode.DirectSound, Player.Instance.Volume);
                                aw.ReactorUsageLocked = true;
                                aw.Play();
                                aw.ReactorUsageLocked = false;
                                var fader = new PanFade(aw, Player.Instance.Wave, 10, 2000, true,
                                                        Player.Instance.Volume);
                                fader.StartAndKill();

                                Player.Instance.NewMedia(ref aw);
                                //Player.Instance.Play();
                            }
                        }
                    }
                    break;

                    case CycleMode.SongCycle:
                    {
                        if (Items.trackSource != null)
                        {
                            int ind = 0;
                            if (Items.trackSource.Tag != null)
                            {
                                ind = (int)Items.trackSource.Tag;
                                ind++;


                                if (Items.trackSource.Items.Count < ind)
                                {
                                    return;
                                }
                                Items.trackSource.Tag = ind;
                                var tracky = Items.trackSource.Items[ind] as TrackViewModel;

                                if (tracky != null && File.Exists(tracky.Path))
                                {
                                    var aw = new AudioWave(tracky.Path, OutputMode.DirectSound, Player.Instance.Volume);
                                    aw.ReactorUsageLocked = true;
                                    aw.Play();
                                    aw.ReactorUsageLocked = false;
                                    var fader = new PanFade(aw, Player.Instance.Wave, 10, 2000, true,
                                                            Player.Instance.Volume);
                                    fader.StartAndKill();

                                    Player.Instance.NewMedia(ref aw);
                                    //Player.Instance.Play();
                                }
                            }
                        }
                    }
                    break;

                    case CycleMode.CycleRepeat:
                    {
                        if (Items.trackSource != null)
                        {
                            int ind = (int)Items.trackSource.Tag;
                            if (Items.trackSource.Tag != null)
                            {
                                ind++;
                            }
                            if (getEnuCount(Items.trackSource.ItemsSource) <= ind)
                            {
                                ind = 0;
                            }

                            var tracky = Items.trackSource.Items[ind] as TrackViewModel;
                            Items.trackSource.Tag = ind;
                            if (tracky != null && File.Exists(tracky.Path))
                            {
                                var aw = new AudioWave(tracky.Path, OutputMode.DirectSound, Player.Instance.Volume);
                                aw.ReactorUsageLocked = true;
                                aw.Play();
                                aw.ReactorUsageLocked = false;
                                var fader = new PanFade(aw, Player.Instance.Wave, 10, 2000, true,
                                                        Player.Instance.Volume);
                                fader.StartAndKill();

                                Player.Instance.NewMedia(ref aw);
                                //Player.Instance.Play();
                            }
                        }
                    }
                    break;

                    case CycleMode.Shuffle:
                    {
                        if (Items.trackSource != null)
                        {
                            if (Items.trackSource.GetHashCode() != TrackSourceHash)
                            {
                                PrepShuffles(getEnuCount(Items.trackSource.ItemsSource));
                                TrackSourceHash = Items.trackSource.GetHashCode();
                            }
                            int ind = (int)Items.trackSource.Tag;
                            if (Items.trackSource.Tag != null)
                            {
                                ind++;
                            }
                            if (getEnuCount(Items.trackSource.ItemsSource) <= ind)
                            {
                                ind = 0;
                            }

                            var tracky = Items.trackSource.Items[Shuffles[ind]] as TrackViewModel;
                            Items.trackSource.Tag = ind;
                            if (tracky != null && File.Exists(tracky.Path))
                            {
                                var aw = new AudioWave(tracky.Path, OutputMode.DirectSound, Player.Instance.Volume);
                                aw.ReactorUsageLocked = true;
                                aw.Play();
                                aw.ReactorUsageLocked = false;
                                var fader = new PanFade(aw, Player.Instance.Wave, 10, 2000, true,
                                                        Player.Instance.Volume);
                                fader.StartAndKill();

                                Player.Instance.NewMedia(ref aw);
                                //Player.Instance.Play();
                            }
                        }
                    }
                    break;

                    default:
                        throw new ArgumentOutOfRangeException();
                    }
                }
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception);
            }
        }