mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-02-15 20:54:55 +00:00
Refactor some of the dmps audio changes
This commit is contained in:
@@ -24,7 +24,7 @@ namespace PepperDash.Essentials.DM
|
|||||||
Card.Dmps3OutputBase OutputCard;
|
Card.Dmps3OutputBase OutputCard;
|
||||||
|
|
||||||
public DmpsAudioOutput MasterVolumeLevel { get; private set; }
|
public DmpsAudioOutput MasterVolumeLevel { get; private set; }
|
||||||
public DmpsAudioOutput SourceVolumeLevel { get; private set; }
|
public DmpsAudioOutput SourceVolumeLevel { get; private set; }
|
||||||
public DmpsAudioOutput MicsMasterVolumeLevel { get; private set; }
|
public DmpsAudioOutput MicsMasterVolumeLevel { get; private set; }
|
||||||
public DmpsAudioOutput Codec1VolumeLevel { get; private set; }
|
public DmpsAudioOutput Codec1VolumeLevel { get; private set; }
|
||||||
public DmpsAudioOutput Codec2VolumeLevel { get; private set; }
|
public DmpsAudioOutput Codec2VolumeLevel { get; private set; }
|
||||||
@@ -37,41 +37,38 @@ namespace PepperDash.Essentials.DM
|
|||||||
OutputCard.BaseDevice.DMOutputChange += new DMOutputEventHandler(BaseDevice_DMOutputChange);
|
OutputCard.BaseDevice.DMOutputChange += new DMOutputEventHandler(BaseDevice_DMOutputChange);
|
||||||
|
|
||||||
if (card is Card.Dmps3ProgramOutput)
|
if (card is Card.Dmps3ProgramOutput)
|
||||||
{
|
{
|
||||||
MasterVolumeLevel = new DmpsAudioOutput(card, eDmpsLevelType.Master)
|
MasterVolumeLevel = new DmpsAudioOutputWithMixer(card, eDmpsLevelType.Master, (card as Card.Dmps3ProgramOutput).OutputMixer);
|
||||||
{
|
SourceVolumeLevel = new DmpsAudioOutput(card, eDmpsLevelType.Source);
|
||||||
Mixer = (card as Card.Dmps3ProgramOutput).OutputMixer
|
|
||||||
};
|
|
||||||
SourceVolumeLevel = new DmpsAudioOutput(card, eDmpsLevelType.Source);
|
|
||||||
MicsMasterVolumeLevel = new DmpsAudioOutput(card, eDmpsLevelType.MicsMaster);
|
MicsMasterVolumeLevel = new DmpsAudioOutput(card, eDmpsLevelType.MicsMaster);
|
||||||
Codec1VolumeLevel = new DmpsAudioOutput(card, eDmpsLevelType.Codec1);
|
Codec1VolumeLevel = new DmpsAudioOutput(card, eDmpsLevelType.Codec1);
|
||||||
Codec2VolumeLevel = new DmpsAudioOutput(card, eDmpsLevelType.Codec2);
|
Codec2VolumeLevel = new DmpsAudioOutput(card, eDmpsLevelType.Codec2);
|
||||||
|
((DmpsAudioOutputWithMixer)MasterVolumeLevel).GetVolumeMax();
|
||||||
|
((DmpsAudioOutputWithMixer)MasterVolumeLevel).GetVolumeMin();
|
||||||
}
|
}
|
||||||
else if (card is Card.Dmps3Aux1Output)
|
else if (card is Card.Dmps3Aux1Output)
|
||||||
{
|
{
|
||||||
MasterVolumeLevel = new DmpsAudioOutput(card, eDmpsLevelType.Master)
|
MasterVolumeLevel = new DmpsAudioOutputWithMixer(card, eDmpsLevelType.Master, (card as Card.Dmps3Aux1Output).OutputMixer);
|
||||||
{
|
SourceVolumeLevel = new DmpsAudioOutput(card, eDmpsLevelType.Source);
|
||||||
Mixer = (card as Card.Dmps3Aux1Output).OutputMixer
|
|
||||||
};
|
|
||||||
SourceVolumeLevel = new DmpsAudioOutput(card, eDmpsLevelType.Source);
|
|
||||||
MicsMasterVolumeLevel = new DmpsAudioOutput(card, eDmpsLevelType.MicsMaster);
|
MicsMasterVolumeLevel = new DmpsAudioOutput(card, eDmpsLevelType.MicsMaster);
|
||||||
Codec2VolumeLevel = new DmpsAudioOutput(card, eDmpsLevelType.Codec2);
|
Codec2VolumeLevel = new DmpsAudioOutput(card, eDmpsLevelType.Codec2);
|
||||||
}
|
((DmpsAudioOutputWithMixer)MasterVolumeLevel).GetVolumeMax();
|
||||||
else if (card is Card.Dmps3Aux2Output)
|
((DmpsAudioOutputWithMixer)MasterVolumeLevel).GetVolumeMin();
|
||||||
{
|
}
|
||||||
MasterVolumeLevel = new DmpsAudioOutput(card, eDmpsLevelType.Master)
|
else if (card is Card.Dmps3Aux2Output)
|
||||||
{
|
{
|
||||||
Mixer = (card as Card.Dmps3Aux2Output).OutputMixer
|
MasterVolumeLevel = new DmpsAudioOutputWithMixer(card, eDmpsLevelType.Master, (card as Card.Dmps3Aux2Output).OutputMixer);
|
||||||
};
|
SourceVolumeLevel = new DmpsAudioOutput(card, eDmpsLevelType.Source);
|
||||||
SourceVolumeLevel = new DmpsAudioOutput(card, eDmpsLevelType.Source);
|
MicsMasterVolumeLevel = new DmpsAudioOutput(card, eDmpsLevelType.MicsMaster);
|
||||||
MicsMasterVolumeLevel = new DmpsAudioOutput(card, eDmpsLevelType.MicsMaster);
|
Codec1VolumeLevel = new DmpsAudioOutput(card, eDmpsLevelType.Codec1);
|
||||||
Codec1VolumeLevel = new DmpsAudioOutput(card, eDmpsLevelType.Codec1);
|
((DmpsAudioOutputWithMixer)MasterVolumeLevel).GetVolumeMax();
|
||||||
}
|
((DmpsAudioOutputWithMixer)MasterVolumeLevel).GetVolumeMin();
|
||||||
else //Digital Outputs
|
}
|
||||||
{
|
else //Digital Outputs
|
||||||
MasterVolumeLevel = new DmpsAudioOutput(card, eDmpsLevelType.Master);
|
{
|
||||||
SourceVolumeLevel = new DmpsAudioOutput(card, eDmpsLevelType.Source);
|
MasterVolumeLevel = new DmpsAudioOutput(card, eDmpsLevelType.Master);
|
||||||
MicsMasterVolumeLevel = new DmpsAudioOutput(card, eDmpsLevelType.MicsMaster);
|
SourceVolumeLevel = new DmpsAudioOutput(card, eDmpsLevelType.Source);
|
||||||
|
MicsMasterVolumeLevel = new DmpsAudioOutput(card, eDmpsLevelType.MicsMaster);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -80,105 +77,107 @@ namespace PepperDash.Essentials.DM
|
|||||||
switch (args.EventId)
|
switch (args.EventId)
|
||||||
{
|
{
|
||||||
case DMOutputEventIds.MasterVolumeFeedBackEventId:
|
case DMOutputEventIds.MasterVolumeFeedBackEventId:
|
||||||
{
|
{
|
||||||
MasterVolumeLevel.VolumeLevelFeedback.FireUpdate();
|
MasterVolumeLevel.VolumeLevelFeedback.FireUpdate();
|
||||||
MasterVolumeLevel.VolumeLevelScaledFeedback.FireUpdate();
|
MasterVolumeLevel.VolumeLevelScaledFeedback.FireUpdate();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case DMOutputEventIds.MasterMuteOnFeedBackEventId:
|
case DMOutputEventIds.MasterMuteOnFeedBackEventId:
|
||||||
{
|
{
|
||||||
MasterVolumeLevel.MuteFeedback.FireUpdate();
|
MasterVolumeLevel.MuteFeedback.FireUpdate();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case DMOutputEventIds.SourceLevelFeedBackEventId:
|
case DMOutputEventIds.SourceLevelFeedBackEventId:
|
||||||
{
|
{
|
||||||
SourceVolumeLevel.VolumeLevelFeedback.FireUpdate();
|
SourceVolumeLevel.VolumeLevelFeedback.FireUpdate();
|
||||||
SourceVolumeLevel.VolumeLevelScaledFeedback.FireUpdate();
|
SourceVolumeLevel.VolumeLevelScaledFeedback.FireUpdate();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case DMOutputEventIds.SourceMuteOnFeedBackEventId:
|
case DMOutputEventIds.SourceMuteOnFeedBackEventId:
|
||||||
{
|
{
|
||||||
SourceVolumeLevel.MuteFeedback.FireUpdate();
|
SourceVolumeLevel.MuteFeedback.FireUpdate();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case DMOutputEventIds.MicMasterLevelFeedBackEventId:
|
case DMOutputEventIds.MicMasterLevelFeedBackEventId:
|
||||||
{
|
{
|
||||||
MicsMasterVolumeLevel.VolumeLevelFeedback.FireUpdate();
|
MicsMasterVolumeLevel.VolumeLevelFeedback.FireUpdate();
|
||||||
MicsMasterVolumeLevel.VolumeLevelScaledFeedback.FireUpdate();
|
MicsMasterVolumeLevel.VolumeLevelScaledFeedback.FireUpdate();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case DMOutputEventIds.MicMasterMuteOnFeedBackEventId:
|
case DMOutputEventIds.MicMasterMuteOnFeedBackEventId:
|
||||||
{
|
{
|
||||||
MicsMasterVolumeLevel.MuteFeedback.FireUpdate();
|
MicsMasterVolumeLevel.MuteFeedback.FireUpdate();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case DMOutputEventIds.Codec1LevelFeedBackEventId:
|
case DMOutputEventIds.Codec1LevelFeedBackEventId:
|
||||||
{
|
{
|
||||||
if (Codec1VolumeLevel != null)
|
if (Codec1VolumeLevel != null)
|
||||||
{
|
{
|
||||||
Codec1VolumeLevel.VolumeLevelFeedback.FireUpdate();
|
Codec1VolumeLevel.VolumeLevelFeedback.FireUpdate();
|
||||||
Codec1VolumeLevel.VolumeLevelScaledFeedback.FireUpdate();
|
Codec1VolumeLevel.VolumeLevelScaledFeedback.FireUpdate();
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
}
|
|
||||||
case DMOutputEventIds.Codec1MuteOnFeedBackEventId:
|
case DMOutputEventIds.Codec1MuteOnFeedBackEventId:
|
||||||
{
|
{
|
||||||
if (Codec1VolumeLevel != null)
|
if (Codec1VolumeLevel != null)
|
||||||
Codec1VolumeLevel.MuteFeedback.FireUpdate();
|
Codec1VolumeLevel.MuteFeedback.FireUpdate();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case DMOutputEventIds.Codec2LevelFeedBackEventId:
|
case DMOutputEventIds.Codec2LevelFeedBackEventId:
|
||||||
{
|
{
|
||||||
if (Codec2VolumeLevel != null)
|
if (Codec2VolumeLevel != null)
|
||||||
{
|
{
|
||||||
Codec2VolumeLevel.VolumeLevelFeedback.FireUpdate();
|
Codec2VolumeLevel.VolumeLevelFeedback.FireUpdate();
|
||||||
Codec2VolumeLevel.VolumeLevelScaledFeedback.FireUpdate();
|
Codec2VolumeLevel.VolumeLevelScaledFeedback.FireUpdate();
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
}
|
|
||||||
case DMOutputEventIds.Codec2MuteOnFeedBackEventId:
|
case DMOutputEventIds.Codec2MuteOnFeedBackEventId:
|
||||||
{
|
{
|
||||||
if (Codec2VolumeLevel != null)
|
if (Codec2VolumeLevel != null)
|
||||||
Codec2VolumeLevel.MuteFeedback.FireUpdate();
|
Codec2VolumeLevel.MuteFeedback.FireUpdate();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case DMOutputEventIds.MinVolumeFeedBackEventId:
|
case DMOutputEventIds.MinVolumeFeedBackEventId:
|
||||||
{
|
{
|
||||||
Debug.Console(2, this, "MinVolumeFeedBackEventId: {0}", args.Index);
|
Debug.Console(2, this, "MinVolumeFeedBackEventId: {0}", args.Index);
|
||||||
if (MasterVolumeLevel != null)
|
var level = MasterVolumeLevel as DmpsAudioOutputWithMixer;
|
||||||
{
|
if (level != null)
|
||||||
MasterVolumeLevel.GetVolumeMin();
|
{
|
||||||
}
|
level.GetVolumeMin();
|
||||||
break;
|
}
|
||||||
}
|
break;
|
||||||
case DMOutputEventIds.MaxVolumeFeedBackEventId:
|
}
|
||||||
{
|
case DMOutputEventIds.MaxVolumeFeedBackEventId:
|
||||||
Debug.Console(2, this, "MaxVolumeFeedBackEventId: {0}", args.Index);
|
{
|
||||||
if (MasterVolumeLevel != null)
|
Debug.Console(2, this, "MaxVolumeFeedBackEventId: {0}", args.Index);
|
||||||
{
|
var level = MasterVolumeLevel as DmpsAudioOutputWithMixer;
|
||||||
MasterVolumeLevel.GetVolumeMax();
|
if (level != null)
|
||||||
}
|
{
|
||||||
break;
|
level.GetVolumeMax();
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge)
|
public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge)
|
||||||
{
|
{
|
||||||
var joinMap = new DmpsAudioOutputControllerJoinMap(joinStart);
|
var joinMap = new DmpsAudioOutputControllerJoinMap(joinStart);
|
||||||
|
|
||||||
var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey);
|
var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey);
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(joinMapSerialized))
|
if (!string.IsNullOrEmpty(joinMapSerialized))
|
||||||
joinMap = JsonConvert.DeserializeObject<DmpsAudioOutputControllerJoinMap>(joinMapSerialized);
|
joinMap = JsonConvert.DeserializeObject<DmpsAudioOutputControllerJoinMap>(joinMapSerialized);
|
||||||
|
|
||||||
if (bridge != null)
|
if (bridge != null)
|
||||||
{
|
{
|
||||||
bridge.AddJoinMap(Key, joinMap);
|
bridge.AddJoinMap(Key, joinMap);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Debug.Console(0, this, "Please update config to use 'eiscapiadvanced' to get all join map features for this device.");
|
Debug.Console(0, this, "Please update config to use 'eiscapiadvanced' to get all join map features for this device.");
|
||||||
}
|
}
|
||||||
|
|
||||||
Debug.Console(1, this, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
|
Debug.Console(1, this, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
|
||||||
@@ -191,11 +190,11 @@ namespace PepperDash.Essentials.DM
|
|||||||
if (SourceVolumeLevel != null)
|
if (SourceVolumeLevel != null)
|
||||||
{
|
{
|
||||||
SetUpDmpsAudioOutputJoins(trilist, SourceVolumeLevel, joinMap.SourceVolumeLevel.JoinNumber);
|
SetUpDmpsAudioOutputJoins(trilist, SourceVolumeLevel, joinMap.SourceVolumeLevel.JoinNumber);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (MicsMasterVolumeLevel != null)
|
if (MicsMasterVolumeLevel != null)
|
||||||
{
|
{
|
||||||
SetUpDmpsAudioOutputJoins(trilist, MicsMasterVolumeLevel, joinMap.MicsMasterVolumeLevel.JoinNumber);
|
SetUpDmpsAudioOutputJoins(trilist, MicsMasterVolumeLevel, joinMap.MicsMasterVolumeLevel.JoinNumber);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Codec1VolumeLevel != null)
|
if (Codec1VolumeLevel != null)
|
||||||
@@ -212,17 +211,17 @@ namespace PepperDash.Essentials.DM
|
|||||||
|
|
||||||
static void SetUpDmpsAudioOutputJoins(BasicTriList trilist, DmpsAudioOutput output, uint joinStart)
|
static void SetUpDmpsAudioOutputJoins(BasicTriList trilist, DmpsAudioOutput output, uint joinStart)
|
||||||
{
|
{
|
||||||
var volumeLevelJoin = joinStart;
|
var volumeLevelJoin = joinStart;
|
||||||
var volumeLevelScaledJoin = joinStart + 1;
|
var volumeLevelScaledJoin = joinStart + 1;
|
||||||
var muteOnJoin = joinStart;
|
var muteOnJoin = joinStart;
|
||||||
var muteOffJoin = joinStart + 1;
|
var muteOffJoin = joinStart + 1;
|
||||||
var volumeUpJoin = joinStart + 2;
|
var volumeUpJoin = joinStart + 2;
|
||||||
var volumeDownJoin = joinStart + 3;
|
var volumeDownJoin = joinStart + 3;
|
||||||
|
|
||||||
trilist.SetUShortSigAction(volumeLevelJoin, output.SetVolume);
|
trilist.SetUShortSigAction(volumeLevelJoin, output.SetVolume);
|
||||||
output.VolumeLevelFeedback.LinkInputSig(trilist.UShortInput[volumeLevelJoin]);
|
output.VolumeLevelFeedback.LinkInputSig(trilist.UShortInput[volumeLevelJoin]);
|
||||||
|
|
||||||
trilist.SetUShortSigAction(volumeLevelScaledJoin, output.SetVolumeScaled);
|
trilist.SetUShortSigAction(volumeLevelScaledJoin, output.SetVolumeScaled);
|
||||||
output.VolumeLevelScaledFeedback.LinkInputSig(trilist.UShortInput[volumeLevelScaledJoin]);
|
output.VolumeLevelScaledFeedback.LinkInputSig(trilist.UShortInput[volumeLevelScaledJoin]);
|
||||||
|
|
||||||
trilist.SetSigTrueAction(muteOnJoin, output.MuteOn);
|
trilist.SetSigTrueAction(muteOnJoin, output.MuteOn);
|
||||||
@@ -232,33 +231,64 @@ namespace PepperDash.Essentials.DM
|
|||||||
|
|
||||||
trilist.SetBoolSigAction(volumeUpJoin, output.VolumeUp);
|
trilist.SetBoolSigAction(volumeUpJoin, output.VolumeUp);
|
||||||
trilist.SetBoolSigAction(volumeDownJoin, output.VolumeDown);
|
trilist.SetBoolSigAction(volumeDownJoin, output.VolumeDown);
|
||||||
|
|
||||||
|
trilist.OnlineStatusChange += (a, b) => output.VolumeLevelFeedback.FireUpdate();
|
||||||
|
trilist.OnlineStatusChange += (a, b) => output.VolumeLevelScaledFeedback.FireUpdate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class DmpsAudioOutputWithMixer : DmpsAudioOutput
|
||||||
|
{
|
||||||
|
CrestronControlSystem.Dmps3OutputMixerWithMonoAndStereo Mixer;
|
||||||
|
|
||||||
|
public DmpsAudioOutputWithMixer(Card.Dmps3OutputBase output, eDmpsLevelType type, CrestronControlSystem.Dmps3OutputMixerWithMonoAndStereo mixer)
|
||||||
|
: base(output, type)
|
||||||
|
{
|
||||||
|
Mixer = mixer;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void GetVolumeMin()
|
||||||
|
{
|
||||||
|
MinLevel = (short)Mixer.MinVolumeFeedback.UShortValue;
|
||||||
|
if (VolumeLevelScaledFeedback != null)
|
||||||
|
{
|
||||||
|
VolumeLevelScaledFeedback.FireUpdate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void GetVolumeMax()
|
||||||
|
{
|
||||||
|
MaxLevel = (short)Mixer.MaxVolumeFeedback.UShortValue;
|
||||||
|
if (VolumeLevelScaledFeedback != null)
|
||||||
|
{
|
||||||
|
VolumeLevelScaledFeedback.FireUpdate();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class DmpsAudioOutput : IBasicVolumeWithFeedback
|
public class DmpsAudioOutput : IBasicVolumeWithFeedback
|
||||||
{
|
{
|
||||||
Card.Dmps3OutputBase Output;
|
Card.Dmps3OutputBase Output;
|
||||||
eDmpsLevelType Type;
|
eDmpsLevelType Type;
|
||||||
UShortInputSig Level;
|
UShortInputSig Level;
|
||||||
|
|
||||||
public short MinLevel { get; private set; }
|
protected short MinLevel { get; set; }
|
||||||
public short MaxLevel { get; private set; }
|
protected short MaxLevel { get; set; }
|
||||||
|
|
||||||
public CrestronControlSystem.Dmps3OutputMixerWithMonoAndStereo Mixer { get; set; }
|
|
||||||
public BoolFeedback MuteFeedback { get; private set; }
|
public BoolFeedback MuteFeedback { get; private set; }
|
||||||
public IntFeedback VolumeLevelFeedback { get; private set; }
|
public IntFeedback VolumeLevelFeedback { get; private set; }
|
||||||
public IntFeedback VolumeLevelScaledFeedback { get; private set; }
|
public IntFeedback VolumeLevelScaledFeedback { get; private set; }
|
||||||
|
|
||||||
Action MuteOnAction;
|
Action MuteOnAction;
|
||||||
Action MuteOffAction;
|
Action MuteOffAction;
|
||||||
Action<bool> VolumeUpAction;
|
Action<bool> VolumeUpAction;
|
||||||
Action<bool> VolumeDownAction;
|
Action<bool> VolumeDownAction;
|
||||||
|
|
||||||
public DmpsAudioOutput(Card.Dmps3OutputBase output, eDmpsLevelType type)
|
public DmpsAudioOutput(Card.Dmps3OutputBase output, eDmpsLevelType type)
|
||||||
{
|
{
|
||||||
Output = output;
|
Output = output;
|
||||||
Type = type;
|
Type = type;
|
||||||
MinLevel = -800;
|
MinLevel = -800;
|
||||||
MaxLevel = 100;
|
MaxLevel = 100;
|
||||||
|
|
||||||
switch (type)
|
switch (type)
|
||||||
@@ -267,13 +297,12 @@ namespace PepperDash.Essentials.DM
|
|||||||
{
|
{
|
||||||
Level = output.MasterVolume;
|
Level = output.MasterVolume;
|
||||||
|
|
||||||
MuteFeedback = new BoolFeedback( new Func<bool> (() => Output.MasterMuteOnFeedBack.BoolValue));
|
MuteFeedback = new BoolFeedback(new Func<bool>(() => Output.MasterMuteOnFeedBack.BoolValue));
|
||||||
VolumeLevelFeedback = new IntFeedback(new Func<int>(() => Output.MasterVolumeFeedBack.UShortValue));
|
VolumeLevelFeedback = new IntFeedback(new Func<int>(() => Output.MasterVolumeFeedBack.UShortValue));
|
||||||
MuteOnAction = new Action(Output.MasterMuteOn);
|
MuteOnAction = new Action(Output.MasterMuteOn);
|
||||||
MuteOffAction = new Action(Output.MasterMuteOff);
|
MuteOffAction = new Action(Output.MasterMuteOff);
|
||||||
VolumeUpAction = new Action<bool>((b) => Output.MasterVolumeUp.BoolValue = b);
|
VolumeUpAction = new Action<bool>((b) => Output.MasterVolumeUp.BoolValue = b);
|
||||||
VolumeDownAction = new Action<bool>((b) => Output.MasterVolumeDown.BoolValue = b);
|
VolumeDownAction = new Action<bool>((b) => Output.MasterVolumeDown.BoolValue = b);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case eDmpsLevelType.MicsMaster:
|
case eDmpsLevelType.MicsMaster:
|
||||||
@@ -363,56 +392,30 @@ namespace PepperDash.Essentials.DM
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (VolumeLevelFeedback != null)
|
|
||||||
{
|
|
||||||
VolumeLevelScaledFeedback = new IntFeedback(new Func<int>(() => ScaleVolumeFeedback(VolumeLevelFeedback.UShortValue)));
|
|
||||||
}
|
}
|
||||||
}
|
if (VolumeLevelFeedback != null)
|
||||||
|
{
|
||||||
public void SetVolumeScaled(ushort level)
|
VolumeLevelScaledFeedback = new IntFeedback(new Func<int>(() => ScaleVolumeFeedback(VolumeLevelFeedback.UShortValue)));
|
||||||
{
|
}
|
||||||
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);
|
|
||||||
}
|
public void SetVolumeScaled(ushort level)
|
||||||
|
{
|
||||||
public ushort ScaleVolumeFeedback(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);
|
||||||
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());
|
|
||||||
return (ushort)((signedLevel - MinLevel) * ushort.MaxValue / (MaxLevel - MinLevel));
|
public ushort ScaleVolumeFeedback(ushort level)
|
||||||
}
|
{
|
||||||
|
short signedLevel = (short)level;
|
||||||
public void GetVolumeMin()
|
Debug.Console(2, Debug.ErrorLogLevel.None, "Scaling DMPS volume:{0} feedback:{1} min:{2} max:{3}", Output.Name, signedLevel.ToString(), MinLevel.ToString(), MaxLevel.ToString());
|
||||||
{
|
return (ushort)((signedLevel - MinLevel) * ushort.MaxValue / (MaxLevel - MinLevel));
|
||||||
if (Mixer != null)
|
|
||||||
{
|
|
||||||
MinLevel = (short)Mixer.MinVolumeFeedback.UShortValue;
|
|
||||||
Debug.Console(2, Debug.ErrorLogLevel.None, "DMPS set {0} min level:{1}", Output.Name, MinLevel);
|
|
||||||
if (VolumeLevelScaledFeedback != null)
|
|
||||||
{
|
|
||||||
VolumeLevelScaledFeedback.FireUpdate();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void GetVolumeMax()
|
|
||||||
{
|
|
||||||
if (Mixer != null)
|
|
||||||
{
|
|
||||||
MaxLevel = (short)Mixer.MaxVolumeFeedback.UShortValue;
|
|
||||||
Debug.Console(2, Debug.ErrorLogLevel.None, "DMPS set {0} max level:{1}", Output.Name, MaxLevel);
|
|
||||||
if (VolumeLevelScaledFeedback != null)
|
|
||||||
{
|
|
||||||
VolumeLevelScaledFeedback.FireUpdate();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#region IBasicVolumeWithFeedback Members
|
#region IBasicVolumeWithFeedback Members
|
||||||
|
|
||||||
public void SetVolume(ushort level)
|
public void SetVolume(ushort level)
|
||||||
{
|
{
|
||||||
Level.UShortValue = level;
|
Level.UShortValue = level;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user