- initialize fader for newly found process

master
Simon G 5 years ago
parent ddd68e7377
commit 971922272e
  1. 10
      Lib.Audio/Channel.cs

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

Loading…
Cancel
Save