mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-01-31 13:25:00 +00:00
Compare commits
9 Commits
2.0.0-alph
...
1.15.5-alp
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
67e0378806 | ||
|
|
1c5aca03d2 | ||
|
|
d713abf614 | ||
|
|
a64b5240ad | ||
|
|
c528fecb9a | ||
|
|
355e9cde12 | ||
|
|
1df8d3f617 | ||
|
|
2f1caff815 | ||
|
|
4da2f25c3d |
@@ -55,6 +55,8 @@ namespace PepperDash.Essentials.Core.Touchpanels
|
||||
InitializeButton(buttonKey, buttonConfig);
|
||||
InitializeButtonFeedback(buttonKey, buttonConfig);
|
||||
}
|
||||
|
||||
ListButtons();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -318,6 +320,23 @@ namespace PepperDash.Essentials.Core.Touchpanels
|
||||
|
||||
foreach (var eventType in button.EventTypes[type]) DeviceJsonApi.DoDeviceAction(eventType);
|
||||
}
|
||||
|
||||
|
||||
public void ListButtons()
|
||||
{
|
||||
var line = new string('-', 35);
|
||||
|
||||
Debug.Console(0, this, line);
|
||||
|
||||
Debug.Console(0, this, "MPC3 Controller {0} - Available Butons", Key);
|
||||
|
||||
foreach (var button in _buttons)
|
||||
{
|
||||
Debug.Console(0, this, "Key: {0}", button.Key);
|
||||
}
|
||||
|
||||
Debug.Console(0, this, line);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -0,0 +1,172 @@
|
||||
using Crestron.SimplSharp;
|
||||
using Crestron.SimplSharpPro.DeviceSupport;
|
||||
using Crestron.SimplSharpPro.DM;
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core;
|
||||
|
||||
namespace PepperDash_Essentials_DM.Chassis
|
||||
{
|
||||
public class HdPsXxxAnalogAuxMixerController : IKeyed,
|
||||
IHasVolumeControlWithFeedback, IHasMuteControlWithFeedback // || IBasicVolumeWithFeedback
|
||||
{
|
||||
public string Key { get; private set; }
|
||||
|
||||
public HdPsXxxAnalogAuxMixer Mixer { get; private set; }
|
||||
|
||||
public HdPsXxxAnalogAuxMixerController(string parent, uint mixer, HdPsXxx chassis)
|
||||
{
|
||||
Key = string.Format("{0}-analogMixer{1}", parent, mixer);
|
||||
|
||||
Mixer = chassis.AnalogAuxiliaryMixer[mixer];
|
||||
|
||||
Mixer.AuxMixerPropertyChange += OnAuxMixerPropertyChange;
|
||||
Mixer.AuxiliaryMuteControl.MuteAndVolumeControlPropertyChange += OnMuteAndVolumeControlPropertyChange;
|
||||
|
||||
VolumeLevelFeedback = new IntFeedback(() => VolumeLevel);
|
||||
MuteFeedback = new BoolFeedback(() => IsMuted);
|
||||
|
||||
VolumeLevel = Mixer.VolumeFeedback.ShortValue;
|
||||
IsMuted = Mixer.AuxiliaryMuteControl.MuteOnFeedback.BoolValue;
|
||||
}
|
||||
|
||||
#region Volume
|
||||
|
||||
private void OnAuxMixerPropertyChange(object sender, GenericEventArgs args)
|
||||
{
|
||||
Debug.Console(2, this, "AuxMixerPropertyChange: {0} > Index-{1}, EventId-{2}", sender.GetType().ToString(), args.Index, args.EventId);
|
||||
|
||||
switch (args.EventId)
|
||||
{
|
||||
case (3):
|
||||
{
|
||||
VolumeLevel = Mixer.VolumeFeedback.ShortValue;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private const ushort CrestronLevelMin = 0;
|
||||
private const ushort CrestronLevelMax = 65535;
|
||||
|
||||
private const int DeviceLevelMin = -800;
|
||||
private const int DeviceLevelMax = 200;
|
||||
|
||||
private const int RampTime = 5000;
|
||||
|
||||
private int _volumeLevel;
|
||||
|
||||
public int VolumeLevel
|
||||
{
|
||||
get { return _volumeLevel; }
|
||||
set
|
||||
{
|
||||
var level = value;
|
||||
|
||||
// ScaleWithLimits(inputValue, InputUpperBound, InputLowerBound, OutputUpperBound, OutputLowerBound)
|
||||
_volumeLevel = CrestronEnvironment.ScaleWithLimits(level, DeviceLevelMax, DeviceLevelMin, CrestronLevelMax, CrestronLevelMin);
|
||||
|
||||
Debug.Console(1, this, "VolumeFeedback: level-'{0}', scaled-'{1}'", level, _volumeLevel);
|
||||
|
||||
VolumeLevelFeedback.FireUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
public IntFeedback VolumeLevelFeedback { get; private set; }
|
||||
|
||||
public void SetVolume(ushort level)
|
||||
{
|
||||
// ScaleWithLimits(inputValue, InputUpperBound, InputLowerBound, OutputUpperBound, OutputLowerBound)
|
||||
var scaled = CrestronEnvironment.ScaleWithLimits(level, CrestronLevelMax, CrestronLevelMin, DeviceLevelMax, DeviceLevelMin);
|
||||
|
||||
Debug.Console(1, this, "SetVolume: level-'{0}', scaled-'{1}'", level, scaled);
|
||||
|
||||
Mixer.Volume.ShortValue = (short)scaled;
|
||||
}
|
||||
|
||||
public void VolumeUp(bool pressRelease)
|
||||
{
|
||||
if (pressRelease)
|
||||
{
|
||||
Mixer.Volume.CreateSignedRamp(DeviceLevelMax, RampTime);
|
||||
}
|
||||
else
|
||||
{
|
||||
Mixer.Volume.StopRamp();
|
||||
}
|
||||
}
|
||||
|
||||
public void VolumeDown(bool pressRelease)
|
||||
{
|
||||
if (pressRelease)
|
||||
{
|
||||
//var remainingRatio = Mixer.Volume.UShortValue/CrestronLevelMax;
|
||||
//Mixer.Volume.CreateRamp(CrestronLevelMin, (uint)(RampTime * remainingRatio));
|
||||
|
||||
Mixer.Volume.CreateSignedRamp(DeviceLevelMin, RampTime);
|
||||
}
|
||||
else
|
||||
{
|
||||
Mixer.Volume.StopRamp();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
|
||||
#region Mute
|
||||
|
||||
private void OnMuteAndVolumeControlPropertyChange(MuteControl device, GenericEventArgs args)
|
||||
{
|
||||
Debug.Console(2, this, "OnMuteAndVolumeControlPropertyChange: {0} > Index-{1}, EventId-{2}", device.ToString(), args.Index, args.EventId);
|
||||
|
||||
switch (args.EventId)
|
||||
{
|
||||
case (1):
|
||||
case (2):
|
||||
{
|
||||
IsMuted = Mixer.AuxiliaryMuteControl.MuteOnFeedback.BoolValue;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private bool _isMuted;
|
||||
|
||||
public bool IsMuted
|
||||
{
|
||||
get { return _isMuted; }
|
||||
set
|
||||
{
|
||||
_isMuted = value;
|
||||
|
||||
Debug.Console(1, this, "IsMuted: _isMuted-'{0}'", _isMuted);
|
||||
|
||||
MuteFeedback.FireUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
public BoolFeedback MuteFeedback { get; private set; }
|
||||
|
||||
public void MuteOn()
|
||||
{
|
||||
Mixer.AuxiliaryMuteControl.MuteOn();
|
||||
}
|
||||
|
||||
public void MuteOff()
|
||||
{
|
||||
Mixer.AuxiliaryMuteControl.MuteOff();
|
||||
}
|
||||
|
||||
public void MuteToggle()
|
||||
{
|
||||
if (IsMuted)
|
||||
MuteOff();
|
||||
else
|
||||
MuteOn();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -82,6 +82,19 @@ namespace PepperDash_Essentials_DM.Chassis
|
||||
|
||||
OutputNames = props.Outputs;
|
||||
SetupOutputs(OutputNames);
|
||||
|
||||
foreach (var item in _chassis.HdmiDmLiteOutputs)
|
||||
{
|
||||
var audioDevice = new HdPsXxxOutputAudioController(Key, item.Number, _chassis);
|
||||
Debug.Console(2, this, "Adding HdPsXxxOutputAudioController '{0}' for output '{1}'", audioDevice.Key, item.Number);
|
||||
DeviceManager.AddDevice(audioDevice);
|
||||
}
|
||||
foreach (var item in _chassis.AnalogAuxiliaryMixer)
|
||||
{
|
||||
var audioDevice = new HdPsXxxAnalogAuxMixerController(Key, item.MixerNumber, _chassis);
|
||||
Debug.Console(2, this, "Adding HdPsXxAnalogAuxMixerCOntorller '{0}' for output '{1}'", audioDevice.Key, item.MixerNumber);
|
||||
DeviceManager.AddDevice(audioDevice);
|
||||
}
|
||||
}
|
||||
|
||||
// get input priorities
|
||||
@@ -174,7 +187,7 @@ namespace PepperDash_Essentials_DM.Chassis
|
||||
var output = item;
|
||||
var index = item.Number;
|
||||
var name = string.IsNullOrEmpty(OutputNames[index])
|
||||
? string.Format("Output {0}", index)
|
||||
? string.Format("Port {0}", index)
|
||||
: OutputNames[index];
|
||||
|
||||
output.Name.StringValue = name;
|
||||
@@ -185,7 +198,7 @@ namespace PepperDash_Essentials_DM.Chassis
|
||||
FeedbackMatchObject = output,
|
||||
Port = output.HdmiOutput.HdmiOutputPort
|
||||
};
|
||||
Debug.Console(1, this, "Adding Output port: {0} - {1}", hdmiPort.Key, name);
|
||||
Debug.Console(1, this, "Adding Port port: {0} - {1}", hdmiPort.Key, name);
|
||||
OutputPorts.Add(hdmiPort);
|
||||
|
||||
var dmLiteKey = string.Format("dmLiteOut{0}", index);
|
||||
@@ -194,7 +207,7 @@ namespace PepperDash_Essentials_DM.Chassis
|
||||
FeedbackMatchObject = output,
|
||||
Port = output.DmLiteOutput.DmLiteOutputPort
|
||||
};
|
||||
Debug.Console(1, this, "Adding Output port: {0} - {1}", dmLitePort.Key, name);
|
||||
Debug.Console(1, this, "Adding Port port: {0} - {1}", dmLitePort.Key, name);
|
||||
OutputPorts.Add(dmLitePort);
|
||||
|
||||
OutputRouteNameFeedback.Add(new StringFeedback(index.ToString(CultureInfo.InvariantCulture),
|
||||
@@ -203,7 +216,14 @@ namespace PepperDash_Essentials_DM.Chassis
|
||||
VideoOutputRouteFeedbacks.Add(new IntFeedback(index.ToString(CultureInfo.InvariantCulture),
|
||||
() => output.VideoOutFeedback == null ? 0 : (int)output.VideoOutFeedback.Number));
|
||||
}
|
||||
|
||||
/*
|
||||
Debug.Console(2, this, "----> AnalogAuxillaryMixer.Count-{0}", _chassis.AnalogAuxiliaryMixer.Count);
|
||||
foreach (var item in _chassis.AnalogAuxiliaryMixer)
|
||||
{
|
||||
Debug.Console(2, this, "----> AnalogAuxillaryMixer[{0}].LineMuteVolumeControl.Count-{1}", item.MixerNumber, item.LineMuteVolumeControl.Count);
|
||||
Debug.Console(2, this, "----> AnalogAuxillaryMixer[{0}].SourceMuteVolumeControl.Count-{1}", item.MixerNumber, item.SourceMuteVolumeControl.Count);
|
||||
}
|
||||
*/
|
||||
_chassis.DMOutputChange += _chassis_OutputChange;
|
||||
}
|
||||
|
||||
@@ -224,7 +244,7 @@ Selector: {4}
|
||||
|
||||
foreach (var port in OutputPorts)
|
||||
{
|
||||
Debug.Console(0, this, @"Output Port Key: {0}
|
||||
Debug.Console(0, this, @"Port Port Key: {0}
|
||||
Port: {1}
|
||||
Type: {2}
|
||||
ConnectionType: {3}
|
||||
@@ -413,6 +433,8 @@ Selector: {4}
|
||||
_chassis.AutoRouteOff();
|
||||
}
|
||||
|
||||
|
||||
|
||||
#region Events
|
||||
|
||||
|
||||
@@ -517,6 +539,7 @@ Selector: {4}
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
#region Factory
|
||||
|
||||
|
||||
@@ -524,7 +547,7 @@ Selector: {4}
|
||||
{
|
||||
public HdSp401ControllerFactory()
|
||||
{
|
||||
TypeNames = new List<string>() { "hdps401", "hdps402", "hdps621", "hdps622" };
|
||||
TypeNames = new List<string> { "hdps401", "hdps402", "hdps621", "hdps622" };
|
||||
}
|
||||
public override EssentialsDevice BuildDevice(DeviceConfig dc)
|
||||
{
|
||||
@@ -571,7 +594,7 @@ Selector: {4}
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
#endregion
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,138 @@
|
||||
using Crestron.SimplSharp;
|
||||
using Crestron.SimplSharpPro.DM;
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core;
|
||||
|
||||
namespace PepperDash_Essentials_DM.Chassis
|
||||
{
|
||||
public class HdPsXxxOutputAudioController : IKeyed,
|
||||
IHasVolumeControlWithFeedback, IHasMuteControlWithFeedback // || IBasicVolumeWithFeedback
|
||||
{
|
||||
public string Key { get; private set; }
|
||||
|
||||
public HdPsXxxOutputPort Port { get; private set; }
|
||||
|
||||
public HdPsXxxOutputAudioController(string parent, uint output, HdPsXxx chassis)
|
||||
{
|
||||
Key = string.Format("{0}-audioOut{1}", parent, output);
|
||||
|
||||
Port = chassis.HdmiDmLiteOutputs[output].OutputPort;
|
||||
|
||||
VolumeLevelFeedback = new IntFeedback(() => VolumeLevel);
|
||||
MuteFeedback = new BoolFeedback(() => IsMuted);
|
||||
|
||||
//if(Port.AudioOutput.Volume != null)
|
||||
// VolumeLevel = Port.AudioOutput.VolumeFeedback.UShortValue;
|
||||
|
||||
IsMuted = Port.MuteOnFeedback.BoolValue;
|
||||
}
|
||||
|
||||
#region Volume
|
||||
|
||||
private const ushort CrestronLevelMin = 0;
|
||||
private const ushort CrestronLevelMax = 65535;
|
||||
|
||||
private const int DeviceLevelMin = -800;
|
||||
private const int DeviceLevelMax = 200;
|
||||
|
||||
private const int RampTime = 5000;
|
||||
|
||||
private int _volumeLevel;
|
||||
|
||||
public int VolumeLevel
|
||||
{
|
||||
get { return _volumeLevel; }
|
||||
set
|
||||
{
|
||||
var level = value;
|
||||
|
||||
// ScaleWithLimits(inputValue, InputUpperBound, InputLowerBound, OutputUpperBound, OutputLowerBound)
|
||||
_volumeLevel = CrestronEnvironment.ScaleWithLimits(level, DeviceLevelMax, DeviceLevelMin, CrestronLevelMax, CrestronLevelMin);
|
||||
|
||||
Debug.Console(2, this, "VolumeFeedback: level-'{0}', scaled-'{1}'", level, _volumeLevel);
|
||||
|
||||
VolumeLevelFeedback.FireUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
public IntFeedback VolumeLevelFeedback { get; private set; }
|
||||
|
||||
public void SetVolume(ushort level)
|
||||
{
|
||||
// ScaleWithLimits(inputValue, InputUpperBound, InputLowerBound, OutputUpperBound, OutputLowerBound)
|
||||
var scaled = CrestronEnvironment.ScaleWithLimits(level, CrestronLevelMax, CrestronLevelMin, DeviceLevelMax, DeviceLevelMin);
|
||||
|
||||
Debug.Console(1, this, "SetVolume: level-'{0}', scaled-'{1}'", level, scaled);
|
||||
|
||||
Port.AudioOutput.Volume.ShortValue = (short)scaled;
|
||||
}
|
||||
|
||||
public void VolumeUp(bool pressRelease)
|
||||
{
|
||||
if (pressRelease)
|
||||
{
|
||||
Port.AudioOutput.Volume.CreateSignedRamp(DeviceLevelMax, RampTime);
|
||||
}
|
||||
else
|
||||
{
|
||||
Port.AudioOutput.Volume.StopRamp();
|
||||
}
|
||||
}
|
||||
|
||||
public void VolumeDown(bool pressRelease)
|
||||
{
|
||||
if (pressRelease)
|
||||
{
|
||||
Port.AudioOutput.Volume.CreateSignedRamp(DeviceLevelMin, RampTime);
|
||||
}
|
||||
else
|
||||
{
|
||||
Port.AudioOutput.Volume.StopRamp();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
|
||||
#region Mute
|
||||
|
||||
private bool _isMuted;
|
||||
|
||||
public bool IsMuted
|
||||
{
|
||||
get { return _isMuted; }
|
||||
set
|
||||
{
|
||||
_isMuted = value;
|
||||
|
||||
Debug.Console(1, this, "IsMuted: _isMuted-'{0}'", _isMuted);
|
||||
|
||||
MuteFeedback.FireUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
public BoolFeedback MuteFeedback { get; private set; }
|
||||
|
||||
public void MuteOn()
|
||||
{
|
||||
Port.MuteOn();
|
||||
}
|
||||
|
||||
public void MuteOff()
|
||||
{
|
||||
Port.MuteOff();
|
||||
}
|
||||
|
||||
public void MuteToggle()
|
||||
{
|
||||
if (IsMuted)
|
||||
MuteOff();
|
||||
else
|
||||
MuteOn();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -15,6 +15,9 @@ namespace PepperDash_Essentials_DM.Config
|
||||
[JsonProperty("outputs")]
|
||||
public Dictionary<uint, string> Outputs { get; set; }
|
||||
|
||||
[JsonProperty("volumeMixerId")]
|
||||
public uint VolumeMixerId { get; set; }
|
||||
|
||||
// "inputPriorities": "1,4,3,2"
|
||||
[JsonProperty("inputPriorities")]
|
||||
public string InputPriorities { get; set; }
|
||||
|
||||
@@ -104,7 +104,9 @@
|
||||
<Compile Include="Chassis\HdMd8xNController.cs" />
|
||||
<Compile Include="Chassis\HdMdNxM4kEBridgeableController.cs" />
|
||||
<Compile Include="Chassis\HdMdNxM4kEController.cs" />
|
||||
<Compile Include="Chassis\HdPsXxxAnalogAuxMixerController.cs" />
|
||||
<Compile Include="Chassis\HdPsXxxController.cs" />
|
||||
<Compile Include="Chassis\HdPsXxxOutputAudioController.cs" />
|
||||
<Compile Include="Config\HdPsXxxPropertiesConfig.cs" />
|
||||
<Compile Include="Config\InputPropertiesConfig.cs" />
|
||||
<Compile Include="Endpoints\EndpointInterfaces.cs" />
|
||||
|
||||
Reference in New Issue
Block a user