From 74af3f823e6a394c73de1128f796fc2fb7df1cf7 Mon Sep 17 00:00:00 2001 From: oddbear Date: Mon, 30 May 2022 16:36:08 +0200 Subject: [PATCH 1/2] Rename Output to MixOut --- .../Enums/{Output.cs => MixOut.cs} | 2 +- Revelator.io24.Api/RoutingTable.cs | 76 +++++++-------- .../Adjustments/VolumeAdjustment.cs | 30 +++--- .../Commands/RoutingCommand.cs | 30 +++--- .../Actions/RouteChangeAction.cs | 16 ++-- .../Actions/VolumeLevelAction.cs | 16 ++-- .../Settings/RouteChangeSettings.cs | 2 +- .../Settings/VolumeLevelSettings.cs | 2 +- .../Converters/OutputConverter.cs | 8 +- .../RevelatorIo24Plugin.cs | 6 +- Revelator.io24.Wpf/Models/RoutingMapper.cs | 92 +++++++++---------- Revelator.io24.Wpf/Models/VolumeDbMapper.cs | 92 +++++++++---------- Revelator.io24.Wpf/Models/VolumeMapper.cs | 92 +++++++++---------- 13 files changed, 232 insertions(+), 232 deletions(-) rename Revelator.io24.Api/Enums/{Output.cs => MixOut.cs} (91%) diff --git a/Revelator.io24.Api/Enums/Output.cs b/Revelator.io24.Api/Enums/MixOut.cs similarity index 91% rename from Revelator.io24.Api/Enums/Output.cs rename to Revelator.io24.Api/Enums/MixOut.cs index 19b2cea..ec4d92b 100644 --- a/Revelator.io24.Api/Enums/Output.cs +++ b/Revelator.io24.Api/Enums/MixOut.cs @@ -2,7 +2,7 @@ namespace Revelator.io24.Api.Enums { - public enum Output + public enum MixOut { [Description("Main")] Main, diff --git a/Revelator.io24.Api/RoutingTable.cs b/Revelator.io24.Api/RoutingTable.cs index 9ea952b..86285c8 100644 --- a/Revelator.io24.Api/RoutingTable.cs +++ b/Revelator.io24.Api/RoutingTable.cs @@ -14,8 +14,8 @@ public class RoutingTable { private readonly RawService _rawService; - public event EventHandler<(Input, Output)> RouteUpdated; - public event EventHandler<(Input, Output)> VolumeUpdated; + public event EventHandler<(Input, MixOut)> RouteUpdated; + public event EventHandler<(Input, MixOut)> VolumeUpdated; public RoutingTable(RawService rawService) { @@ -23,21 +23,21 @@ public RoutingTable(RawService rawService) SetupRoutes(); } - private Dictionary<(Input input, Output output), (string route, string volume)> _routes = new Dictionary<(Input input, Output output), (string route, string volume)>(); - private Dictionary _routeToKey = new Dictionary(); + private Dictionary<(Input input, MixOut output), (string route, string volume)> _routes = new Dictionary<(Input input, MixOut output), (string route, string volume)>(); + private Dictionary _routeToKey = new Dictionary(); - public bool GetRouting(Input input, Output output) + public bool GetRouting(Input input, MixOut mixOut) { - if (!_routes.TryGetValue((input, output), out var routes)) + if (!_routes.TryGetValue((input, mixOut), out var routes)) return false; var value = _rawService.GetValue(routes.route); return IsRouted(routes.route, value); } - public void SetRouting(Input input, Output output, Value value) + public void SetRouting(Input input, MixOut mixOut, Value value) { - if (!_routes.TryGetValue((input, output), out var routes)) + if (!_routes.TryGetValue((input, mixOut), out var routes)) return; var on = GetOnState(routes.route); @@ -64,9 +64,9 @@ public void SetRouting(Input input, Output output, Value value) /// /// Get volume in range of 0% - 100% /// - public float GetVolume(Input input, Output output) + public float GetVolume(Input input, MixOut mixOut) { - if (!_routes.TryGetValue((input, output), out var routes)) + if (!_routes.TryGetValue((input, mixOut), out var routes)) return 0; var value = _rawService.GetValue(routes.volume); @@ -79,9 +79,9 @@ public float GetVolume(Input input, Output output) /// /// Set volume in range of 0% - 100% /// - public void SetVolume(Input input, Output output, float value) + public void SetVolume(Input input, MixOut mixOut, float value) { - if (!_routes.TryGetValue((input, output), out var routes)) + if (!_routes.TryGetValue((input, mixOut), out var routes)) return; var floatValue = EnsureVolumeRange(value) / 100f; @@ -93,9 +93,9 @@ public void SetVolume(Input input, Output output, float value) /// Gets the volume in dB range -96dB to +10dB /// WARNING: This is a little off when it comes do decimals. /// - public float GetVolumeInDb(Input input, Output output) + public float GetVolumeInDb(Input input, MixOut mixOut) { - if (!_routes.TryGetValue((input, output), out var routes)) + if (!_routes.TryGetValue((input, mixOut), out var routes)) return -96; //We round to skip decimals (the UI is to tight): @@ -133,9 +133,9 @@ public float GetVolumeInDb(Input input, Output output) /// Sets the volume in dB range -96dB to +10dB /// WARNING: This is a little off when it comes do decimals. /// - public void SetVolumeInDb(Input input, Output output, float dbValue) + public void SetVolumeInDb(Input input, MixOut mixOut, float dbValue) { - if (!_routes.TryGetValue((input, output), out var routes)) + if (!_routes.TryGetValue((input, mixOut), out var routes)) return; var a = 0.47f; @@ -234,73 +234,73 @@ private void Syncronized() private void SetupRoutes() { - SetupRouting((Input.Mic_L, Output.Main), + SetupRouting((Input.Mic_L, MixOut.Main), "line/ch1/mute", "line/ch1/volume"); - SetupRouting((Input.Mic_L, Output.Mix_A), + SetupRouting((Input.Mic_L, MixOut.Mix_A), "line/ch1/assign_aux1", "line/ch1/aux1"); - SetupRouting((Input.Mic_L, Output.Mix_B), + SetupRouting((Input.Mic_L, MixOut.Mix_B), "line/ch1/assign_aux2", "line/ch1/aux2"); - SetupRouting((Input.Mic_R, Output.Main), + SetupRouting((Input.Mic_R, MixOut.Main), "line/ch2/mute", "line/ch2/volume"); - SetupRouting((Input.Mic_R, Output.Mix_A), + SetupRouting((Input.Mic_R, MixOut.Mix_A), "line/ch2/assign_aux1", "line/ch2/aux1"); - SetupRouting((Input.Mic_R, Output.Mix_B), + SetupRouting((Input.Mic_R, MixOut.Mix_B), "line/ch2/assign_aux2", "line/ch2/aux2"); - SetupRouting((Input.Playback, Output.Main), + SetupRouting((Input.Playback, MixOut.Main), "return/ch1/mute", "return/ch1/volume"); - SetupRouting((Input.Playback, Output.Mix_A), + SetupRouting((Input.Playback, MixOut.Mix_A), "return/ch1/assign_aux1", "return/ch1/aux1"); - SetupRouting((Input.Playback, Output.Mix_B), + SetupRouting((Input.Playback, MixOut.Mix_B), "return/ch1/assign_aux2", "return/ch1/aux2"); - SetupRouting((Input.Virtual_A, Output.Main), + SetupRouting((Input.Virtual_A, MixOut.Main), "return/ch2/mute", "return/ch2/volume"); - SetupRouting((Input.Virtual_A, Output.Mix_A), + SetupRouting((Input.Virtual_A, MixOut.Mix_A), "return/ch2/assign_aux1", "return/ch2/aux1"); - SetupRouting((Input.Virtual_A, Output.Mix_B), + SetupRouting((Input.Virtual_A, MixOut.Mix_B), "return/ch2/assign_aux2", "return/ch2/aux2"); - SetupRouting((Input.Virtual_B, Output.Main), + SetupRouting((Input.Virtual_B, MixOut.Main), "return/ch3/mute", "return/ch3/volume"); - SetupRouting((Input.Virtual_B, Output.Mix_A), + SetupRouting((Input.Virtual_B, MixOut.Mix_A), "return/ch3/assign_aux1", "return/ch3/aux1"); - SetupRouting((Input.Virtual_B, Output.Mix_B), + SetupRouting((Input.Virtual_B, MixOut.Mix_B), "return/ch3/assign_aux2", "return/ch3/aux2"); - SetupRouting((Input.Reverb, Output.Main), + SetupRouting((Input.Reverb, MixOut.Main), "fxreturn/ch1/mute", "fxreturn/ch1/volume"); - SetupRouting((Input.Reverb, Output.Mix_A), + SetupRouting((Input.Reverb, MixOut.Mix_A), "fxreturn/ch1/assign_aux1", "fxreturn/ch1/aux1"); - SetupRouting((Input.Reverb, Output.Mix_B), + SetupRouting((Input.Reverb, MixOut.Mix_B), "fxreturn/ch1/assign_aux2", "fxreturn/ch1/aux2"); - SetupRouting((Input.Mix, Output.Main), + SetupRouting((Input.Mix, MixOut.Main), "main/ch1/mute", "main/ch1/volume"); - SetupRouting((Input.Mix, Output.Mix_A), + SetupRouting((Input.Mix, MixOut.Mix_A), "aux/ch1/mute", "aux/ch1/volume"); - SetupRouting((Input.Mix, Output.Mix_B), + SetupRouting((Input.Mix, MixOut.Mix_B), "aux/ch2/mute", "aux/ch2/volume"); @@ -308,7 +308,7 @@ private void SetupRoutes() _rawService.ValueStateUpdated += ValueStateUpdated; } - private void SetupRouting((Input input, Output output) key, string routeAssign, string routeVolume) + private void SetupRouting((Input input, MixOut output) key, string routeAssign, string routeVolume) { _routeToKey[routeAssign] = key; _routeToKey[routeVolume] = key; diff --git a/Revelator.io24.Loupedeck/Adjustments/VolumeAdjustment.cs b/Revelator.io24.Loupedeck/Adjustments/VolumeAdjustment.cs index bbccaa8..3eaf487 100644 --- a/Revelator.io24.Loupedeck/Adjustments/VolumeAdjustment.cs +++ b/Revelator.io24.Loupedeck/Adjustments/VolumeAdjustment.cs @@ -11,7 +11,7 @@ namespace Loupedeck.RevelatorIo24Plugin.Adjustments class VolumeMainAdjustment : VolumeAdjustment { public VolumeMainAdjustment() - : base(Output.Main) + : base(MixOut.Main) { // } @@ -20,7 +20,7 @@ public VolumeMainAdjustment() class VolumeMixAAdjustment : VolumeAdjustment { public VolumeMixAAdjustment() - : base(Output.Mix_A) + : base(MixOut.Mix_A) { // } @@ -29,7 +29,7 @@ public VolumeMixAAdjustment() class VolumeMixBAdjustment : VolumeAdjustment { public VolumeMixBAdjustment() - : base(Output.Mix_B) + : base(MixOut.Mix_B) { // } @@ -39,12 +39,12 @@ abstract class VolumeAdjustment : PluginDynamicAdjustment { private RevelatorIo24Plugin _plugin; - private readonly Output _output; + private readonly MixOut _mixOut; - public VolumeAdjustment(Output output) + public VolumeAdjustment(MixOut mixOut) : base(true) { - _output = output; + _mixOut = mixOut; AddParameter(Input.Mic_L); AddParameter(Input.Mic_R); @@ -56,8 +56,8 @@ public VolumeAdjustment(Output output) private void AddParameter(Input input) { - var outputName = _output.ToString().Replace("_", " "); - var actionParameter = GetActionParameterFromRouting(_output, input); + var outputName = _mixOut.ToString().Replace("_", " "); + var actionParameter = GetActionParameterFromRouting(_mixOut, input); var inputDescription = input.GetDescription(); base.AddParameter(actionParameter, $"Volume: {inputDescription} - {outputName}", $"{outputName}: Volume"); } @@ -80,9 +80,9 @@ protected override bool OnUnload() return true; } - private void PropertyChanged(object sender, (Input input, Output output) e) + private void PropertyChanged(object sender, (Input input, MixOut output) e) { - if (e.output != _output) + if (e.output != _mixOut) return; var actionParameter = GetActionParameterFromRouting(e.output, e.input); @@ -149,7 +149,7 @@ protected override BitmapImage GetCommandImage(string actionParameter, PluginIma : $"Loupedeck.RevelatorIo24Plugin.Resources.Plugin.{imageName}_off-80.png"; var background = EmbeddedResources.ReadImage(path); - var outputName = _output.ToString().Replace("_", " "); + var outputName = _mixOut.ToString().Replace("_", " "); if (imageSize == PluginImageSize.Width60) { background.Resize(50, 50); @@ -186,12 +186,12 @@ private string GetImageNameFromInput(Input input) } } - private string GetActionParameterFromRouting(Output output, Input input) + private string GetActionParameterFromRouting(MixOut mixOut, Input input) { - return $"volume|{output}|{input}"; + return $"volume|{mixOut}|{input}"; } - private (Input input, Output output) GetRoutingActionParameter(string actionParameter) + private (Input input, MixOut output) GetRoutingActionParameter(string actionParameter) { var routeId = actionParameter.Split('|'); if (routeId[0] != "volume") @@ -200,7 +200,7 @@ private string GetActionParameterFromRouting(Output output, Input input) var outputString = routeId[1]; var inputString = routeId[2]; - var output = (Output)Enum.Parse(typeof(Output), outputString); + var output = (MixOut)Enum.Parse(typeof(MixOut), outputString); var input = (Input)Enum.Parse(typeof(Input), inputString); return (input, output); diff --git a/Revelator.io24.Loupedeck/Commands/RoutingCommand.cs b/Revelator.io24.Loupedeck/Commands/RoutingCommand.cs index bd4d1a8..fa87e52 100644 --- a/Revelator.io24.Loupedeck/Commands/RoutingCommand.cs +++ b/Revelator.io24.Loupedeck/Commands/RoutingCommand.cs @@ -7,7 +7,7 @@ namespace Loupedeck.RevelatorIo24Plugin.Commands class RoutingMainAdjustment : RoutingCommand { public RoutingMainAdjustment() - : base(Output.Main) + : base(MixOut.Main) { // } @@ -16,7 +16,7 @@ public RoutingMainAdjustment() class RoutingMixAAdjustment : RoutingCommand { public RoutingMixAAdjustment() - : base(Output.Mix_A) + : base(MixOut.Mix_A) { // } @@ -25,7 +25,7 @@ public RoutingMixAAdjustment() class RoutingMixBAdjustment : RoutingCommand { public RoutingMixBAdjustment() - : base(Output.Mix_B) + : base(MixOut.Mix_B) { // } @@ -34,11 +34,11 @@ public RoutingMixBAdjustment() class RoutingCommand : PluginDynamicCommand { private RevelatorIo24Plugin _plugin; - private readonly Output _output; + private readonly MixOut _mixOut; - public RoutingCommand(Output output) + public RoutingCommand(MixOut mixOut) { - _output = output; + _mixOut = mixOut; AddParameter(Input.Mic_L, Value.On); AddParameter(Input.Mic_R, Value.On); @@ -64,8 +64,8 @@ public RoutingCommand(Output output) private void AddParameter(Input input, Value value) { - var outputName = _output.ToString().Replace("_", " "); - var actionParameter = GetActionParameterFromRouting(_output, input, value); + var outputName = _mixOut.ToString().Replace("_", " "); + var actionParameter = GetActionParameterFromRouting(_mixOut, input, value); var inputDescription = input.GetDescription(); base.AddParameter(actionParameter, $"Routing: {inputDescription} - {outputName} - {value}", $"{outputName}: Routing"); } @@ -88,9 +88,9 @@ protected override bool OnUnload() return true; } - private void PropertyChanged(object sender, (Input input, Output output) e) + private void PropertyChanged(object sender, (Input input, MixOut output) e) { - if (e.output != _output) + if (e.output != _mixOut) return; var actionParameterOn = GetActionParameterFromRouting(e.output, e.input, Value.On); @@ -133,7 +133,7 @@ protected override BitmapImage GetCommandImage(string actionParameter, PluginIma : $"Loupedeck.RevelatorIo24Plugin.Resources.Plugin.{imageName}_off-80.png"; var background = EmbeddedResources.ReadImage(path); - var outputName = _output.ToString().Replace("_", " "); + var outputName = _mixOut.ToString().Replace("_", " "); if (imageSize == PluginImageSize.Width60) { background.Resize(50, 50); @@ -170,12 +170,12 @@ private string GetImageNameFromInput(Input input) } } - private string GetActionParameterFromRouting(Output output, Input input, Value value) + private string GetActionParameterFromRouting(MixOut mixOut, Input input, Value value) { - return $"routing|{output}|{input}|{value}"; + return $"routing|{mixOut}|{input}|{value}"; } - private (Output output, Input input, Value value) GetRoutingActionParameter(string actionParameter) + private (MixOut output, Input input, Value value) GetRoutingActionParameter(string actionParameter) { var routeId = actionParameter.Split('|'); if (routeId[0] != "routing") @@ -185,7 +185,7 @@ private string GetActionParameterFromRouting(Output output, Input input, Value v var inputString = routeId[2]; var valueString = routeId[3]; - var output = (Output)Enum.Parse(typeof(Output), outputString); + var output = (MixOut)Enum.Parse(typeof(MixOut), outputString); var input = (Input)Enum.Parse(typeof(Input), inputString); var value = (Value)Enum.Parse(typeof(Value), valueString); diff --git a/Revelator.io24.StreamDeck/Actions/RouteChangeAction.cs b/Revelator.io24.StreamDeck/Actions/RouteChangeAction.cs index 33f864e..a0d1c14 100644 --- a/Revelator.io24.StreamDeck/Actions/RouteChangeAction.cs +++ b/Revelator.io24.StreamDeck/Actions/RouteChangeAction.cs @@ -29,12 +29,12 @@ protected override void UnregisterCallbacks() protected override void OnButtonPress() { - _routingTable.SetRouting(_settings.Input, _settings.Output, _settings.Action); + _routingTable.SetRouting(_settings.Input, _settings.MixOut, _settings.Action); } protected override bool GetButtonState() { - return _routingTable.GetRouting(_settings.Input, _settings.Output); + return _routingTable.GetRouting(_settings.Input, _settings.MixOut); } protected override async Task SettingsChanged() @@ -43,11 +43,11 @@ protected override async Task SettingsChanged() await UpdateOutputTitle(); } - private async void RouteUpdated(object? sender, (Input input, Output output) e) + private async void RouteUpdated(object? sender, (Input input, MixOut output) e) { try { - var route = (_settings.Input, _settings.Output); + var route = (_settings.Input, Output: _settings.MixOut); if (e != route) return; @@ -89,15 +89,15 @@ private async Task UpdateInputImage() private async Task UpdateOutputTitle() { - switch (_settings.Output) + switch (_settings.MixOut) { - case Output.Mix_A: + case MixOut.Mix_A: await SetTitleAsync("Mix A"); break; - case Output.Mix_B: + case MixOut.Mix_B: await SetTitleAsync("Mix B"); break; - case Output.Main: + case MixOut.Main: default: await SetTitleAsync("Main"); break; diff --git a/Revelator.io24.StreamDeck/Actions/VolumeLevelAction.cs b/Revelator.io24.StreamDeck/Actions/VolumeLevelAction.cs index bd95a29..69c2f38 100644 --- a/Revelator.io24.StreamDeck/Actions/VolumeLevelAction.cs +++ b/Revelator.io24.StreamDeck/Actions/VolumeLevelAction.cs @@ -28,21 +28,21 @@ protected override void UnregisterCallbacks() protected override void OnButtonPress() { - var value = _routingTable.GetVolumeInDb(_settings.Input, _settings.Output); + var value = _routingTable.GetVolumeInDb(_settings.Input, _settings.MixOut); switch (_settings.ChangeType) { case VolumeType.Increment: value += _settings.Value; - _routingTable.SetVolumeInDb(_settings.Input, _settings.Output, value); + _routingTable.SetVolumeInDb(_settings.Input, _settings.MixOut, value); break; case VolumeType.Decrement: value -= _settings.Value; - _routingTable.SetVolumeInDb(_settings.Input, _settings.Output, value); + _routingTable.SetVolumeInDb(_settings.Input, _settings.MixOut, value); break; case VolumeType.Absolute: default: value = _settings.Value; - _routingTable.SetVolumeInDb(_settings.Input, _settings.Output, value); + _routingTable.SetVolumeInDb(_settings.Input, _settings.MixOut, value); break; } } @@ -55,19 +55,19 @@ protected override bool GetButtonState() protected override async Task SettingsChanged() { - var value = _routingTable.GetVolumeInDb(_settings.Input, _settings.Output); + var value = _routingTable.GetVolumeInDb(_settings.Input, _settings.MixOut); await SetTitleAsync($"{value} dB"); } - private async void VolumeUpdated(object? sender, (Input input, Output output) e) + private async void VolumeUpdated(object? sender, (Input input, MixOut output) e) { try { - var route = (_settings.Input, _settings.Output); + var route = (_settings.Input, Output: _settings.MixOut); if (e != route) return; - var value = _routingTable.GetVolumeInDb(_settings.Input, _settings.Output); + var value = _routingTable.GetVolumeInDb(_settings.Input, _settings.MixOut); await SetTitleAsync($"{value} dB"); } catch (Exception exception) diff --git a/Revelator.io24.StreamDeck/Settings/RouteChangeSettings.cs b/Revelator.io24.StreamDeck/Settings/RouteChangeSettings.cs index 5d3d5f6..6aea9e7 100644 --- a/Revelator.io24.StreamDeck/Settings/RouteChangeSettings.cs +++ b/Revelator.io24.StreamDeck/Settings/RouteChangeSettings.cs @@ -12,7 +12,7 @@ public class RouteChangeSettings [JsonConverter(typeof(StringEnumConverter))] [JsonProperty(PropertyName = "outputValue")] - public Output Output { get; set; } = Output.Main; + public MixOut MixOut { get; set; } = MixOut.Main; [JsonConverter(typeof(StringEnumConverter))] [JsonProperty(PropertyName = "actionValue")] diff --git a/Revelator.io24.StreamDeck/Settings/VolumeLevelSettings.cs b/Revelator.io24.StreamDeck/Settings/VolumeLevelSettings.cs index e5f670a..00cd633 100644 --- a/Revelator.io24.StreamDeck/Settings/VolumeLevelSettings.cs +++ b/Revelator.io24.StreamDeck/Settings/VolumeLevelSettings.cs @@ -12,7 +12,7 @@ public class VolumeLevelSettings [JsonConverter(typeof(StringEnumConverter))] [JsonProperty(PropertyName = "outputValue")] - public Output Output { get; set; } = Output.Main; + public MixOut MixOut { get; set; } = MixOut.Main; [JsonConverter(typeof(StringEnumConverter))] [JsonProperty(PropertyName = "changeType")] diff --git a/Revelator.io24.TouchPortal/Converters/OutputConverter.cs b/Revelator.io24.TouchPortal/Converters/OutputConverter.cs index e0a69bf..3a90caf 100644 --- a/Revelator.io24.TouchPortal/Converters/OutputConverter.cs +++ b/Revelator.io24.TouchPortal/Converters/OutputConverter.cs @@ -4,12 +4,12 @@ namespace Revelator.io24.TouchPortal.Converters { public static class OutputConverter { - public static Output GetOutput(string output) + public static MixOut GetOutput(string output) => output switch { - "Main" => Output.Main, - "Stream Mix A" => Output.Mix_A, - "Stream Mix B" => Output.Mix_B, + "Main" => MixOut.Main, + "Stream Mix A" => MixOut.Mix_A, + "Stream Mix B" => MixOut.Mix_B, _ => throw new InvalidOperationException() }; } diff --git a/Revelator.io24.TouchPortal/RevelatorIo24Plugin.cs b/Revelator.io24.TouchPortal/RevelatorIo24Plugin.cs index 3894bc8..a1427cd 100644 --- a/Revelator.io24.TouchPortal/RevelatorIo24Plugin.cs +++ b/Revelator.io24.TouchPortal/RevelatorIo24Plugin.cs @@ -75,7 +75,7 @@ private void Microhone_PropertyChanged(object? sender, PropertyChangedEventArgs } } - private void VolumeUpdated(object? sender, (Input input, Output output) e) + private void VolumeUpdated(object? sender, (Input input, MixOut output) e) { var value = _routingTable.GetVolume(e.input, e.output); @@ -92,7 +92,7 @@ private void VolumeUpdated(object? sender, (Input input, Output output) e) _client.SendMessage(message); } - private void RouteUpdated(object? sender, (Input input, Output output) e) + private void RouteUpdated(object? sender, (Input input, MixOut output) e) { var value = _routingTable.GetRouting(e.input, e.output); _client.StateUpdate($"{PluginId}.states.{e.input}|{e.output}", value ? "On" : "Off"); @@ -233,7 +233,7 @@ public void OnConnecterChangeEvent(ConnectorChangeEvent message) var inputDesc = message.Data.Single(d => d.Id == "tp_io24_volume_input").Value; var outputDesc = message.Data.Single(d => d.Id == "tp_io24_volume_output").Value; var input = EnumExtensions.ParseDescription(inputDesc); - var output = EnumExtensions.ParseDescription(outputDesc); + var output = EnumExtensions.ParseDescription(outputDesc); _routingTable.SetVolume(input, output, message.Value); } diff --git a/Revelator.io24.Wpf/Models/RoutingMapper.cs b/Revelator.io24.Wpf/Models/RoutingMapper.cs index 32af6f0..2b5db9f 100644 --- a/Revelator.io24.Wpf/Models/RoutingMapper.cs +++ b/Revelator.io24.Wpf/Models/RoutingMapper.cs @@ -9,128 +9,128 @@ public class RoutingMapper public bool Main_MicL { - get => GetValue(Input.Mic_L, Output.Main); - set => SetValue(Input.Mic_L, Output.Main, value); + get => GetValue(Input.Mic_L, MixOut.Main); + set => SetValue(Input.Mic_L, MixOut.Main, value); } public bool Main_MicR { - get => GetValue(Input.Mic_R, Output.Main); - set => SetValue(Input.Mic_R, Output.Main, value); + get => GetValue(Input.Mic_R, MixOut.Main); + set => SetValue(Input.Mic_R, MixOut.Main, value); } public bool Main_Playback { - get => GetValue(Input.Playback, Output.Main); - set => SetValue(Input.Playback, Output.Main, value); + get => GetValue(Input.Playback, MixOut.Main); + set => SetValue(Input.Playback, MixOut.Main, value); } public bool Main_VirtualA { - get => GetValue(Input.Virtual_A, Output.Main); - set => SetValue(Input.Virtual_A, Output.Main, value); + get => GetValue(Input.Virtual_A, MixOut.Main); + set => SetValue(Input.Virtual_A, MixOut.Main, value); } public bool Main_VirtualB { - get => GetValue(Input.Virtual_B, Output.Main); - set => SetValue(Input.Virtual_B, Output.Main, value); + get => GetValue(Input.Virtual_B, MixOut.Main); + set => SetValue(Input.Virtual_B, MixOut.Main, value); } public bool Main_Reverb { - get => GetValue(Input.Reverb, Output.Main); - set => SetValue(Input.Reverb, Output.Main, value); + get => GetValue(Input.Reverb, MixOut.Main); + set => SetValue(Input.Reverb, MixOut.Main, value); } public bool Main_Mix { - get => GetValue(Input.Mix, Output.Main); - set => SetValue(Input.Mix, Output.Main, value); + get => GetValue(Input.Mix, MixOut.Main); + set => SetValue(Input.Mix, MixOut.Main, value); } public bool MixA_MicL { - get => GetValue(Input.Mic_L, Output.Mix_A); - set => SetValue(Input.Mic_L, Output.Mix_A, value); + get => GetValue(Input.Mic_L, MixOut.Mix_A); + set => SetValue(Input.Mic_L, MixOut.Mix_A, value); } public bool MixA_MicR { - get => GetValue(Input.Mic_R, Output.Mix_A); - set => SetValue(Input.Mic_R, Output.Mix_A, value); + get => GetValue(Input.Mic_R, MixOut.Mix_A); + set => SetValue(Input.Mic_R, MixOut.Mix_A, value); } public bool MixA_Playback { - get => GetValue(Input.Playback, Output.Mix_A); - set => SetValue(Input.Playback, Output.Mix_A, value); + get => GetValue(Input.Playback, MixOut.Mix_A); + set => SetValue(Input.Playback, MixOut.Mix_A, value); } public bool MixA_VirtualA { - get => GetValue(Input.Virtual_A, Output.Mix_A); - set => SetValue(Input.Virtual_A, Output.Mix_A, value); + get => GetValue(Input.Virtual_A, MixOut.Mix_A); + set => SetValue(Input.Virtual_A, MixOut.Mix_A, value); } public bool MixA_VirtualB { - get => GetValue(Input.Virtual_B, Output.Mix_A); - set => SetValue(Input.Virtual_B, Output.Mix_A, value); + get => GetValue(Input.Virtual_B, MixOut.Mix_A); + set => SetValue(Input.Virtual_B, MixOut.Mix_A, value); } public bool MixA_Reverb { - get => GetValue(Input.Reverb, Output.Mix_A); - set => SetValue(Input.Reverb, Output.Mix_A, value); + get => GetValue(Input.Reverb, MixOut.Mix_A); + set => SetValue(Input.Reverb, MixOut.Mix_A, value); } public bool MixA_Mix { - get => GetValue(Input.Mix, Output.Mix_A); - set => SetValue(Input.Mix, Output.Mix_A, value); + get => GetValue(Input.Mix, MixOut.Mix_A); + set => SetValue(Input.Mix, MixOut.Mix_A, value); } public bool MixB_MicL { - get => GetValue(Input.Mic_L, Output.Mix_B); - set => SetValue(Input.Mic_L, Output.Mix_B, value); + get => GetValue(Input.Mic_L, MixOut.Mix_B); + set => SetValue(Input.Mic_L, MixOut.Mix_B, value); } public bool MixB_MicR { - get => GetValue(Input.Mic_R, Output.Mix_B); - set => SetValue(Input.Mic_R, Output.Mix_B, value); + get => GetValue(Input.Mic_R, MixOut.Mix_B); + set => SetValue(Input.Mic_R, MixOut.Mix_B, value); } public bool MixB_Playback { - get => GetValue(Input.Playback, Output.Mix_B); - set => SetValue(Input.Playback, Output.Mix_B, value); + get => GetValue(Input.Playback, MixOut.Mix_B); + set => SetValue(Input.Playback, MixOut.Mix_B, value); } public bool MixB_VirtualA { - get => GetValue(Input.Virtual_A, Output.Mix_B); - set => SetValue(Input.Virtual_A, Output.Mix_B, value); + get => GetValue(Input.Virtual_A, MixOut.Mix_B); + set => SetValue(Input.Virtual_A, MixOut.Mix_B, value); } public bool MixB_VirtualB { - get => GetValue(Input.Virtual_B, Output.Mix_B); - set => SetValue(Input.Virtual_B, Output.Mix_B, value); + get => GetValue(Input.Virtual_B, MixOut.Mix_B); + set => SetValue(Input.Virtual_B, MixOut.Mix_B, value); } public bool MixB_Reverb { - get => GetValue(Input.Reverb, Output.Mix_B); - set => SetValue(Input.Reverb, Output.Mix_B, value); + get => GetValue(Input.Reverb, MixOut.Mix_B); + set => SetValue(Input.Reverb, MixOut.Mix_B, value); } public bool MixB_Mix { - get => GetValue(Input.Mix, Output.Mix_B); - set => SetValue(Input.Mix, Output.Mix_B, value); + get => GetValue(Input.Mix, MixOut.Mix_B); + set => SetValue(Input.Mix, MixOut.Mix_B, value); } public RoutingMapper(RoutingTable routingTable) @@ -138,12 +138,12 @@ public RoutingMapper(RoutingTable routingTable) _routingTable = routingTable; } - private void SetValue(Input input, Output output, bool value) - => _routingTable.SetRouting(input, output, value + private void SetValue(Input input, MixOut mixOut, bool value) + => _routingTable.SetRouting(input, mixOut, value ? Value.On : Value.Off); - private bool GetValue(Input input, Output output) - => _routingTable.GetRouting(input, output); + private bool GetValue(Input input, MixOut mixOut) + => _routingTable.GetRouting(input, mixOut); } } diff --git a/Revelator.io24.Wpf/Models/VolumeDbMapper.cs b/Revelator.io24.Wpf/Models/VolumeDbMapper.cs index 9953de8..61f4f9d 100644 --- a/Revelator.io24.Wpf/Models/VolumeDbMapper.cs +++ b/Revelator.io24.Wpf/Models/VolumeDbMapper.cs @@ -9,128 +9,128 @@ public class VolumeDbMapper public float Main_MicL { - get => GetValue(Input.Mic_L, Output.Main); - set => SetValue(Input.Mic_L, Output.Main, value); + get => GetValue(Input.Mic_L, MixOut.Main); + set => SetValue(Input.Mic_L, MixOut.Main, value); } public float Main_MicR { - get => GetValue(Input.Mic_R, Output.Main); - set => SetValue(Input.Mic_R, Output.Main, value); + get => GetValue(Input.Mic_R, MixOut.Main); + set => SetValue(Input.Mic_R, MixOut.Main, value); } public float Main_Playback { - get => GetValue(Input.Playback, Output.Main); - set => SetValue(Input.Playback, Output.Main, value); + get => GetValue(Input.Playback, MixOut.Main); + set => SetValue(Input.Playback, MixOut.Main, value); } public float Main_VirtualA { - get => GetValue(Input.Virtual_A, Output.Main); - set => SetValue(Input.Virtual_A, Output.Main, value); + get => GetValue(Input.Virtual_A, MixOut.Main); + set => SetValue(Input.Virtual_A, MixOut.Main, value); } public float Main_VirtualB { - get => GetValue(Input.Virtual_B, Output.Main); - set => SetValue(Input.Virtual_B, Output.Main, value); + get => GetValue(Input.Virtual_B, MixOut.Main); + set => SetValue(Input.Virtual_B, MixOut.Main, value); } public float Main_Reverb { - get => GetValue(Input.Reverb, Output.Main); - set => SetValue(Input.Reverb, Output.Main, value); + get => GetValue(Input.Reverb, MixOut.Main); + set => SetValue(Input.Reverb, MixOut.Main, value); } public float Main_Mix { - get => GetValue(Input.Mix, Output.Main); - set => SetValue(Input.Mix, Output.Main, value); + get => GetValue(Input.Mix, MixOut.Main); + set => SetValue(Input.Mix, MixOut.Main, value); } public float MixA_MicL { - get => GetValue(Input.Mic_L, Output.Mix_A); - set => SetValue(Input.Mic_L, Output.Mix_A, value); + get => GetValue(Input.Mic_L, MixOut.Mix_A); + set => SetValue(Input.Mic_L, MixOut.Mix_A, value); } public float MixA_MicR { - get => GetValue(Input.Mic_R, Output.Mix_A); - set => SetValue(Input.Mic_R, Output.Mix_A, value); + get => GetValue(Input.Mic_R, MixOut.Mix_A); + set => SetValue(Input.Mic_R, MixOut.Mix_A, value); } public float MixA_Playback { - get => GetValue(Input.Playback, Output.Mix_A); - set => SetValue(Input.Playback, Output.Mix_A, value); + get => GetValue(Input.Playback, MixOut.Mix_A); + set => SetValue(Input.Playback, MixOut.Mix_A, value); } public float MixA_VirtualA { - get => GetValue(Input.Virtual_A, Output.Mix_A); - set => SetValue(Input.Virtual_A, Output.Mix_A, value); + get => GetValue(Input.Virtual_A, MixOut.Mix_A); + set => SetValue(Input.Virtual_A, MixOut.Mix_A, value); } public float MixA_VirtualB { - get => GetValue(Input.Virtual_B, Output.Mix_A); - set => SetValue(Input.Virtual_B, Output.Mix_A, value); + get => GetValue(Input.Virtual_B, MixOut.Mix_A); + set => SetValue(Input.Virtual_B, MixOut.Mix_A, value); } public float MixA_Reverb { - get => GetValue(Input.Reverb, Output.Mix_A); - set => SetValue(Input.Reverb, Output.Mix_A, value); + get => GetValue(Input.Reverb, MixOut.Mix_A); + set => SetValue(Input.Reverb, MixOut.Mix_A, value); } public float MixA_Mix { - get => GetValue(Input.Mix, Output.Mix_A); - set => SetValue(Input.Mix, Output.Mix_A, value); + get => GetValue(Input.Mix, MixOut.Mix_A); + set => SetValue(Input.Mix, MixOut.Mix_A, value); } public float MixB_MicL { - get => GetValue(Input.Mic_L, Output.Mix_B); - set => SetValue(Input.Mic_L, Output.Mix_B, value); + get => GetValue(Input.Mic_L, MixOut.Mix_B); + set => SetValue(Input.Mic_L, MixOut.Mix_B, value); } public float MixB_MicR { - get => GetValue(Input.Mic_R, Output.Mix_B); - set => SetValue(Input.Mic_R, Output.Mix_B, value); + get => GetValue(Input.Mic_R, MixOut.Mix_B); + set => SetValue(Input.Mic_R, MixOut.Mix_B, value); } public float MixB_Playback { - get => GetValue(Input.Playback, Output.Mix_B); - set => SetValue(Input.Playback, Output.Mix_B, value); + get => GetValue(Input.Playback, MixOut.Mix_B); + set => SetValue(Input.Playback, MixOut.Mix_B, value); } public float MixB_VirtualA { - get => GetValue(Input.Virtual_A, Output.Mix_B); - set => SetValue(Input.Virtual_A, Output.Mix_B, value); + get => GetValue(Input.Virtual_A, MixOut.Mix_B); + set => SetValue(Input.Virtual_A, MixOut.Mix_B, value); } public float MixB_VirtualB { - get => GetValue(Input.Virtual_B, Output.Mix_B); - set => SetValue(Input.Virtual_B, Output.Mix_B, value); + get => GetValue(Input.Virtual_B, MixOut.Mix_B); + set => SetValue(Input.Virtual_B, MixOut.Mix_B, value); } public float MixB_Reverb { - get => GetValue(Input.Reverb, Output.Mix_B); - set => SetValue(Input.Reverb, Output.Mix_B, value); + get => GetValue(Input.Reverb, MixOut.Mix_B); + set => SetValue(Input.Reverb, MixOut.Mix_B, value); } public float MixB_Mix { - get => GetValue(Input.Mix, Output.Mix_B); - set => SetValue(Input.Mix, Output.Mix_B, value); + get => GetValue(Input.Mix, MixOut.Mix_B); + set => SetValue(Input.Mix, MixOut.Mix_B, value); } public VolumeDbMapper(RoutingTable routingTable) @@ -138,10 +138,10 @@ public VolumeDbMapper(RoutingTable routingTable) _routingTable = routingTable; } - private float GetValue(Input input, Output output) - => _routingTable.GetVolumeInDb(input, output); + private float GetValue(Input input, MixOut mixOut) + => _routingTable.GetVolumeInDb(input, mixOut); - private void SetValue(Input input, Output output, float value) - => _routingTable.SetVolumeInDb(input, output, value); + private void SetValue(Input input, MixOut mixOut, float value) + => _routingTable.SetVolumeInDb(input, mixOut, value); } } diff --git a/Revelator.io24.Wpf/Models/VolumeMapper.cs b/Revelator.io24.Wpf/Models/VolumeMapper.cs index 18279ff..2539ae3 100644 --- a/Revelator.io24.Wpf/Models/VolumeMapper.cs +++ b/Revelator.io24.Wpf/Models/VolumeMapper.cs @@ -8,128 +8,128 @@ public class VolumeMapper public float Main_MicL { - get => GetValue(Input.Mic_L, Output.Main); - set => SetValue(Input.Mic_L, Output.Main, value); + get => GetValue(Input.Mic_L, MixOut.Main); + set => SetValue(Input.Mic_L, MixOut.Main, value); } public float Main_MicR { - get => GetValue(Input.Mic_R, Output.Main); - set => SetValue(Input.Mic_R, Output.Main, value); + get => GetValue(Input.Mic_R, MixOut.Main); + set => SetValue(Input.Mic_R, MixOut.Main, value); } public float Main_Playback { - get => GetValue(Input.Playback, Output.Main); - set => SetValue(Input.Playback, Output.Main, value); + get => GetValue(Input.Playback, MixOut.Main); + set => SetValue(Input.Playback, MixOut.Main, value); } public float Main_VirtualA { - get => GetValue(Input.Virtual_A, Output.Main); - set => SetValue(Input.Virtual_A, Output.Main, value); + get => GetValue(Input.Virtual_A, MixOut.Main); + set => SetValue(Input.Virtual_A, MixOut.Main, value); } public float Main_VirtualB { - get => GetValue(Input.Virtual_B, Output.Main); - set => SetValue(Input.Virtual_B, Output.Main, value); + get => GetValue(Input.Virtual_B, MixOut.Main); + set => SetValue(Input.Virtual_B, MixOut.Main, value); } public float Main_Reverb { - get => GetValue(Input.Reverb, Output.Main); - set => SetValue(Input.Reverb, Output.Main, value); + get => GetValue(Input.Reverb, MixOut.Main); + set => SetValue(Input.Reverb, MixOut.Main, value); } public float Main_Mix { - get => GetValue(Input.Mix, Output.Main); - set => SetValue(Input.Mix, Output.Main, value); + get => GetValue(Input.Mix, MixOut.Main); + set => SetValue(Input.Mix, MixOut.Main, value); } public float MixA_MicL { - get => GetValue(Input.Mic_L, Output.Mix_A); - set => SetValue(Input.Mic_L, Output.Mix_A, value); + get => GetValue(Input.Mic_L, MixOut.Mix_A); + set => SetValue(Input.Mic_L, MixOut.Mix_A, value); } public float MixA_MicR { - get => GetValue(Input.Mic_R, Output.Mix_A); - set => SetValue(Input.Mic_R, Output.Mix_A, value); + get => GetValue(Input.Mic_R, MixOut.Mix_A); + set => SetValue(Input.Mic_R, MixOut.Mix_A, value); } public float MixA_Playback { - get => GetValue(Input.Playback, Output.Mix_A); - set => SetValue(Input.Playback, Output.Mix_A, value); + get => GetValue(Input.Playback, MixOut.Mix_A); + set => SetValue(Input.Playback, MixOut.Mix_A, value); } public float MixA_VirtualA { - get => GetValue(Input.Virtual_A, Output.Mix_A); - set => SetValue(Input.Virtual_A, Output.Mix_A, value); + get => GetValue(Input.Virtual_A, MixOut.Mix_A); + set => SetValue(Input.Virtual_A, MixOut.Mix_A, value); } public float MixA_VirtualB { - get => GetValue(Input.Virtual_B, Output.Mix_A); - set => SetValue(Input.Virtual_B, Output.Mix_A, value); + get => GetValue(Input.Virtual_B, MixOut.Mix_A); + set => SetValue(Input.Virtual_B, MixOut.Mix_A, value); } public float MixA_Reverb { - get => GetValue(Input.Reverb, Output.Mix_A); - set => SetValue(Input.Reverb, Output.Mix_A, value); + get => GetValue(Input.Reverb, MixOut.Mix_A); + set => SetValue(Input.Reverb, MixOut.Mix_A, value); } public float MixA_Mix { - get => GetValue(Input.Mix, Output.Mix_A); - set => SetValue(Input.Mix, Output.Mix_A, value); + get => GetValue(Input.Mix, MixOut.Mix_A); + set => SetValue(Input.Mix, MixOut.Mix_A, value); } public float MixB_MicL { - get => GetValue(Input.Mic_L, Output.Mix_B); - set => SetValue(Input.Mic_L, Output.Mix_B, value); + get => GetValue(Input.Mic_L, MixOut.Mix_B); + set => SetValue(Input.Mic_L, MixOut.Mix_B, value); } public float MixB_MicR { - get => GetValue(Input.Mic_R, Output.Mix_B); - set => SetValue(Input.Mic_R, Output.Mix_B, value); + get => GetValue(Input.Mic_R, MixOut.Mix_B); + set => SetValue(Input.Mic_R, MixOut.Mix_B, value); } public float MixB_Playback { - get => GetValue(Input.Playback, Output.Mix_B); - set => SetValue(Input.Playback, Output.Mix_B, value); + get => GetValue(Input.Playback, MixOut.Mix_B); + set => SetValue(Input.Playback, MixOut.Mix_B, value); } public float MixB_VirtualA { - get => GetValue(Input.Virtual_A, Output.Mix_B); - set => SetValue(Input.Virtual_A, Output.Mix_B, value); + get => GetValue(Input.Virtual_A, MixOut.Mix_B); + set => SetValue(Input.Virtual_A, MixOut.Mix_B, value); } public float MixB_VirtualB { - get => GetValue(Input.Virtual_B, Output.Mix_B); - set => SetValue(Input.Virtual_B, Output.Mix_B, value); + get => GetValue(Input.Virtual_B, MixOut.Mix_B); + set => SetValue(Input.Virtual_B, MixOut.Mix_B, value); } public float MixB_Reverb { - get => GetValue(Input.Reverb, Output.Mix_B); - set => SetValue(Input.Reverb, Output.Mix_B, value); + get => GetValue(Input.Reverb, MixOut.Mix_B); + set => SetValue(Input.Reverb, MixOut.Mix_B, value); } public float MixB_Mix { - get => GetValue(Input.Mix, Output.Mix_B); - set => SetValue(Input.Mix, Output.Mix_B, value); + get => GetValue(Input.Mix, MixOut.Mix_B); + set => SetValue(Input.Mix, MixOut.Mix_B, value); } public VolumeMapper(RoutingTable routingTable) @@ -137,10 +137,10 @@ public VolumeMapper(RoutingTable routingTable) _routingTable = routingTable; } - private float GetValue(Input input, Output output) - => _routingTable.GetVolume(input, output); + private float GetValue(Input input, MixOut mixOut) + => _routingTable.GetVolume(input, mixOut); - private void SetValue(Input input, Output output, float value) - => _routingTable.SetVolume(input, output, value); + private void SetValue(Input input, MixOut mixOut, float value) + => _routingTable.SetVolume(input, mixOut, value); } } From d80deedd00cb466d471ccec8ccdfe5f6c3b640d2 Mon Sep 17 00:00:00 2001 From: oddbear Date: Mon, 30 May 2022 17:52:01 +0200 Subject: [PATCH 2/2] Added Device Output control. --- Revelator.io24.Api/Enums/DeviceOut.cs | 14 +++ .../Services/BroadcastService.cs | 18 ++- .../Adjustments/BlendOutAdjustment.cs | 103 ++++++++++++++++++ .../Adjustments/MainOutAdjustment.cs | 98 +++++++++++++++++ .../Adjustments/PhonesOutAdjustment .cs | 98 +++++++++++++++++ .../Adjustments/VolumeAdjustment.cs | 4 - .../Commands/PresetsCommand.cs | 8 +- .../Properties/AssemblyInfo.cs | 2 +- .../Resources/Plugin/blend-80.png | Bin 0 -> 3259 bytes .../Revelator.io24.Loupedeck.csproj | 8 ++ 10 files changed, 343 insertions(+), 10 deletions(-) create mode 100644 Revelator.io24.Api/Enums/DeviceOut.cs create mode 100644 Revelator.io24.Loupedeck/Adjustments/BlendOutAdjustment.cs create mode 100644 Revelator.io24.Loupedeck/Adjustments/MainOutAdjustment.cs create mode 100644 Revelator.io24.Loupedeck/Adjustments/PhonesOutAdjustment .cs create mode 100644 Revelator.io24.Loupedeck/Resources/Plugin/blend-80.png diff --git a/Revelator.io24.Api/Enums/DeviceOut.cs b/Revelator.io24.Api/Enums/DeviceOut.cs new file mode 100644 index 0000000..84ee05f --- /dev/null +++ b/Revelator.io24.Api/Enums/DeviceOut.cs @@ -0,0 +1,14 @@ +using System.ComponentModel; + +namespace Revelator.io24.Api.Enums +{ + public enum DeviceOut + { + [Description("Main Out")] + MainOut, + [Description("Phones")] + Phones, + [Description("Blend")] + Blend + } +} diff --git a/Revelator.io24.Api/Services/BroadcastService.cs b/Revelator.io24.Api/Services/BroadcastService.cs index a5dd48d..0b2f1f6 100644 --- a/Revelator.io24.Api/Services/BroadcastService.cs +++ b/Revelator.io24.Api/Services/BroadcastService.cs @@ -4,6 +4,7 @@ using System; using System.Net; using System.Net.Sockets; +using System.Text; using System.Threading; namespace Revelator.io24.Api.Services @@ -85,7 +86,22 @@ private void Listener() continue; } - //TODO: What if... multiple devices? + //try + //{ + // var deviceString = Encoding.UTF8.GetString(data.Range(32)); + // var segments = deviceString.Split('\0'); + // var deviceName = segments[0].Split('/')[0]; //"Revelator IO 24" or "Revelator IO 44" + // var firmware = segments[0].Split('/')[1]; //289 + // var deviceType = segments[1]; //AUD + // var serialNumber = segments[2]; //AB1234567890 + + // if (deviceName != "Revelator IO 44") + // continue; + //} + //catch (Exception) + //{ + // continue; + //} if (!_communicationService.IsConnected) { diff --git a/Revelator.io24.Loupedeck/Adjustments/BlendOutAdjustment.cs b/Revelator.io24.Loupedeck/Adjustments/BlendOutAdjustment.cs new file mode 100644 index 0000000..a0fa501 --- /dev/null +++ b/Revelator.io24.Loupedeck/Adjustments/BlendOutAdjustment.cs @@ -0,0 +1,103 @@ +using System.ComponentModel; +using Revelator.io24.Api.Models.Global; + +namespace Loupedeck.RevelatorIo24Plugin.Adjustments +{ + class BlendOutAdjustment : PluginDynamicAdjustment + { + protected RevelatorIo24Plugin _plugin; + + public BlendOutAdjustment() + : base("Blend", "Adjust Main Out and Phones blend ratio", "Device Outputs", true) + { + // + } + + protected override bool OnLoad() + { + _plugin = (RevelatorIo24Plugin)base.Plugin; + _plugin.Device.Global.PropertyChanged += PropertyChanged; + return true; + } + + protected override bool OnUnload() + { + _plugin.Device.Global.PropertyChanged -= PropertyChanged; + + return true; + } + + private void PropertyChanged(object sender, PropertyChangedEventArgs e) + { + if (e.PropertyName != nameof(Global.MonitorBlend)) + return; + + base.AdjustmentValueChanged(); + } + + protected override void RunCommand(string actionParameter) + { + _plugin.Device.Global.MonitorBlend = 0.5f; + + base.ActionImageChanged(actionParameter); + } + + protected override void ApplyAdjustment(string actionParameter, int diff) + { + var volume = _plugin.Device.Global.MonitorBlend * 100; + + volume += (diff * 2); + volume /= 100; + + if (volume < 0) + volume = 0; + + if (volume > 1) + volume = 1; + + _plugin.Device.Global.MonitorBlend = volume; + + base.AdjustmentValueChanged(actionParameter); + } + + protected override string GetAdjustmentValue(string actionParameter) + { + //-1.0: 0f + //+0.0: 0.5f + //+1.0: 1f + var value = _plugin.Device.Global.MonitorBlend; + var blendRatio = (value - 0.5f) * 2; + + return $"{blendRatio:0.00}"; + } + + protected override BitmapImage GetCommandImage(string actionParameter, PluginImageSize imageSize) + { + if (_plugin.Device is null) + return base.GetCommandImage(actionParameter, imageSize); + + using (var bitmapBuilder = new BitmapBuilder(imageSize)) + { + bitmapBuilder.Clear(BitmapColor.Black); + + var path = "Loupedeck.RevelatorIo24Plugin.Resources.Plugin.blend-80.png"; + + var background = EmbeddedResources.ReadImage(path); + var outputName = "Blend"; + if (imageSize == PluginImageSize.Width60) + { + background.Resize(50, 50); + bitmapBuilder.SetBackgroundImage(background); + bitmapBuilder.DrawText(outputName, 0, 40, 50, 0); + } + else + { + bitmapBuilder.SetBackgroundImage(background); + bitmapBuilder.DrawText(outputName, 0, 60, 80, 0); + } + + return bitmapBuilder.ToImage(); + } + } + } +} \ No newline at end of file diff --git a/Revelator.io24.Loupedeck/Adjustments/MainOutAdjustment.cs b/Revelator.io24.Loupedeck/Adjustments/MainOutAdjustment.cs new file mode 100644 index 0000000..2948932 --- /dev/null +++ b/Revelator.io24.Loupedeck/Adjustments/MainOutAdjustment.cs @@ -0,0 +1,98 @@ +using System.ComponentModel; +using Revelator.io24.Api.Models.Global; + +namespace Loupedeck.RevelatorIo24Plugin.Adjustments +{ + class MainOutAdjustment : PluginDynamicAdjustment + { + protected RevelatorIo24Plugin _plugin; + + public MainOutAdjustment() + : base("Main Out", "Adjust Main Out Volume", "Device Outputs", true) + { + // + } + + protected override bool OnLoad() + { + _plugin = (RevelatorIo24Plugin)base.Plugin; + _plugin.Device.Global.PropertyChanged += PropertyChanged; + return true; + } + + protected override bool OnUnload() + { + _plugin.Device.Global.PropertyChanged -= PropertyChanged; + + return true; + } + + private void PropertyChanged(object sender, PropertyChangedEventArgs e) + { + if (e.PropertyName != nameof(Global.MainOutVolume)) + return; + + base.AdjustmentValueChanged(); + } + + protected override void RunCommand(string actionParameter) + { + _plugin.Device.Global.MainOutVolume = 50; + + base.ActionImageChanged(actionParameter); + } + + protected override void ApplyAdjustment(string actionParameter, int diff) + { + var volume = _plugin.Device.Global.MainOutVolume; + + volume += diff; + + if (volume < 0) + volume = 0; + + if (volume > 100) + volume = 100; + + _plugin.Device.Global.MainOutVolume = volume; + + base.AdjustmentValueChanged(actionParameter); + } + + protected override string GetAdjustmentValue(string actionParameter) + { + var volume = _plugin.Device.Global.MainOutVolume; + + return $"{volume}"; + } + + protected override BitmapImage GetCommandImage(string actionParameter, PluginImageSize imageSize) + { + if (_plugin.Device is null) + return base.GetCommandImage(actionParameter, imageSize); + + using (var bitmapBuilder = new BitmapBuilder(imageSize)) + { + bitmapBuilder.Clear(BitmapColor.Black); + + var path = "Loupedeck.RevelatorIo24Plugin.Resources.Plugin.output_on-80.png"; + + var background = EmbeddedResources.ReadImage(path); + var outputName = "Monitor"; + if (imageSize == PluginImageSize.Width60) + { + background.Resize(50, 50); + bitmapBuilder.SetBackgroundImage(background); + bitmapBuilder.DrawText(outputName, 0, 40, 50, 0); + } + else + { + bitmapBuilder.SetBackgroundImage(background); + bitmapBuilder.DrawText(outputName, 0, 60, 80, 0); + } + + return bitmapBuilder.ToImage(); + } + } + } +} diff --git a/Revelator.io24.Loupedeck/Adjustments/PhonesOutAdjustment .cs b/Revelator.io24.Loupedeck/Adjustments/PhonesOutAdjustment .cs new file mode 100644 index 0000000..e39cf36 --- /dev/null +++ b/Revelator.io24.Loupedeck/Adjustments/PhonesOutAdjustment .cs @@ -0,0 +1,98 @@ +using System.ComponentModel; +using Revelator.io24.Api.Models.Global; + +namespace Loupedeck.RevelatorIo24Plugin.Adjustments +{ + class PhonesOutAdjustment : PluginDynamicAdjustment + { + protected RevelatorIo24Plugin _plugin; + + public PhonesOutAdjustment() + : base("Phones", "Adjust Phones Volume", "Device Outputs", true) + { + // + } + + protected override bool OnLoad() + { + _plugin = (RevelatorIo24Plugin)base.Plugin; + _plugin.Device.Global.PropertyChanged += PropertyChanged; + return true; + } + + protected override bool OnUnload() + { + _plugin.Device.Global.PropertyChanged -= PropertyChanged; + + return true; + } + + private void PropertyChanged(object sender, PropertyChangedEventArgs e) + { + if (e.PropertyName != nameof(Global.HeadphonesVolume)) + return; + + base.AdjustmentValueChanged(); + } + + protected override void RunCommand(string actionParameter) + { + _plugin.Device.Global.HeadphonesVolume = 50; + + base.ActionImageChanged(actionParameter); + } + + protected override void ApplyAdjustment(string actionParameter, int diff) + { + var volume = _plugin.Device.Global.HeadphonesVolume; + + volume += diff; + + if (volume < 0) + volume = 0; + + if (volume > 100) + volume = 100; + + _plugin.Device.Global.HeadphonesVolume = volume; + + base.AdjustmentValueChanged(actionParameter); + } + + protected override string GetAdjustmentValue(string actionParameter) + { + var volume = _plugin.Device.Global.HeadphonesVolume; + + return $"{volume}"; + } + + protected override BitmapImage GetCommandImage(string actionParameter, PluginImageSize imageSize) + { + if (_plugin.Device is null) + return base.GetCommandImage(actionParameter, imageSize); + + using (var bitmapBuilder = new BitmapBuilder(imageSize)) + { + bitmapBuilder.Clear(BitmapColor.Black); + + var path = "Loupedeck.RevelatorIo24Plugin.Resources.Plugin.headphones_on-80.png"; + + var background = EmbeddedResources.ReadImage(path); + var outputName = "Phones"; + if (imageSize == PluginImageSize.Width60) + { + background.Resize(50, 50); + bitmapBuilder.SetBackgroundImage(background); + bitmapBuilder.DrawText(outputName, 0, 40, 50, 0); + } + else + { + bitmapBuilder.SetBackgroundImage(background); + bitmapBuilder.DrawText(outputName, 0, 60, 80, 0); + } + + return bitmapBuilder.ToImage(); + } + } + } +} diff --git a/Revelator.io24.Loupedeck/Adjustments/VolumeAdjustment.cs b/Revelator.io24.Loupedeck/Adjustments/VolumeAdjustment.cs index 3eaf487..15f57d0 100644 --- a/Revelator.io24.Loupedeck/Adjustments/VolumeAdjustment.cs +++ b/Revelator.io24.Loupedeck/Adjustments/VolumeAdjustment.cs @@ -1,10 +1,6 @@ using Revelator.io24.Api.Enums; using Revelator.io24.Api.Extensions; using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace Loupedeck.RevelatorIo24Plugin.Adjustments { diff --git a/Revelator.io24.Loupedeck/Commands/PresetsCommand.cs b/Revelator.io24.Loupedeck/Commands/PresetsCommand.cs index 0affcce..c2ef213 100644 --- a/Revelator.io24.Loupedeck/Commands/PresetsCommand.cs +++ b/Revelator.io24.Loupedeck/Commands/PresetsCommand.cs @@ -5,18 +5,18 @@ namespace Loupedeck.RevelatorIo24Plugin.Commands { - class PresetsLeftComamnd : PresetsCommand + class PresetsLeftCommand : PresetsCommand { - public PresetsLeftComamnd() + public PresetsLeftCommand() : base(MicrophoneChannel.Left) { } } - class PresetsRightComamnd : PresetsCommand + class PresetsRightCommand : PresetsCommand { - public PresetsRightComamnd() + public PresetsRightCommand() : base(MicrophoneChannel.Right) { diff --git a/Revelator.io24.Loupedeck/Properties/AssemblyInfo.cs b/Revelator.io24.Loupedeck/Properties/AssemblyInfo.cs index 856a1cd..0952a53 100644 --- a/Revelator.io24.Loupedeck/Properties/AssemblyInfo.cs +++ b/Revelator.io24.Loupedeck/Properties/AssemblyInfo.cs @@ -4,7 +4,7 @@ // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. -[assembly: AssemblyTitle("Revelator")] +[assembly: AssemblyTitle("Revelator io24")] [assembly: AssemblyDescription("A plugin for the Revelator io24 audio interface.")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("oddbear")] diff --git a/Revelator.io24.Loupedeck/Resources/Plugin/blend-80.png b/Revelator.io24.Loupedeck/Resources/Plugin/blend-80.png new file mode 100644 index 0000000000000000000000000000000000000000..6ee0d6b492ad5c35e49e6603347276835ae1d76f GIT binary patch literal 3259 zcmah~c_5Ve8=s_dY|7EHHEE1dQf3ArlfgJb7<%q@i+A}Iji!~6g$ zorQ%4UJUqOx{ZRvW=;43SUADO4Q9jU0x)BwF%k{8P=J|p$rOx-?e8t(sGG>{{Box2^m;j5dF*VBF|JfI+aOgQD`lY+&JA(fOXP!AhG?*s(Z>2lXfFd3jDZY zlQ4Wbp8?FS<~jn$;Lok*mJGVI4KNHMi;9H{^~nH*7|7tmE&Lb&i)@aP_6&pm$$fV9 z+20(sfZQAm&cy}eKywFKN13<$6Ruc8~Z9Ye5j`}A4 zxyyewKtR8_J#a9A6Am>$;=slHkOWo3!nxoG>`Fuifb%t)4i>>T$%jC6lLM2xHpRGW zG+1_CIC7*rIwhliRo2F2?&ZE+Fa1s#K4X-8aOM*{E~zi4b(EE5F10C~&@0SXm7|uk?{49GiQHA)rpD5dpExJh ztE<%-jnR(yy5Q3$JIVTLBQfQUzok#swfbH_l$Twqh6*t0p3M^mzTF8xf3(WBy3SU4 zbkquU&xDuMr0_$4=2>-ASgB}7?YT_LyM?`ahDE)t1T9?3W~`|H>_KNgpSPI_YQa}# zBHkA^EUPXU#IO4;cX>~ZBDB-(H^YPy?c2K0m^boBqx9)^8;z-zVMU_K6?q31-!IYI z!&gU|^(Yov zKXhyGRsyN6RZPm>6d%P!Y<@Q)zGJB<*6kgMT=ytKyXIt@g<<@qQXL~tJt8DcOExFp zPm>$C=wi#(-(Nd2>IV;Wc{Hi)l-JiPQ%eiiTzyd^0=6W{#=*N$E2-pN%aUu4lb$IZ zI#s(P<&t4qmSFUGh<77AFtSavbVI8vN$35R8{58T>eZeX4iAqZ!jcF^lon(5@P?s~ z*sL)JT$O)dGEJ*;)rXO2~fxlL`7z=$t9@n>a*j1IuCw^G^PvdA6!v&rdq5muZ?yV8Vz!)9$${m zSvxF8t;H#IN-8k28?B}k1!-%QL$zjx<1(&oMh5@VnfzqJMeuX~vm}+i3{>)#$QF0x zJ#KKnZ12HAOB@}7-t+GD&F+(aPg*A8RDEdFfPy~={oxgn!O4ksLA!s5jtCm{z^m?D z{YxhGr0Tl7nQk|>)kELZ4(iGF{DQ&0`q+$4%Zv4o8UqX7I2CW0)_VDUTK&VIHuaev z+i(#}ovR;M^(MCHIZh#J&%RA@o-Lc!3N_7Q1?KHVqluSeQmlJ5lC^)i?Nc^jQP*<2 z8C~{%QJZq*^~^ZxmXv6(sPL>I15^ELP6l0^i4YBDjZNj#dqaq^pFCZ43Nm9a%APKn zP&M5~%Z)j3^ZdEjJ!_A#_l!E-fp@;TE_$9ga6j};LaRmm&iz1OttKI!?z(ks%?pSr$FlPp1GL-|;UZcAPT9w~FQ5kA z5r)`ng>r5f-7{4hnaX?tlhfCE%e5RG9=o$keZBWE?-hImf0h+e>^H7SU5><~7%w=) zzuf$bHzV#5o|pXe>vX~cr?~UK%gUb{e^3*Z^CQCKsdCY=$>wJy3FO|=8*$|&Doc)< zonM2vXKwsMjb4?@MQ@ zG{W4+D#E^VQ$bkYeIsh!F23KLp1nSMstu`oT=wKvwKXeeoXg^exDy!rT}-^I{&7X& zuyxI1t5Xi+A#aV8bl!`$xK*ucT9%ia|ChJ@IR|9I!_(}3Nx1*xj;5-(v+gxYl?ss5 zM1b&veKZom$lmank$b`k=WnVNmt7>|pl2*O<5F7mf^&6PoHM zxxHiS!?bFzk~+(K#T2DSmA77%FGlVwCnt)Ou9_z7ke%6F8h@;7O_8=7+a}~jG37+- z$Fgk`J;gfTon7&wX4#kt#LTMBCr$2YPh41gO8kvbf7AY5X-`$l#C1ojNDuGDw!V6L zytiSSCPZFLlM%z?(WFduHn|{bzmc(|J2xtA@1mc_Rrii`)vjDN?dnmkXIj>e{)ni_ zZBcGfy0Dc3En1^ + + + @@ -163,5 +166,10 @@ Always + + + Always + + \ No newline at end of file