Ejemplo n.º 1
0
 public void UpdateGUIStatus(PlayerProgressInformation info)
 {
     this.mainArtistLabel.Text = info.artist;
     this.mainTrackLabel.Text = info.track;
     this.mainProgressLabel.Text = (info.currentPosition / 60) + ":" + ((""+(info.currentPosition % 60)).PadLeft(2,'0'));
     reflectPlayerStateInGUI(info.state);
 }
Ejemplo n.º 2
0
        void BassTimer_Tick(object sender, EventArgs e)
        {


            PlayerProgressInformation progress = new PlayerProgressInformation();
            BASSActive state = Bass.BASS_ChannelIsActive(BassStream);
            if (state == BASSActive.BASS_ACTIVE_PLAYING)
            {
                progress.state = PlayState.PLAYING;
            }
            else if (state == BASSActive.BASS_ACTIVE_PAUSED)
            {
                progress.state = PlayState.PAUSED;
            }
            else if (state == BASSActive.BASS_ACTIVE_STOPPED)
            {
                progress.state = PlayState.STOPPED;
            }
            else if (state == BASSActive.BASS_ACTIVE_STALLED)
            {
                progress.state = PlayState.STALLED;
            }

            if (TagInfo != null)
            {
                progress.artist = TagInfo.artist;
                progress.track = TagInfo.title;
            }
            double totaltime, elapsedtime;
            if (state != BASSActive.BASS_ACTIVE_STOPPED)
            {
                long pos = Bass.BASS_ChannelGetPosition(BassStream); // position in bytes
                long len = Bass.BASS_ChannelGetLength(BassStream); // length in bytes
                totaltime = Bass.BASS_ChannelBytes2Seconds(BassStream, len); // the total time length
                elapsedtime = Bass.BASS_ChannelBytes2Seconds(BassStream, pos); // the elapsed time length
            }
            else
            {
                totaltime = elapsedtime = 0;
            }

            

            progress.totalLength = (int)totaltime;
            progress.currentPosition = (int)elapsedtime;


            Program.playerWindow.Invoke(new neprostopleer.PlayerWindow.UpdateGUIStatusDelegate(Program.playerWindow.UpdateGUIStatus), new object[] { progress });

            if (Bass.BASS_ChannelIsActive(BassStream) != BASSActive.BASS_ACTIVE_PLAYING)
            {
                BassTimer.Stop();
            }
        }