Beispiel #1
0
        private void Update(object sender, EventArgs e)
        {
            TimeSpan    ts, ts2;
            TStreamTime pos  = new TStreamTime();
            TStreamInfo info = new TStreamInfo();
            TStreamTime time = new TStreamTime();

            player2.GetPosition(ref pos);
            player2.GetStreamInfo(ref info);
            time = info.Length;
            ts   = TimeSpan.FromSeconds(Convert.ToDouble(pos.sec.ToString()));
            ts2  = TimeSpan.FromSeconds(Convert.ToDouble(time.sec.ToString()));

            if (Convert.ToInt32(time.sec) > 0)
            {
                if (Convert.ToInt32(time.sec) - Convert.ToInt32(pos.sec) <= 0)
                {
                    frm1.Invoke((MethodInvoker) delegate
                    {
                        frm1.Forward();
                    });
                }
                Form1.ChangeNameLabel(ts + "/" + ts2);
                Form1.ChangePositionBar(Convert.ToInt32(pos.sec) * 100 / Convert.ToInt32(time.sec));
            }
        }
Beispiel #2
0
        private TStreamTime GetPosition(ref ZPlay player)
        {
            TStreamTime position = new TStreamTime();

            player?.GetPosition(ref position);

            return(position);
        }
        static void Main(string[] args)
        {
            Console.WriteLine("Playing test.mp3. Press Q to quit.\n");
            // create ZPlay class
            ZPlay player = new ZPlay();

            // open file
            if (player.AddFile("1.mp3", TStreamFormat.sfAutodetect) == false)
            {
                Console.WriteLine(player.GetError());
                return;
            }


            // get song length
            TStreamInfo info = new TStreamInfo();

            player.GetStreamInfo(ref info);
            Console.WriteLine("Length: {0:G}:{1:G}:{2:G}:{3:G}",
                              info.Length.hms.hour,
                              info.Length.hms.minute,
                              info.Length.hms.second,
                              info.Length.hms.millisecond);

            // start playing
            player.StartPlayback();

            TStreamStatus status = new TStreamStatus();
            TStreamTime   time   = new TStreamTime();

            status.fPlay = true;

            while (status.fPlay)
            {
                player.GetPosition(ref time);
                Console.Write("Pos: {0:G}:{1:G}:{2:G}:{3:G}\r",
                              time.hms.hour,
                              time.hms.minute,
                              time.hms.second,
                              time.hms.millisecond);
                player.GetStatus(ref status);
                System.Threading.Thread.Sleep(50);
                if (Console.KeyAvailable)
                {
                    var cki = Console.ReadKey(true);
                    if (cki.Key == ConsoleKey.Q)
                    {
                        player.StopPlayback();
                    }
                }
            }
        }
Beispiel #4
0
		private void Timer1_Tick(object sender, System.EventArgs e)
		{
            TStreamTime pos = new TStreamTime();

            player.GetPosition(ref pos);

            if(ProgressBar1.Maximum > pos.sec)
			    ProgressBar1.Value = System.Convert.ToInt32((int)(pos.sec));


		
            position.Text = System.String.Format("{0,2:G}", pos.hms.hour) + " : " + System.String.Format("{0,2:G}", pos.hms.minute) + " : " + System.String.Format("{0,2:G}", pos.hms.second) + " : " + System.String.Format("{0,3:G}", pos.hms.millisecond);
          

			TStreamStatus Status = new TStreamStatus();
			player.GetStatus(ref Status);

			statuslabel1.Text = "Eq:" + System.Environment.NewLine + "Fade:" + System.Environment.NewLine + "Echo:" + System.Environment.NewLine + "Bitrate:" + System.Environment.NewLine + "Vocal cut:" + System.Environment.NewLine + "Side cut:";

			statuslabel2.Text = "Loop:" + System.Environment.NewLine + "Reverse:" + System.Environment.NewLine + "Play:" + System.Environment.NewLine + "Pause:" + System.Environment.NewLine + "Channel mix:" + System.Environment.NewLine + "Load:";

			statusvalue1.Text = System.Convert.ToString(Status.fEqualizer) + System.Environment.NewLine + System.Convert.ToString(Status.fSlideVolume) + System.Environment.NewLine + System.Convert.ToString(Status.fEcho) + System.Environment.NewLine + System.Convert.ToString(player.GetBitrate(false)) + System.Environment.NewLine + System.Convert.ToString(Status.fVocalCut) + System.Environment.NewLine + System.Convert.ToString(Status.fSideCut);

			TStreamLoadInfo load = new TStreamLoadInfo();
			player.GetDynamicStreamLoad(ref load);
			statusvalue2.Text = System.Convert.ToString(Status.nLoop) + System.Environment.NewLine + System.Convert.ToString(Status.fReverse) + System.Environment.NewLine + System.Convert.ToString(Status.fPlay) + System.Environment.NewLine + System.Convert.ToString(Status.fPause) + System.Environment.NewLine + System.Convert.ToString(Status.fChannelMix) + System.Environment.NewLine + System.Convert.ToString(load.NumberOfBuffers);
            
			if (Status.fSlideVolume != false)
			{
                BlockLeft = true;
                BlockRight = true;

                int Left = 0;
                int Right = 0;
                player.GetPlayerVolume(ref Left, ref Right);

				leftplayervolume.Value = 100 - Left;
				rightplayervolume.Value = 100 - Right;
                
			}
            
			if (FadeFinished)
			{
                int Left = 0;
                int Right = 0;
                player.GetPlayerVolume(ref Left, ref Right);

                leftplayervolume.Value = 100 - Left;
                rightplayervolume.Value = 100 - Right;
				FadeFinished = false;
			}
            

            if(NextSong)
            {
                showinfo();
                NextSong = false;
            }
       


		}