diff --git a/Lib.Audio/Channel.cs b/Lib.Audio/Channel.cs index b6651c0..8f12fe1 100644 --- a/Lib.Audio/Channel.cs +++ b/Lib.Audio/Channel.cs @@ -72,7 +72,7 @@ namespace Lib.Audio ToggleSelectButtonLed(); if (Controllable.IsValid) - InitializeFader(controllable); + InitializeFader(); } private void UnMapControllable() @@ -124,12 +124,12 @@ namespace Lib.Audio _acknowledgeMessage = null; } - private void InitializeFader(IControllable controllable) + private void InitializeFader() { - if (Fader == null) + if (Fader == null || Controllable == null) return; - float volume = controllable.GetVolume(); + float volume = Controllable.GetVolume(); Fader.RelativePosition = volume; _midiCommunication.Send(new PitchWheelChangeMessage(0, _channelNumber, Fader.Position)); @@ -161,6 +161,8 @@ namespace Lib.Audio return; Controllable = _controllableCollector.GetControllableForExecutable(Controllable.ExecutablePath); + if (Controllable != null) + InitializeFader(); } private void OnProcessManagerProcessExited(object? sender, IObservedProcess process)