mirror of
https://github.com/space-syndicate/space-station-14.git
synced 2026-10-09 10:21:18 +03:00
Fix bug where choosing a MIDI song while one was already playing broke MIDI
We just delay playing the new song 0.1 seconds.
This commit is contained in:
parent
a89e806a50
commit
365a050e70
1 changed files with 4 additions and 1 deletions
|
|
@ -1,3 +1,4 @@
|
|||
using System.Threading.Tasks;
|
||||
using Content.Client.GameObjects.Components.Instruments;
|
||||
using Content.Client.UserInterface.Stylesheets;
|
||||
using Robust.Client.Audio.Midi;
|
||||
|
|
@ -10,6 +11,7 @@ using Robust.Shared.IoC;
|
|||
using Robust.Shared.Localization;
|
||||
using Robust.Shared.Log;
|
||||
using Robust.Shared.Maths;
|
||||
using Robust.Shared.Timers;
|
||||
|
||||
namespace Content.Client.Instruments
|
||||
{
|
||||
|
|
@ -174,7 +176,7 @@ namespace Content.Client.Instruments
|
|||
var filters = new FileDialogFilters(new FileDialogFilters.Group("mid", "midi"));
|
||||
var filename = await _fileDialogManager.OpenFile(filters);
|
||||
|
||||
if (filename == null) return;
|
||||
if (string.IsNullOrEmpty(filename)) return;
|
||||
|
||||
if (!_midiManager.IsMidiFile(filename))
|
||||
{
|
||||
|
|
@ -183,6 +185,7 @@ namespace Content.Client.Instruments
|
|||
}
|
||||
|
||||
MidiStopButtonOnPressed(null);
|
||||
await Timer.Delay(100);
|
||||
if (!_owner.Instrument.OpenMidi(filename)) return;
|
||||
MidiPlaybackSetButtonsDisabled(false);
|
||||
if (midiInputButton.Pressed)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue