Compare commits

...

5 Commits

Author SHA1 Message Date
Jason DeVito
c528fecb9a feat(wip): add HdPsXxx audio control 2023-11-02 17:52:27 -05:00
jkdevito
355e9cde12 chore(wip): save updates 2023-11-02 11:55:48 -05:00
jkdevito
1df8d3f617 feat: create branch to add volume control 2023-11-02 11:54:44 -05:00
Neil Dorin
2f1caff815 Merge pull request #1154 from PepperDash/hotfix/mpc3-button-list
fix: list available buttons on startup
2023-10-27 12:53:52 -06:00
Jason DeVito
4da2f25c3d fix: list available buttons on startup 2023-10-27 12:14:07 -05:00
5 changed files with 139 additions and 2 deletions

View File

@@ -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>

View File

@@ -0,0 +1,98 @@
using System;
using Crestron.SimplSharpPro.DM;
using PepperDash.Core;
using PepperDash.Essentials.Core;
namespace PepperDash_Essentials_DM.Chassis
{
public class HdPsXxxAnalogAuxMixerController : IKeyed, IBasicVolumeWithFeedback
{
public string Key { get; private set; }
public HdPsXxxAnalogAuxMixer Mixer { get; set; }
public HdPsXxxAnalogAuxMixerController(string parent, uint mixer, HdPsXxx chassis)
{
Key = string.Format("{0}-analogMixer{1}", parent, mixer);
Mixer = chassis.AnalogAuxiliaryMixer[mixer];
VolumeLevelFeedback = new IntFeedback(VolumeFeedbackFunc);
MuteFeedback = new BoolFeedback(MuteFeedbackFunc);
}
#region Volume
public IntFeedback VolumeLevelFeedback { get; private set; }
protected Func<int> VolumeFeedbackFunc
{
get { return () => Mixer.VolumeFeedback.UShortValue; }
}
public void SetVolume(ushort level)
{
Mixer.Volume.UShortValue = level;
}
public void VolumeUp(bool pressRelease)
{
if (pressRelease)
{
var remainingRatio = (65535 - Mixer.Volume.UShortValue)/65535;
Mixer.Volume.CreateRamp(65535, 400);
}
else
{
Mixer.Volume.StopRamp();
}
}
public void VolumeDown(bool pressRelease)
{
if (pressRelease)
{
var remainingRatio = Mixer.Volume.UShortValue/65535;
Mixer.Volume.CreateRamp(0, (uint)(400 * remainingRatio));
}
else
{
Mixer.Volume.StopRamp();
}
}
#endregion
#region Mute
private bool _isMuted;
public BoolFeedback MuteFeedback { get; private set; }
protected Func<bool> MuteFeedbackFunc
{
get { return () => _isMuted = Mixer.AuxiliaryMuteControl.MuteOnFeedback.BoolValue; }
}
public void MuteOn()
{
Mixer.AuxiliaryMuteControl.MuteOn();
}
public void MuteOff()
{
Mixer.AuxiliaryMuteControl.MuteOff();
}
public void MuteToggle()
{
if (_isMuted)
MuteOff();
else
MuteOn();
}
#endregion
}
}

View File

@@ -82,6 +82,12 @@ namespace PepperDash_Essentials_DM.Chassis
OutputNames = props.Outputs;
SetupOutputs(OutputNames);
foreach (var mixer in _chassis.AnalogAuxiliaryMixer)
{
var mixerDevice = new HdPsXxxAnalogAuxMixerController(Key, mixer.MixerNumber, _chassis);
DeviceManager.AddDevice(mixerDevice);
}
}
// get input priorities
@@ -204,6 +210,13 @@ namespace PepperDash_Essentials_DM.Chassis
() => output.VideoOutFeedback == null ? 0 : (int)output.VideoOutFeedback.Number));
}
Debug.Console(0, this, "----> AnalogAuxillaryMixer.Count-{0}", _chassis.AnalogAuxiliaryMixer.Count);
foreach (var item in _chassis.AnalogAuxiliaryMixer)
{
Debug.Console(0, this, "----> AnalogAuxillaryMixer[{0}].LineMuteVolumeControl.Count-{1}", item.MixerNumber, item.LineMuteVolumeControl.Count);
Debug.Console(0, this, "----> AnalogAuxillaryMixer[{0}].SourceMuteVolumeControl.Count-{1}", item.MixerNumber, item.SourceMuteVolumeControl.Count);
}
_chassis.DMOutputChange += _chassis_OutputChange;
}
@@ -413,6 +426,8 @@ Selector: {4}
_chassis.AutoRouteOff();
}
#region Events
@@ -517,6 +532,7 @@ Selector: {4}
#endregion
#region Factory
@@ -524,7 +540,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 +587,7 @@ Selector: {4}
}
#endregion
#endregion
}

View File

@@ -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; }

View File

@@ -104,6 +104,7 @@
<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="Config\HdPsXxxPropertiesConfig.cs" />
<Compile Include="Config\InputPropertiesConfig.cs" />