private void updateTimeControls(int current, int max) { max = (int)SynthHelper.TimeFromSamples(Properties.Settings.Default.SampleRate, max); current = (int)SynthHelper.TimeFromSamples(Properties.Settings.Default.SampleRate, current); current = Math.Min(max, current); if (trackBar1.Maximum != max) { trackBar1.Maximum = max; trackBar1.TickFrequency = Math.Max(1, trackBar1.Maximum / 20); } trackBar1.Value = current; label1.Text = new TimeSpan(0, 0, current).ToString(@"mm\:ss") + "/" + new TimeSpan(0, 0, max).ToString(@"mm\:ss"); }