Compare commits

...

1 Commits

2 changed files with 76 additions and 60 deletions

View File

@@ -411,19 +411,28 @@ namespace PepperDash.Essentials.DM
public void SetVolumeScaled(ushort level) public void SetVolumeScaled(ushort level)
{ {
Debug.Console(2, Debug.ErrorLogLevel.None, "Scaling DMPS volume:{0} level:{1} min:{2} max:{3}", Output.Name, level.ToString(), MinLevel.ToString(), MaxLevel.ToString()); Debug.Console(2, Debug.ErrorLogLevel.None, "Scaling DMPS volume:{0} level:{1} min:{2} max:{3}", Output.Name, level.ToString(), MinLevel.ToString(), MaxLevel.ToString());
if (ushort.MaxValue + MinLevel != 0)
{
VolumeLevelInput = (ushort)(level * (MaxLevel - MinLevel) / ushort.MaxValue + MinLevel); VolumeLevelInput = (ushort)(level * (MaxLevel - MinLevel) / ushort.MaxValue + MinLevel);
if (EnableVolumeSend == true) if (EnableVolumeSend == true)
{ {
Level.UShortValue = VolumeLevelInput; Level.UShortValue = VolumeLevelInput;
} }
} }
}
public ushort ScaleVolumeFeedback(ushort level) public ushort ScaleVolumeFeedback(ushort level)
{ {
short signedLevel = (short)level; short signedLevel = (short)level;
Debug.Console(2, Debug.ErrorLogLevel.None, "Scaling DMPS volume:{0} feedback:{1} min:{2} max:{3}", Output.Name, signedLevel.ToString(), MinLevel.ToString(), MaxLevel.ToString()); Debug.Console(2, Debug.ErrorLogLevel.None, "Scaling DMPS volume:{0} feedback:{1} min:{2} max:{3}", Output.Name, signedLevel.ToString(), MinLevel.ToString(), MaxLevel.ToString());
if (MaxLevel - MinLevel != 0)
{
return (ushort)((signedLevel - MinLevel) * ushort.MaxValue / (MaxLevel - MinLevel)); return (ushort)((signedLevel - MinLevel) * ushort.MaxValue / (MaxLevel - MinLevel));
} }
else
return (ushort)MinLevel;
}
public void SendScaledVolume(bool pressRelease) public void SendScaledVolume(bool pressRelease)
{ {

View File

@@ -480,6 +480,8 @@ namespace PepperDash.Essentials.DM
void SetupOutputCards() void SetupOutputCards()
{ {
foreach (var card in Dmps.SwitcherOutputs) foreach (var card in Dmps.SwitcherOutputs)
{
try
{ {
Debug.Console(1, this, "Output Card Type: {0}", card.CardInputOutputType); Debug.Console(1, this, "Output Card Type: {0}", card.CardInputOutputType);
@@ -504,13 +506,13 @@ namespace PepperDash.Essentials.DM
{ {
if (outputCard.AudioOutFeedback != null) if (outputCard.AudioOutFeedback != null)
{ {
return (ushort) outputCard.AudioOutFeedback.Number; return (ushort)outputCard.AudioOutFeedback.Number;
} }
return 0; return 0;
} }
catch (NotSupportedException) catch (NotSupportedException)
{ {
return (ushort) outputCard.AudioOutSourceFeedback; return (ushort)outputCard.AudioOutSourceFeedback;
} }
}); });
@@ -545,6 +547,11 @@ namespace PepperDash.Essentials.DM
AddOutputCard(outputCard.Number, outputCard); AddOutputCard(outputCard.Number, outputCard);
} }
catch (Exception ex)
{
Debug.LogError(Debug.ErrorLogLevel.Error, string.Format("DMPS Controller exception creating output card: {0}", ex));
}
}
} }
/// <summary> /// <summary>