diff options
Diffstat (limited to 'ShiftOS.WinForms/Applications/AudioPlayer.cs')
| -rw-r--r-- | ShiftOS.WinForms/Applications/AudioPlayer.cs | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/ShiftOS.WinForms/Applications/AudioPlayer.cs b/ShiftOS.WinForms/Applications/AudioPlayer.cs index 3edf965..28e1c56 100644 --- a/ShiftOS.WinForms/Applications/AudioPlayer.cs +++ b/ShiftOS.WinForms/Applications/AudioPlayer.cs @@ -160,6 +160,23 @@ namespace ShiftOS.WinForms.Applications })); Thread.Sleep(50); } + if (o.PlaybackState == NAudio.Wave.PlaybackState.Stopped) + { + if (lbtracks.SelectedIndex < lbtracks.Items.Count - 1) + { + this.Invoke(new Action(() => + { + lbtracks.SelectedIndex++; + })); + } + else if(loopToolStripMenuItem.Checked == true) + { + this.Invoke(new Action(() => + { + lbtracks.SelectedIndex = 0; + })); + } + } }).Start(); } @@ -171,6 +188,41 @@ namespace ShiftOS.WinForms.Applications } catch { } } + + bool scrubbing = false; + + private void startScrub(object sender, MouseEventArgs e) + { + scrubbing = true; + } + + static public double linear(double x, double x0, double x1, double y0, double y1) + { + if ((x1 - x0) == 0) + { + return (y0 + y1) / 2; + } + return y0 + (x - x0) * (y1 - y0) / (x1 - x0); + } + + private void pgplaytime_MouseMove(object sender, MouseEventArgs e) + { + if (mp3 != null) + try + { + if (scrubbing) + { + long s_pos = (long)linear(e.X, 0, pgplaytime.Width, 0, (double)mp3.Length); + mp3.Position = s_pos; + } + } + catch { } + } + + private void pgplaytime_MouseUp(object sender, MouseEventArgs e) + { + scrubbing = false; + } } public static class ListExtensions |
