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:
@@ -1,3 +1,4 @@
|
|||||||
|
using System.Threading.Tasks;
|
||||||
using Content.Client.GameObjects.Components.Instruments;
|
using Content.Client.GameObjects.Components.Instruments;
|
||||||
using Content.Client.UserInterface.Stylesheets;
|
using Content.Client.UserInterface.Stylesheets;
|
||||||
using Robust.Client.Audio.Midi;
|
using Robust.Client.Audio.Midi;
|
||||||
@@ -10,6 +11,7 @@ using Robust.Shared.IoC;
|
|||||||
using Robust.Shared.Localization;
|
using Robust.Shared.Localization;
|
||||||
using Robust.Shared.Log;
|
using Robust.Shared.Log;
|
||||||
using Robust.Shared.Maths;
|
using Robust.Shared.Maths;
|
||||||
|
using Robust.Shared.Timers;
|
||||||
|
|
||||||
namespace Content.Client.Instruments
|
namespace Content.Client.Instruments
|
||||||
{
|
{
|
||||||
@@ -174,7 +176,7 @@ namespace Content.Client.Instruments
|
|||||||
var filters = new FileDialogFilters(new FileDialogFilters.Group("mid", "midi"));
|
var filters = new FileDialogFilters(new FileDialogFilters.Group("mid", "midi"));
|
||||||
var filename = await _fileDialogManager.OpenFile(filters);
|
var filename = await _fileDialogManager.OpenFile(filters);
|
||||||
|
|
||||||
if (filename == null) return;
|
if (string.IsNullOrEmpty(filename)) return;
|
||||||
|
|
||||||
if (!_midiManager.IsMidiFile(filename))
|
if (!_midiManager.IsMidiFile(filename))
|
||||||
{
|
{
|
||||||
@@ -183,6 +185,7 @@ namespace Content.Client.Instruments
|
|||||||
}
|
}
|
||||||
|
|
||||||
MidiStopButtonOnPressed(null);
|
MidiStopButtonOnPressed(null);
|
||||||
|
await Timer.Delay(100);
|
||||||
if (!_owner.Instrument.OpenMidi(filename)) return;
|
if (!_owner.Instrument.OpenMidi(filename)) return;
|
||||||
MidiPlaybackSetButtonsDisabled(false);
|
MidiPlaybackSetButtonsDisabled(false);
|
||||||
if (midiInputButton.Pressed)
|
if (midiInputButton.Pressed)
|
||||||
|
|||||||
Reference in New Issue
Block a user