mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-01-27 11:24:55 +00:00
More dmps work
This commit is contained in:
@@ -29,6 +29,10 @@ namespace PepperDash.Essentials.Core.Bridges
|
||||
public JoinDataComplete MasterVolumeDown = new JoinDataComplete(new JoinData { JoinNumber = 4, JoinSpan = 1 },
|
||||
new JoinMetadata { Description = "Master Volume Level Down", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
||||
|
||||
[JoinName("MasterVolumeLevelScaledSend")]
|
||||
public JoinDataComplete MasterVolumeLevelScaledSend = new JoinDataComplete(new JoinData { JoinNumber = 5, JoinSpan = 1 },
|
||||
new JoinMetadata { Description = "Master Volume Scaled Send", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
||||
|
||||
[JoinName("SourceVolumeLevel")]
|
||||
public JoinDataComplete SourceVolumeLevel = new JoinDataComplete(new JoinData { JoinNumber = 11, JoinSpan = 1 },
|
||||
new JoinMetadata { Description = "Source Volume Signed dB Set / Get", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Analog });
|
||||
|
||||
@@ -4,6 +4,10 @@ namespace PepperDash.Essentials.Core.Bridges
|
||||
{
|
||||
public class DmpsRoutingControllerJoinMap : JoinMapBaseAdvanced
|
||||
{
|
||||
[JoinName("EnableRouting")]
|
||||
public JoinDataComplete EnableRouting = new JoinDataComplete(new JoinData { JoinNumber = 1, JoinSpan = 1 },
|
||||
new JoinMetadata { Description = "DMPS Enable Audio and Video Routing", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
|
||||
|
||||
[JoinName("SystemPowerOn")]
|
||||
public JoinDataComplete SystemPowerOn = new JoinDataComplete(new JoinData { JoinNumber = 12, JoinSpan = 1 },
|
||||
new JoinMetadata { Description = "DMPS System Power On Get/Set", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital });
|
||||
|
||||
@@ -43,8 +43,6 @@ namespace PepperDash.Essentials.DM
|
||||
MicsMasterVolumeLevel = new DmpsAudioOutput(card, eDmpsLevelType.MicsMaster);
|
||||
Codec1VolumeLevel = new DmpsAudioOutput(card, eDmpsLevelType.Codec1);
|
||||
Codec2VolumeLevel = new DmpsAudioOutput(card, eDmpsLevelType.Codec2);
|
||||
((DmpsAudioOutputWithMixer)MasterVolumeLevel).GetVolumeMax();
|
||||
((DmpsAudioOutputWithMixer)MasterVolumeLevel).GetVolumeMin();
|
||||
}
|
||||
else if (card is Card.Dmps3Aux1Output)
|
||||
{
|
||||
@@ -52,8 +50,6 @@ namespace PepperDash.Essentials.DM
|
||||
SourceVolumeLevel = new DmpsAudioOutput(card, eDmpsLevelType.Source);
|
||||
MicsMasterVolumeLevel = new DmpsAudioOutput(card, eDmpsLevelType.MicsMaster);
|
||||
Codec2VolumeLevel = new DmpsAudioOutput(card, eDmpsLevelType.Codec2);
|
||||
((DmpsAudioOutputWithMixer)MasterVolumeLevel).GetVolumeMax();
|
||||
((DmpsAudioOutputWithMixer)MasterVolumeLevel).GetVolumeMin();
|
||||
}
|
||||
else if (card is Card.Dmps3Aux2Output)
|
||||
{
|
||||
@@ -61,8 +57,6 @@ namespace PepperDash.Essentials.DM
|
||||
SourceVolumeLevel = new DmpsAudioOutput(card, eDmpsLevelType.Source);
|
||||
MicsMasterVolumeLevel = new DmpsAudioOutput(card, eDmpsLevelType.MicsMaster);
|
||||
Codec1VolumeLevel = new DmpsAudioOutput(card, eDmpsLevelType.Codec1);
|
||||
((DmpsAudioOutputWithMixer)MasterVolumeLevel).GetVolumeMax();
|
||||
((DmpsAudioOutputWithMixer)MasterVolumeLevel).GetVolumeMin();
|
||||
}
|
||||
else //Digital Outputs
|
||||
{
|
||||
@@ -166,11 +160,6 @@ namespace PepperDash.Essentials.DM
|
||||
{
|
||||
var joinMap = new DmpsAudioOutputControllerJoinMap(joinStart);
|
||||
|
||||
var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey);
|
||||
|
||||
if (!string.IsNullOrEmpty(joinMapSerialized))
|
||||
joinMap = JsonConvert.DeserializeObject<DmpsAudioOutputControllerJoinMap>(joinMapSerialized);
|
||||
|
||||
if (bridge != null)
|
||||
{
|
||||
bridge.AddJoinMap(Key, joinMap);
|
||||
@@ -206,22 +195,19 @@ namespace PepperDash.Essentials.DM
|
||||
{
|
||||
SetUpDmpsAudioOutputJoins(trilist, Codec2VolumeLevel, joinMap.Codec2VolumeLevel.JoinNumber);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static void SetUpDmpsAudioOutputJoins(BasicTriList trilist, DmpsAudioOutput output, uint joinStart)
|
||||
{
|
||||
var volumeLevelJoin = joinStart;
|
||||
var volumeLevelScaledJoin = joinStart + 1;
|
||||
var volumeLevelScaledJoin = joinStart + 1;
|
||||
var muteOnJoin = joinStart;
|
||||
var muteOffJoin = joinStart + 1;
|
||||
var volumeUpJoin = joinStart + 2;
|
||||
var volumeDownJoin = joinStart + 3;
|
||||
var volumeLevelScaledSendJoin = joinStart + 4;
|
||||
|
||||
trilist.SetUShortSigAction(volumeLevelJoin, output.SetVolume);
|
||||
output.VolumeLevelFeedback.LinkInputSig(trilist.UShortInput[volumeLevelJoin]);
|
||||
|
||||
trilist.SetUShortSigAction(volumeLevelScaledJoin, output.SetVolumeScaled);
|
||||
output.VolumeLevelScaledFeedback.LinkInputSig(trilist.UShortInput[volumeLevelScaledJoin]);
|
||||
|
||||
trilist.SetSigTrueAction(muteOnJoin, output.MuteOn);
|
||||
@@ -231,9 +217,9 @@ namespace PepperDash.Essentials.DM
|
||||
|
||||
trilist.SetBoolSigAction(volumeUpJoin, output.VolumeUp);
|
||||
trilist.SetBoolSigAction(volumeDownJoin, output.VolumeDown);
|
||||
|
||||
trilist.OnlineStatusChange += (a, b) => output.VolumeLevelFeedback.FireUpdate();
|
||||
trilist.OnlineStatusChange += (a, b) => output.VolumeLevelScaledFeedback.FireUpdate();
|
||||
trilist.SetBoolSigAction(volumeLevelScaledJoin, output.SendScaledVolume);
|
||||
trilist.SetUShortSigAction(volumeLevelJoin, output.SetVolume);
|
||||
trilist.SetUShortSigAction(volumeLevelScaledJoin, output.SetVolumeScaled);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -245,6 +231,8 @@ namespace PepperDash.Essentials.DM
|
||||
: base(output, type)
|
||||
{
|
||||
Mixer = mixer;
|
||||
GetVolumeMax();
|
||||
GetVolumeMin();
|
||||
}
|
||||
|
||||
public void GetVolumeMin()
|
||||
@@ -272,6 +260,8 @@ namespace PepperDash.Essentials.DM
|
||||
eDmpsLevelType Type;
|
||||
UShortInputSig Level;
|
||||
|
||||
private bool VolumeLevelScaledSend;
|
||||
private ushort VolumeLevelScaled;
|
||||
protected short MinLevel { get; set; }
|
||||
protected short MaxLevel { get; set; }
|
||||
|
||||
@@ -287,6 +277,8 @@ namespace PepperDash.Essentials.DM
|
||||
public DmpsAudioOutput(Card.Dmps3OutputBase output, eDmpsLevelType type)
|
||||
{
|
||||
Output = output;
|
||||
VolumeLevelScaled = 0;
|
||||
VolumeLevelScaledSend = false;
|
||||
Type = type;
|
||||
MinLevel = -800;
|
||||
MaxLevel = 100;
|
||||
@@ -396,13 +388,19 @@ namespace PepperDash.Essentials.DM
|
||||
if (VolumeLevelFeedback != null)
|
||||
{
|
||||
VolumeLevelScaledFeedback = new IntFeedback(new Func<int>(() => ScaleVolumeFeedback(VolumeLevelFeedback.UShortValue)));
|
||||
VolumeLevelFeedback.FireUpdate();
|
||||
VolumeLevelScaledFeedback.FireUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
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());
|
||||
Level.UShortValue = (ushort)(level * (MaxLevel - MinLevel) / ushort.MaxValue + MinLevel);
|
||||
VolumeLevelScaled = (ushort)(level * (MaxLevel - MinLevel) / ushort.MaxValue + MinLevel);
|
||||
if (VolumeLevelScaledSend == true)
|
||||
{
|
||||
Level.UShortValue = VolumeLevelScaled;
|
||||
}
|
||||
}
|
||||
|
||||
public ushort ScaleVolumeFeedback(ushort level)
|
||||
@@ -412,6 +410,15 @@ namespace PepperDash.Essentials.DM
|
||||
return (ushort)((signedLevel - MinLevel) * ushort.MaxValue / (MaxLevel - MinLevel));
|
||||
}
|
||||
|
||||
public void SendScaledVolume(bool pressRelease)
|
||||
{
|
||||
VolumeLevelScaledSend = pressRelease;
|
||||
if(pressRelease == false)
|
||||
{
|
||||
Level.UShortValue = VolumeLevelScaled;
|
||||
}
|
||||
}
|
||||
|
||||
#region IBasicVolumeWithFeedback Members
|
||||
|
||||
public void SetVolume(ushort level)
|
||||
|
||||
@@ -25,6 +25,7 @@ namespace PepperDash.Essentials.DM
|
||||
|
||||
public CrestronControlSystem Dmps { get; set; }
|
||||
public ISystemControl SystemControl { get; private set; }
|
||||
public bool? EnableRouting { get; private set; }
|
||||
|
||||
//Check if DMPS is a DMPS3-4K type for endpoint creation
|
||||
public bool Dmps4kType { get; private set; }
|
||||
@@ -204,10 +205,26 @@ namespace PepperDash.Essentials.DM
|
||||
Dmps.DMInputChange += Dmps_DMInputChange;
|
||||
Dmps.DMOutputChange += Dmps_DMOutputChange;
|
||||
Dmps.DMSystemChange += Dmps_DMSystemChange;
|
||||
|
||||
foreach (var input in VideoInputSyncFeedbacks)
|
||||
|
||||
foreach (var x in VideoOutputFeedbacks)
|
||||
{
|
||||
input.Value.FireUpdate();
|
||||
x.Value.FireUpdate();
|
||||
}
|
||||
foreach (var x in AudioOutputFeedbacks)
|
||||
{
|
||||
x.Value.FireUpdate();
|
||||
}
|
||||
foreach (var x in VideoInputSyncFeedbacks)
|
||||
{
|
||||
x.Value.FireUpdate();
|
||||
}
|
||||
foreach (var x in InputEndpointOnlineFeedbacks)
|
||||
{
|
||||
x.Value.FireUpdate();
|
||||
}
|
||||
foreach (var x in OutputEndpointOnlineFeedbacks)
|
||||
{
|
||||
x.Value.FireUpdate();
|
||||
}
|
||||
|
||||
return base.CustomActivate();
|
||||
@@ -246,6 +263,12 @@ namespace PepperDash.Essentials.DM
|
||||
}
|
||||
}
|
||||
|
||||
public void SetRoutingEnable(bool enable)
|
||||
{
|
||||
CrestronEnvironment.Sleep(1000);
|
||||
EnableRouting = enable;
|
||||
}
|
||||
|
||||
public void SetPowerOn(bool a)
|
||||
{
|
||||
if (SystemControl is Dmps3SystemControl)
|
||||
@@ -296,6 +319,8 @@ namespace PepperDash.Essentials.DM
|
||||
trilist.BooleanInput[joinMap.SystemPowerOff.JoinNumber]);
|
||||
}
|
||||
|
||||
trilist.SetBoolSigAction(joinMap.EnableRouting.JoinNumber, SetRoutingEnable);
|
||||
|
||||
// Link up outputs
|
||||
LinkInputsToApi(trilist, joinMap);
|
||||
LinkOutputsToApi(trilist, joinMap);
|
||||
@@ -837,13 +862,17 @@ namespace PepperDash.Essentials.DM
|
||||
}
|
||||
void Dmps_DMOutputChange(Switch device, DMOutputEventArgs args)
|
||||
{
|
||||
//Debug.Console(2, this, "DMOutputChange Output: {0} EventId: {1}", args.Number, args.EventId.ToString());
|
||||
Debug.Console(2, this, "DMOutputChange Output: {0} EventId: {1}", args.Number, args.EventId.ToString());
|
||||
|
||||
var output = args.Number;
|
||||
|
||||
DMOutput outputCard = Dmps.SwitcherOutputs[output] as DMOutput;
|
||||
|
||||
if (args.EventId == DMOutputEventIds.OnlineFeedbackEventId
|
||||
if (args.EventId == DMOutputEventIds.VolumeEventId && VolumeControls.ContainsKey(output))
|
||||
{
|
||||
VolumeControls[args.Number].VolumeEventFromChassis();
|
||||
}
|
||||
else if (args.EventId == DMOutputEventIds.OnlineFeedbackEventId
|
||||
&& OutputEndpointOnlineFeedbacks.ContainsKey(output))
|
||||
{
|
||||
OutputEndpointOnlineFeedbacks[output].FireUpdate();
|
||||
@@ -933,6 +962,10 @@ namespace PepperDash.Essentials.DM
|
||||
{
|
||||
try
|
||||
{
|
||||
if (EnableRouting == false)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Debug.Console(2, this, "Attempting a DM route from input {0} to output {1} {2}", inputSelector, outputSelector, sigType);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user