Skip to content

Commit

Permalink
feat: adds gain fb
Browse files Browse the repository at this point in the history
  • Loading branch information
hbrock78 committed Aug 18, 2023
1 parent a67bd59 commit 2777c12
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 7 deletions.
6 changes: 3 additions & 3 deletions QscQsysDspPlugin/QscDsp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public static QscDsp BuildDevice(DeviceConfig dc)

public BoolFeedback IsPrimaryFeedback;
public BoolFeedback IsActiveFeedback;

private DeviceConfig _Dc;

private CrestronQueue CommandQueue;
Expand Down Expand Up @@ -515,15 +515,15 @@ private void Port_LineReceived(object dev, GenericCommMethodReceiveTextArgs args
if (changedInstance == controlPoint.Value.LevelInstanceTag)
{
controlPoint.Value.ParseSubscriptionMessage(changedInstance, changeMessage[4],
changeMessage[3]);
changeMessage[3], changeMessage[2].Replace("\"", ""));
foundItFlag = true;
return;
}

else if (changedInstance == controlPoint.Value.MuteInstanceTag)
{
controlPoint.Value.ParseSubscriptionMessage(changedInstance,
changeMessage[2].Replace("\"", ""), null);
changeMessage[2].Replace("\"", ""), null, null);
foundItFlag = true;
return;
}
Expand Down
16 changes: 15 additions & 1 deletion QscQsysDspPlugin/QscDspBridge.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ public static void LinkToApiExt(this QscDsp DspDevice, BasicTriList trilist, uin

foreach (var channel in DspDevice.LevelControlPoints)
{
var actualChannel = channel.Value;
if (channel.Key == DspDevice.AutoTrackingKey)
{
Debug.Console(2, DspDevice, "Found autotracking... skipping");
var actualChannel = channel.Value;
trilist.SetSigTrueAction(joinMap.AutoTracking.JoinNumber, actualChannel.MuteToggle);
actualChannel.MuteFeedback.LinkInputSig(trilist.BooleanInput[joinMap.AutoTracking.JoinNumber]);
continue;
Expand All @@ -75,6 +75,7 @@ public static void LinkToApiExt(this QscDsp DspDevice, BasicTriList trilist, uin
genericChannel.MuteFeedback.LinkInputSig(trilist.BooleanInput[joinMap.ChannelMuteToggle.JoinNumber + x]);
genericChannel.MuteFeedback.LinkComplementInputSig(trilist.BooleanInput[joinMap.ChannelMuteOff.JoinNumber + x]);
genericChannel.VolumeLevelFeedback.LinkInputSig(trilist.UShortInput[joinMap.ChannelVolume.JoinNumber + x]);
actualChannel.GainFeedback.LinkInputSig(trilist.StringInput[joinMap.ChannelGain.JoinNumber + x]);

// from SiMPL > to Plugin
trilist.SetSigTrueAction(joinMap.ChannelMuteToggle.JoinNumber + x, () => genericChannel.MuteToggle());
Expand Down Expand Up @@ -361,6 +362,19 @@ public class QscDspDeviceJoinMapAdvanced : JoinMapBaseAdvanced
JoinCapabilities = eJoinCapabilities.ToFromSIMPL,
JoinType = eJoinType.Analog
});
[JoinName("ChannelGain")]
public JoinDataComplete ChannelGain = new JoinDataComplete(
new JoinData
{
JoinNumber = 401,
JoinSpan = 200
},
new JoinMetadata
{
Description = "Fader Channel Gain FB",
JoinCapabilities = eJoinCapabilities.ToSIMPL,
JoinType = eJoinType.Serial
});
[JoinName("ChannelVolumeUp")]
public JoinDataComplete ChannelVolumeUp = new JoinDataComplete(
new JoinData
Expand Down
13 changes: 10 additions & 3 deletions QscQsysDspPlugin/QscDspLevelControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,14 @@ public class QscDspLevelControl : QscDspControlPoint, IBasicVolumeWithFeedback,
{
bool _isMuted;
ushort _volumeLevel;
string _gainLevel;

const ushort _rampResetTime = 100;
const ushort _rampResetTime = 250;

public BoolFeedback MuteFeedback { get; private set; }

public StringFeedback GainFeedback { get; private set; }

public IntFeedback VolumeLevelFeedback { get; private set; }

public bool Enabled { get; set; }
Expand Down Expand Up @@ -133,6 +136,7 @@ public void Initialize(string key, QscDspLevelControlBlockConfig config)
MuteFeedback = new BoolFeedback(() => _isMuted);

VolumeLevelFeedback = new IntFeedback(() => _volumeLevel);
GainFeedback = new StringFeedback(() => _gainLevel);

_volumeUpRepeatTimer = new CTimer(VolumeUpRepeat, Timeout.Infinite);
_volumeDownRepeatTimer = new CTimer(VolumeDownRepeat, Timeout.Infinite);
Expand Down Expand Up @@ -172,7 +176,7 @@ public void Subscribe()
/// <param name="customName"></param>
/// <param name="value"></param>
/// <param name="absoluteValue"></param>
public void ParseSubscriptionMessage(string customName, string value, string absoluteValue)
public void ParseSubscriptionMessage(string customName, string value, string absoluteValue, string gain)
{
// Check for valid subscription response
Debug.Console(1, this, "Level {0} Response: '{1}'", customName, value);
Expand Down Expand Up @@ -202,12 +206,15 @@ public void ParseSubscriptionMessage(string customName, string value, string abs
&& !UseAbsoluteValue)
{
var parsedValue = Double.Parse(value);

_volumeLevel = (ushort)(parsedValue * 65535);
Debug.Console(1, this, "Level {0} VolumeLevel: '{1}'", customName, _volumeLevel);
_levelIsSubscribed = true;

VolumeLevelFeedback.FireUpdate();

_gainLevel = gain;
GainFeedback.FireUpdate();
}
else if (
!String.IsNullOrEmpty(LevelInstanceTag)
Expand Down

0 comments on commit 2777c12

Please sign in to comment.