private void Timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e) { if (_waveSource != null) { Position = _waveSource.GetPosition(); } }
//Timer private void timer_Tick(object sender, EventArgs e) { //Start progressBar.Maximum = length; progressBar.Value = (int)audio.GetPosition().TotalSeconds; //Label label_progress.Text = ""; if (progressBar.Value / 60 < 10) { label_progress.Text += "0" + progressBar.Value / 60 + ":"; } else { label_progress.Text += progressBar.Value / 60 + ":"; } if (progressBar.Value % 60 < 10) { label_progress.Text += "0" + progressBar.Value % 60; } else { label_progress.Text += progressBar.Value % 60; } //End if (progressBar.Value == length) { timer.Stop(); } }
private void UpdateMillis() { lastMillis = CurrentMillis; if (currentMusic != null) { CurrentMillis = (int)currentMusic.GetPosition().TotalMilliseconds; } // Console.WriteLine(currentMillis); }
public int TimeLeftms(AudioData audio) { IWaveSource ws = audio.data as IWaveSource; System.Diagnostics.Debug.Assert(ws != null); TimeSpan l = ws.GetLength(); TimeSpan p = ws.GetPosition(); TimeSpan togo = l - p; return((int)togo.TotalMilliseconds); }
public TimeSpan Posicion() { if (FormatoSonido != FormatoSonido.CDA) { return(_sound.GetPosition()); } else { return(SectoresATimeSpan(_sound.Position)); } }
private void CountTimerDelegate() { double totalMS = iws.GetLength().TotalMilliseconds; while (iws.GetPosition().TotalMilliseconds <= totalMS) { if (isPlaying) { AudioDelegations.PostionChanged?.Invoke(iws.GetPosition()); LyricToken lt; if ((lt = lEnum.Enumerating(iws.GetPosition())) != null) { AudioDelegations.LyricUpdated?.Invoke(lt); } } Thread.Sleep(1000); } isPlaying = false; AudioDelegations.PlayingFinished?.Invoke(); }
private void timer_setPos_Tick(object sender, EventArgs e) { if (waveSource == null) { return; } if (soundOut == null) { return; } if (soundOut.PlaybackState != PlaybackState.Playing) { return; } tbar_pos.Value = (int)waveSource.GetPosition().TotalMilliseconds; // Lyric Sync for (int i = 0; i < lbox_lrc.Items.Count; i++) { string txt = (string)lbox_lrc.Items[i]; var time = GetLrcTimeCode(txt); if (!time.HasValue) { continue; } if (time.Value >= waveSource.GetPosition()) { lbl_lrc_p.Text = (i > 1 ? GetPureLyric((string)lbox_lrc.Items[i - 2]) : string.Empty); lbl_lrc_c.Text = (i > 0 ? GetPureLyric((string)lbox_lrc.Items[i - 1]) : "Start of File"); lbl_lrc_n.Text = GetPureLyric(txt); return; } } }
public TimeSpan Posicion() { return(_sonido.GetPosition()); }