Skip to content

Commit

Permalink
feat: add none input for matrix routing
Browse files Browse the repository at this point in the history
  • Loading branch information
andrew-welker committed Apr 9, 2024
1 parent 771ed7d commit 50f456d
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/NvxEpi/Features/Routing/NvxGlobalRouter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,9 @@ private void BuildMatrixRouting()
.Cast<IRoutingInputSlot>()
.ToDictionary(i => i.Key, i => i);

var clearInput = new NvxMatrixClearInput();
InputSlots.Add(clearInput.Key, clearInput);

var transmitters = DeviceManager.AllDevices
.OfType<NvxBaseDevice>()
.Where(t =>
Expand Down
25 changes: 25 additions & 0 deletions src/NvxEpi/Features/Routing/NvxMatrixClearInput.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.Routing;
using System;

namespace NvxEpi.Features.Routing
{
public class NvxMatrixClearInput : IRoutingInputSlot
{
public string TxDeviceKey => string.Empty;

public int SlotNumber => 0;

public eRoutingSignalType SupportedSignalTypes => eRoutingSignalType.AudioVideo;

public string Name => "None";

public BoolFeedback IsOnline => new BoolFeedback(() => false);

public bool VideoSyncDetected => false;

public string Key => "none";

public event EventHandler VideoSyncChanged;
}
}
6 changes: 5 additions & 1 deletion src/NvxEpi/Features/Routing/NvxMatrixOutput.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public NvxMatrixOutput(NvxBaseDevice device)
_device.CurrentSecondaryAudioStreamId.OutputChange += OnSecondaryAudioOutputChange;
} catch (Exception ex)
{
Debug.LogMessage(ex, "Exception creating NvxMatrixOuput {ex}", this, ex.Message);
Debug.LogMessage(ex, "Exception creating NvxMatrixOutput {ex}", this, ex.Message);
}
}

Expand All @@ -47,6 +47,8 @@ private void OnPrimaryOutputChange(object sender, FeedbackEventArgs args)

var inputSlot = parent.InputSlots.Values.FirstOrDefault(input => input.SlotNumber == args.IntValue);

Debug.LogMessage(Serilog.Events.LogEventLevel.Verbose, "Video: Found input slot {inputSlot} for {inputNumber}", this, inputSlot?.Key ?? "null", args.IntValue);

SetInputRoute(eRoutingSignalType.Video, inputSlot);

if (!_device.IsStreamingSecondaryAudio.BoolValue)
Expand All @@ -61,6 +63,8 @@ private void OnSecondaryAudioOutputChange(object sender, FeedbackEventArgs args)

var inputSlot = parent.InputSlots.Values.FirstOrDefault(input => input.SlotNumber == args.IntValue);

Debug.LogMessage(Serilog.Events.LogEventLevel.Verbose, "Audio: Found input slot {inputSlot} for {inputNumber}", this, inputSlot?.Key ?? "null", args.IntValue);

SetInputRoute(eRoutingSignalType.SecondaryAudio, inputSlot);
SetInputRoute(eRoutingSignalType.Audio, inputSlot);
}
Expand Down

0 comments on commit 50f456d

Please sign in to comment.