public InstrumentMenu(InstrumentBoundUserInterface owner)
        {
            RobustXamlLoader.Load(this);
            IoCManager.InjectDependencies(this);

            _owner = owner;

            _owner.Instrument.OnMidiPlaybackEnded += InstrumentOnMidiPlaybackEnded;

            Title = _owner.Instrument.Owner.Name;

            LoopButton.Disabled        = !_owner.Instrument.IsMidiOpen;
            LoopButton.Pressed         = _owner.Instrument.LoopMidi;
            StopButton.Disabled        = !_owner.Instrument.IsMidiOpen;
            PlaybackSlider.MouseFilter = _owner.Instrument.IsMidiOpen ? MouseFilterMode.Pass : MouseFilterMode.Ignore;

            if (!_midiManager.IsAvailable)
            {
                Margin.AddChild(new PanelContainer
                {
                    MouseFilter   = MouseFilterMode.Stop,
                    PanelOverride = new StyleBoxFlat {
                        BackgroundColor = Color.Black.WithAlpha(0.90f)
                    },
                    Children =
                    {
                        new Label
                        {
                            Align               = Label.AlignMode.Center,
                            SizeFlagsVertical   = SizeFlags.ShrinkCenter,
                            SizeFlagsHorizontal = SizeFlags.ShrinkCenter,
                            StyleClasses        = { StyleNano.StyleClassLabelBig },
                            Text = Loc.GetString("MIDI support is currently\nnot available on your platform.")
                        }
                    }
                });

                // We return early as to not give the buttons behavior.
                return;
            }

            InputButton.OnToggled         += MidiInputButtonOnOnToggled;
            FileButton.OnPressed          += MidiFileButtonOnOnPressed;
            LoopButton.OnToggled          += MidiLoopButtonOnOnToggled;
            StopButton.OnPressed          += MidiStopButtonOnPressed;
            PlaybackSlider.OnValueChanged += PlaybackSliderSeek;
            PlaybackSlider.OnKeyBindUp    += PlaybackSliderKeyUp;
        }