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

@ -351,10 +351,19 @@ namespace PepperDash.Essentials.DM
; ;
}); });
AudioOutputFeedbacks[outputCard.Number] = new IntFeedback(() => AudioOutputFeedbacks[outputCard.Number] = new IntFeedback(() =>
{ {
if (outputCard.AudioOutFeedback != null) { return (ushort)outputCard.AudioOutFeedback.Number; } try
return 0; {
; if (outputCard.AudioOutFeedback != null)
{
return (ushort) outputCard.AudioOutFeedback.Number;
}
return 0;
}
catch (NotSupportedException)
{
return (ushort) outputCard.AudioOutSourceFeedback;
}
}); });
OutputNameFeedbacks[outputCard.Number] = new StringFeedback(() => OutputNameFeedbacks[outputCard.Number] = new StringFeedback(() =>
@ -753,15 +762,31 @@ namespace PepperDash.Essentials.DM
} }
} }
else if (args.EventId == DMOutputEventIds.AudioOutEventId) else if (args.EventId == DMOutputEventIds.AudioOutEventId)
{ {
if (outputCard != null && outputCard.AudioOutFeedback != null) try
{ {
Debug.Console(2, this, "DMSwitchAudio:{0} Routed Input:{1} Output:{2}'", this.Name, outputCard.AudioOutFeedback.Number, output); if (outputCard != null && outputCard.AudioOutFeedback != null)
} {
if (AudioOutputFeedbacks.ContainsKey(output)) Debug.Console(2, this, "DMSwitchAudio:{0} Routed Input:{1} Output:{2}'", this.Name,
{ outputCard.AudioOutFeedback.Number, output);
AudioOutputFeedbacks[output].FireUpdate(); }
} if (AudioOutputFeedbacks.ContainsKey(output))
{
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))