예제 #1
0
        private void NextTrack()
        {
            slTime.Value = 0;
            if (BassLike.NextTrack())
            {
                slTime.Maximum = BassLike.GetTimeOfStream(BassLike.Stream);
                PlayList.Items[Vars.CurrentTrackNumber].Selected = true;
                labTime.Text      = TimeSpan.FromSeconds(BassLike.GetPosOfStream(BassLike.Stream)).ToString("mm':'ss");
                labTimeLen.Text   = TimeSpan.FromSeconds(BassLike.GetTimeOfStream(BassLike.Stream)).ToString("mm':'ss");
                labTrackInfo.Text = PlayList.Items[Vars.CurrentTrackNumber].Text
                                    + "\n" + PlayList.Items[Vars.CurrentTrackNumber].SubItems[1].Text;
                btnPause.BringToFront();
            }

            if (PlayList.Items.Count != 0)
            {
                if (BassLike.EndPlayList)
                {
                    btnStop_Click(this, new EventArgs());
                    Vars.CurrentTrackNumber    = 0;
                    PlayList.Items[0].Selected = true;
                    BassLike.EndPlayList       = false;
                    btnPlay.BringToFront();
                    if (btnRepeat.ImageIndex == 1)
                    {
                        btnPlay_Click(this, null);
                    }
                }
            }
        }
예제 #2
0
        private void timer1_Tick(object sender, EventArgs e)
        {
            labTime.Text = TimeSpan.FromSeconds(BassLike.GetPosOfStream(BassLike.Stream)).ToString("mm':'ss");
            slTime.Value = BassLike.GetPosOfStream(BassLike.Stream);

            if (BassLike.ToNextTrack())
            {
                PlayList.Items[Vars.CurrentTrackNumber].Selected = true;

                labTime.Text    = TimeSpan.FromSeconds(BassLike.GetPosOfStream(BassLike.Stream)).ToString("mm':'ss");
                labTimeLen.Text = TimeSpan.FromSeconds(BassLike.GetTimeOfStream(BassLike.Stream)).ToString("mm':'ss");
                slTime.Maximum  = BassLike.GetTimeOfStream(BassLike.Stream);
                slTime.Value    = BassLike.GetPosOfStream(BassLike.Stream);
            }
            if (BassLike.EndPlayList)
            {
                Vars.CurrentTrackNumber    = 0;
                PlayList.Items[0].Selected = true;
                if (btnRepeat.ImageIndex == 1)
                {
                    btnPlay_Click(this, null);
                }
                else
                {
                    btnStop_Click(this, new EventArgs());
                    btnPlay.BringToFront();
                }
                BassLike.EndPlayList = false;
            }
        }
예제 #3
0
        private void btnRepeat_Click(object sender, EventArgs e)
        {
            switch (btnRepeat.ImageIndex)
            {
            case 2:
            {
                btnRepeat.ImageIndex = 0;
                BassLike.loop_channel(0);
            } break;

            case 1:
            {
                btnRepeat.ImageIndex = 2;
                BassLike.loop_channel(4);
            } break;

            case 0:
            {
                btnRepeat.ImageIndex = 1;
                BassLike.loop_channel(0);
            } break;

            default:
                break;
            }
        }
예제 #4
0
 private void btnStop_Click(object sender, EventArgs e)
 {
     BassLike.Stop();
     timer1.Enabled = false;
     slTime.Value   = 0;
     labTime.Text   = "00:00";
     btnPlay.BringToFront();
 }
예제 #5
0
 public AudioPlayer()
 {
     InitializeComponent();
     Vars.Link = this;
     //Vars.SetInputFormat();
     BassLike.InitBasss(BassLike.HZ);
     FormatsLoad();
     FilesLoad();
     slVol.MouseWheel += VolumeMouseWheel;//действие на прокрутки колесом мыши
 }
예제 #6
0
 private void PreviousTrack()
 {
     if (PlayList.Items.Count != 0)
     {
         slTime.Value = 0;
         BassLike.PreviousTrack();
         PlayList.Items[Vars.CurrentTrackNumber].Selected = true;
         btnPause.BringToFront();
         labTime.Text      = TimeSpan.FromSeconds(BassLike.GetPosOfStream(BassLike.Stream)).ToString("mm':'ss");
         labTimeLen.Text   = TimeSpan.FromSeconds(BassLike.GetTimeOfStream(BassLike.Stream)).ToString("mm':'ss");
         slTime.Maximum    = BassLike.GetTimeOfStream(BassLike.Stream);
         labTrackInfo.Text = PlayList.Items[Vars.CurrentTrackNumber].Text +
                             "\n" + PlayList.Items[Vars.CurrentTrackNumber].SubItems[1].Text;
     }
 }
예제 #7
0
 private void timer2_Tick(object sender, EventArgs e)
 {
     try
     {
         slTime.Value += TimeShah;
         BassLike.SetPosOfScroll(BassLike.Stream, slTime.Value);
         labTime.Text = TimeSpan.FromSeconds(BassLike.GetPosOfStream(BassLike.Stream)).ToString("mm':'ss");
     }
     catch (ArgumentOutOfRangeException)
     {
         timer2.Enabled = false;
         if (slTime.Value >= slTime.Maximum)
         {
             NextTrack();
             return;
         }
         if (slTime.Value <= slTime.Minimum)
         {
             btnStop_Click(this, null);
         }
     }
 }
예제 #8
0
 private void btnPlay_Click(object sender, EventArgs e)
 {
     if ((PlayList.Items.Count != 0) && (PlayList.SelectedItems.Count == 1))
     {
         string current = Vars.Files[PlayList.Items.IndexOf(PlayList.SelectedItems[0])];
         Vars.CurrentTrackNumber = PlayList.Items.IndexOf(PlayList.SelectedItems[0]);
         if (BassLike.Play(current, BassLike.Volume))
         {
             labTrackInfo.Text = PlayList.Items[Vars.CurrentTrackNumber].Text
                                 + "\n" + PlayList.Items[Vars.CurrentTrackNumber].SubItems[1].Text;
             labTime.Text    = TimeSpan.FromSeconds(BassLike.GetPosOfStream(BassLike.Stream)).ToString("mm':'ss");
             labTimeLen.Text = TimeSpan.FromSeconds(BassLike.GetTimeOfStream(BassLike.Stream)).ToString("mm':'ss");
             slTime.Maximum  = BassLike.GetTimeOfStream(BassLike.Stream);
             slTime.Value    = BassLike.GetPosOfStream(BassLike.Stream);
             timer1.Enabled  = true;
             if (MusicImageList.Images[Vars.CurrentTrackNumber] != null)
             {
                 pictureBox3.Image = MusicImageList.Images[Vars.CurrentTrackNumber];
             }
             btnPause.BringToFront();
         }
     }
 }
예제 #9
0
 private void slVol_Scroll(object sender, ScrollEventArgs e)//изминение ромкости
 {
     BassLike.SetVolumeStream(BassLike.Stream, slVol.Value);
     labTrackVol.Text = slVol.Value.ToString();
 }
예제 #10
0
 private void slTime_Scroll(object sender, ScrollEventArgs e)//изминение позиции трека
 {
     BassLike.SetPosOfScroll(BassLike.Stream, slTime.Value);
     labTime.Text = TimeSpan.FromSeconds(BassLike.GetPosOfStream(BassLike.Stream)).ToString("mm':'ss");
 }
예제 #11
0
 private void btnPause_Click(object sender, EventArgs e)
 {
     BassLike.Pause();
     btnPlay.BringToFront();
 }