update output change event & feedbacks

This commit is contained in:
Andrew Welker
2020-11-03 08:30:13 -07:00
parent b457886ee3
commit 3cd8a1f310

View File

@@ -352,9 +352,18 @@ namespace PepperDash.Essentials.DM
}); });
AudioOutputFeedbacks[outputCard.Number] = new IntFeedback(() => AudioOutputFeedbacks[outputCard.Number] = new IntFeedback(() =>
{ {
if (outputCard.AudioOutFeedback != null) { return (ushort)outputCard.AudioOutFeedback.Number; } try
{
if (outputCard.AudioOutFeedback != null)
{
return (ushort) outputCard.AudioOutFeedback.Number;
}
return 0; return 0;
; }
catch (NotSupportedException)
{
return (ushort) outputCard.AudioOutSourceFeedback;
}
}); });
OutputNameFeedbacks[outputCard.Number] = new StringFeedback(() => OutputNameFeedbacks[outputCard.Number] = new StringFeedback(() =>
@@ -753,16 +762,32 @@ namespace PepperDash.Essentials.DM
} }
} }
else if (args.EventId == DMOutputEventIds.AudioOutEventId) else if (args.EventId == DMOutputEventIds.AudioOutEventId)
{
try
{ {
if (outputCard != null && outputCard.AudioOutFeedback != null) if (outputCard != null && outputCard.AudioOutFeedback != null)
{ {
Debug.Console(2, this, "DMSwitchAudio:{0} Routed Input:{1} Output:{2}'", this.Name, outputCard.AudioOutFeedback.Number, output); Debug.Console(2, this, "DMSwitchAudio:{0} Routed Input:{1} Output:{2}'", this.Name,
outputCard.AudioOutFeedback.Number, output);
} }
if (AudioOutputFeedbacks.ContainsKey(output)) if (AudioOutputFeedbacks.ContainsKey(output))
{ {
AudioOutputFeedbacks[output].FireUpdate(); AudioOutputFeedbacks[output].FireUpdate();
} }
} }
catch (NotSupportedException)
{
if (outputCard != null)
{
Debug.Console(2, this, "DMSwitchAudio:{0} Routed Input:{1} Output:{2}'", Name,
outputCard.AudioOutSourceFeedback, output);
}
if (AudioOutputFeedbacks.ContainsKey(output))
{
AudioOutputFeedbacks[output].FireUpdate();
}
}
}
else if (args.EventId == DMOutputEventIds.OutputNameEventId else if (args.EventId == DMOutputEventIds.OutputNameEventId
&& OutputNameFeedbacks.ContainsKey(output)) && OutputNameFeedbacks.ContainsKey(output))
{ {