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; } }
private void Form1_Load(object sender, System.EventArgs e) { player = new ZPlay(); ReverseMode = false; Echo = false; int left = 0; int right = 0; player.GetMasterVolume(ref left, ref right); leftmastervolume.Value = 100 - left; rightmastervolume.Value = 100 - right; player.GetPlayerVolume(ref left, ref right); leftplayervolume.Value = 100 - left; rightplayervolume.Value = 100 - right; // callback CallbackFunc = new TCallbackFunc(MyCallbackFunc); player.SetCallbackFunc(CallbackFunc, (TCallbackMessage)((TCallbackMessage.MsgEnterVolumeSlideAsync | TCallbackMessage.MsgExitVolumeSlideAsync | TCallbackMessage.MsgStreamBufferDoneAsync | TCallbackMessage.MsgNextSongAsync )), 0); // echo TEchoEffect[] effect = new TEchoEffect[2]; effect[0].nLeftDelay = 500; effect[0].nLeftSrcVolume = 50; effect[0].nLeftEchoVolume = 30; effect[0].nRightDelay = 500; effect[0].nRightSrcVolume = 50; effect[0].nRightEchoVolume = 30; effect[1].nLeftDelay = 30; effect[1].nLeftSrcVolume = 50; effect[1].nLeftEchoVolume = 30; effect[1].nRightDelay = 30; effect[1].nRightSrcVolume = 50; effect[1].nRightEchoVolume = 30; player.SetEchoParam(ref effect, 2); /* TEchoEffect[] test1 = new TEchoEffect[2]; int n = player.GetEchoParam(ref test1); int i; for (i = 0; i < n; i++) { MessageBox.Show(test1[i].nLeftDelay.ToString()); } */ /* int[] EqPoints = new int[9] { 100, 200, 300, 1000, 2000, 3000, 5000, 7000, 12000 }; player.SetEqualizerPoints(ref EqPoints, 9); */ /* int[] testeq = new int[1]; int num = player.GetEqualizerPoints(ref testeq); int i1; for (i1 = 0; i1 < num; i1++) { MessageBox.Show(testeq[i1].ToString ()); } */ /* TWaveOutInfo WaveOutInfo = new TWaveOutInfo(); int WaveOutNum = player.EnumerateWaveOut(); uint i; for (i = 0; i < WaveOutNum; i++) { if (player.GetWaveOutInfo(i, ref WaveOutInfo)) { MessageBox.Show(WaveOutInfo.ProductName ); } } */ ComboBox1.SelectedIndex = 0; ComboBox2.SelectedIndex = 7; ComboBox3.SelectedIndex = 11; ComboBox4.SelectedIndex = 0; ComboBox5.SelectedIndex = 0; if (My.MyApplication.Application.CommandLineArgs.Count != 0) { player.Close(); if (LoadMode == 0) { if (!(player.OpenFile(My.MyApplication.Application.CommandLineArgs[0], TStreamFormat.sfAutodetect))) { MessageBox.Show(player.GetError(), string.Empty, MessageBoxButtons.OK, MessageBoxIcon.Error); } } showinfo(); player.StartPlayback(); } }