Skip to content

Commit 2d8ff80

Browse files
committed
Reset playback time to 0 for single or looping songs
1 parent d910540 commit 2d8ff80

2 files changed

Lines changed: 16 additions & 2 deletions

File tree

AutoMidiPlayer.WPF/AutoMidiPlayer.WPF.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<UseWPF>true</UseWPF>
77
<StartupObject>AutoMidiPlayer.WPF.App</StartupObject>
88
<ApplicationManifest>app.manifest</ApplicationManifest>
9-
<Version>6.12.10</Version>
9+
<Version>6.12.11</Version>
1010
<ApplicationIcon>Resources\logo.ico</ApplicationIcon>
1111
<Nullable>enable</Nullable>
1212
<RepositoryUrl>https://github.com/Jed556/AutoMidiPlayer</RepositoryUrl>

AutoMidiPlayer.WPF/Services/PlaybackService.cs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -816,7 +816,21 @@ public async Task LoadFileAsync(MidiFile file, bool autoPlay = false)
816816
if (Queue.OpenedFile == file && Playback is not null)
817817
{
818818
if (autoPlay && !Playback.IsRunning)
819-
await PlayPause();
819+
{
820+
var playback = Playback;
821+
if (playback is not null)
822+
{
823+
try
824+
{
825+
playback.Stop();
826+
playback.PlaybackStart = null;
827+
playback.MoveToStart();
828+
MoveSlider(TimeSpan.Zero);
829+
await StartPlayback(playback);
830+
}
831+
catch (ObjectDisposedException) { }
832+
}
833+
}
820834
return;
821835
}
822836

0 commit comments

Comments
 (0)