Skip to content
This repository has been archived by the owner on May 20, 2024. It is now read-only.

Commit

Permalink
v1.7.0
Browse files Browse the repository at this point in the history
  • Loading branch information
shells-dw committed Dec 22, 2022
1 parent 02e5c75 commit 3ebb1f1
Show file tree
Hide file tree
Showing 24 changed files with 2,842 additions and 167 deletions.
4 changes: 2 additions & 2 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ dotnet_code_quality_unused_parameters = all:warning
# var preferences
csharp_style_var_elsewhere = true:silent
csharp_style_var_for_built_in_types = true:warning
csharp_style_var_when_type_is_apparent = true:warning
csharp_style_var_when_type_is_apparent = true:silent

# Expression-bodied members
csharp_style_expression_bodied_accessors = when_on_single_line:suggestion
Expand All @@ -92,7 +92,7 @@ csharp_prefer_static_local_function = false:warning
csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async

# Code-block preferences
csharp_prefer_braces = true:warning
csharp_prefer_braces = true:when_multiline
csharp_prefer_simple_using_statement = false:warning

# Expression-level preferences
Expand Down
18 changes: 16 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,15 @@ contains the file settings.json (which is created with default values during the
"backgroundPort": "7002",
"backgroundSendPort": "9002",
"mirroringEnabled": "true",
"skipChecks": "false"
"skipChecks": "false",
"enableLogging": "false"
}
```
where you can configure non-default values or the TotalMix connection.

Note: mirroring of TotalMix is on by default (when you change some values in TotalMix itself or by other means outside the Loupedeck it will be reflected on the Loupedeck plugin), but it has a slight delay as the plugin queries TotalMix. It can have a bit of an performance impact constantly querying the data, which shouldn't be noticeable on most machines, but just in case mirroring isn't needed or wanted, it can be turned off here.
Note: mirroring of TotalMix is on by default (when you change some values in TotalMix itself or by other means outside the Loupedeck it will be reflected on the Loupedeck plugin), but it has a slight delay as the plugin queries TotalMix. It can have a bit of a performance impact constantly querying the data, which shouldn't be noticeable on most machines, but just in case mirroring isn't needed or wanted, it can be turned off here.
Also note, mirroring only works for all the main functions, mute, solo, phantom power, volume, gain and pan.
Also note: Logging is for debugging only. It will significantly slow down Loupedeck overall as traces are gathered and written all over the place. DO NOT ENABLE logging unless you are asked to provide logs and disable it afterwards.

## Usage
### General
Expand Down Expand Up @@ -111,6 +113,17 @@ or use Ko-Fi [![ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi


# Changelog
## [1.7.0] - 2022-12-22
### Addded
- Logging, new config switch to enable/disable logging (note: Logging is for debugging only. It will significantly slow down Loupedeck overall as traces are gathered and written all over the place. DO NOT ENABLE logging unless you are asked to provide logs and disable it afterwards.)
### Fixed
- Custom config file values were overwritten with every plugin start (oops.)
- Channels >9 were not mirrored (but still functioned as actions)
### Fix attempt
- Rare crash caused by waiting for a callback on async reading a socket that was already disposed. I call it fix attempt as I did not yet find the reason why this happens in the first place, it has been a b[...] to track down as it could happen after several hours of plugin runtime or not at all for days on my machine, so for now the exception is caught and the plugin shouldn't crash from it anymore. Depending the actual root cause this may or may not lead to the mirroring getting stuck. Please report issues if it does. As said, I had a hard time to actually get that crash on my machine with my interface.

<details><summary>Changelog History</summary><p>

## [1.6.1] - 2022-12-18
### Fixed
- Master Volume value not updating correctly. Note: removing and replacing the Master Volume dial on the Loupedeck is required to apply the change.
Expand Down Expand Up @@ -150,6 +163,7 @@ or use Ko-Fi [![ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi
### Added
Initial release

</p></details>

<!-- Reference Links -->

Expand Down
4 changes: 2 additions & 2 deletions TotalMixPlugin/Actions/FX.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ protected override BitmapImage GetCommandImage(String actionParameter, PluginIma
bitmapBuilder.FillRectangle(0, 0, 80, 80, BitmapColor.White);

// draw icons for different cases
bitmapBuilder.DrawText("⚠️", x: 45, y: 10, width: 70, height: 70, BitmapColor.Black, fontSize: 60);
bitmapBuilder.DrawText("Error", x: 10, y: 10, width: 30, height: 30, fontSize: 14, color: BitmapColor.Black);
bitmapBuilder.SetBackgroundImage(EmbeddedResources.ReadImage(EmbeddedResources.FindFile("mixerRed80.png")));
bitmapBuilder.DrawText("No Connection", x: 5, y: 50, width: 70, height: 40, fontSize: 15, color: BitmapColor.Black);
return bitmapBuilder.ToImage();
}
} // getting the currentState from Global variable
Expand Down
29 changes: 16 additions & 13 deletions TotalMixPlugin/Actions/InputChannelAdjustments.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@
namespace Loupedeck.TotalMixPlugin
{
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Loupedeck.TotalMixPlugin.Actions;

public class InputChannelAdjustments : PluginDynamicAdjustment
{
Expand Down Expand Up @@ -34,7 +31,7 @@ protected override PluginProfileActionData GetProfileActionData()
}
return tree;
}
protected override bool OnLoad()
protected override Boolean OnLoad()
{
this._plugin = base.Plugin as TotalMixPlugin;
if (this._plugin is null)
Expand Down Expand Up @@ -114,10 +111,12 @@ private String GetValue(String actionParameter)
try
{
Globals.bankSettings[$"{this.bus}"].TryGetValue($"/1/{action}{channel}Val", out var outputValue);
if (Globals.loggingEnabled) Tracer.Trace($"TotalMix: Dial _ Bus: {this.bus} _ Address: /1/{action}{channel}Val _ Value: {outputValue}");
return outputValue;
}
catch
catch (Exception ex)
{
if (Globals.loggingEnabled) Tracer.Warning($"TotalMix: Dial _ Bus: {this.bus} _ Address: /1/{action}{channel}Val _ Error: {ex.Message}");
return "\t❌";
}
}
Expand All @@ -143,10 +142,12 @@ private String GetValue(String actionParameter)
{
outputValue = $"{Math.Round(newValue * -1)} >";
}
if (Globals.loggingEnabled) Tracer.Trace($"TotalMix: Dial _ Bus: {this.bus} _ Address: /1/{action}{channel}Val _ Value: {outputValue}");
return outputValue;
}
catch
catch (Exception ex)
{
if (Globals.loggingEnabled) Tracer.Warning($"TotalMix: Dial _ Bus: {this.bus} _ Address: /1/{action}{channel}Val _ Error: {ex.Message}");
return "\t❌";
}
}
Expand Down Expand Up @@ -176,22 +177,26 @@ private String GetValue(String actionParameter)
return outputValue = "0 dB";
}
outputValue = $"{Math.Round(newValue)} dB";
if (Globals.loggingEnabled) Tracer.Trace($"TotalMix: Dial _ Bus: {this.bus} _ Address: /1/{action}{channel}Val _ Value: {outputValue}");
return outputValue;
}
catch
catch (Exception ex)
{
if (Globals.loggingEnabled) Tracer.Warning($"TotalMix: Dial _ Bus: {this.bus} _ Address: /1/{action}{channel}Val _ Error: {ex.Message}");
return "\t❌";
}
}
// if none of the above, see what's in the Global Dict and use that
else
{
Globals.bankSettings[$"{this.bus}"].TryGetValue($"/1/{action}{channel}Val", out var outputValue);
if (Globals.loggingEnabled) Tracer.Trace($"TotalMix: Dial _ Bus: {this.bus} _ Address: /1/{action}{channel}Val _ Value: {outputValue}");
return outputValue;
}
} catch
}
catch (Exception ex)
{

if (Globals.loggingEnabled) Tracer.Error($"TotalMix: Dial _ Bus: {this.bus} _ Address: /1/{action}{channel}Val _ Error: {ex.Message}");
}
}
return "err";
Expand All @@ -209,8 +214,8 @@ protected override BitmapImage GetAdjustmentImage(String actionParameter, Plugin
bitmapBuilder.FillRectangle(0, 0, 80, 80, BitmapColor.White);

// draw icons for different cases
bitmapBuilder.DrawText("⚠️", x: 25, y: 0, width: 40, height: 40, BitmapColor.Black, fontSize: 30);
bitmapBuilder.DrawText("Error", x: 10, y: 25, width: 30, height: 30, fontSize: 14, color: BitmapColor.Black);
bitmapBuilder.SetBackgroundImage(EmbeddedResources.ReadImage(EmbeddedResources.FindFile("mixerRed80.png")));
bitmapBuilder.DrawText("No Connection", x: 5, y: 50, width: 70, height: 40, fontSize: 15, color: BitmapColor.Black);
return bitmapBuilder.ToImage();
}
}
Expand Down Expand Up @@ -251,7 +256,6 @@ protected override BitmapImage GetAdjustmentImage(String actionParameter, Plugin
using (var bitmapBuilder = new BitmapBuilder(imageSize))
{
bitmapBuilder.DrawText($"{dispAction} {trackname}", x: 10, y: 10, width: 30, height: 30, fontSize: 14, color: BitmapColor.White);

return bitmapBuilder.ToImage();
}
}
Expand All @@ -262,7 +266,6 @@ protected override BitmapImage GetAdjustmentImage(String actionParameter, Plugin
bitmapBuilder.DrawRectangle(0, 0, 80, 80, BitmapColor.Black);
bitmapBuilder.FillRectangle(0, 0, 80, 80, BitmapColor.Black);
bitmapBuilder.DrawText($"unknown", x: 5, y: 40, width: 70, height: 40, fontSize: 15, color: BitmapColor.White);

return bitmapBuilder.ToImage();
}
}
Expand Down
11 changes: 3 additions & 8 deletions TotalMixPlugin/Actions/InputChannelTrigger.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
// dial action for Output channels

using System.Xml.Linq;

namespace Loupedeck.TotalMixPlugin
{
using System;
using System.Threading.Tasks;

using Loupedeck.TotalMixPlugin.Actions;


public class InputChannelTrigger : PluginDynamicCommand
Expand Down Expand Up @@ -52,7 +47,7 @@ protected override PluginProfileActionData GetProfileActionData()
return tree;
}

protected override bool OnLoad()
protected override Boolean OnLoad()
{
this._plugin = base.Plugin as TotalMixPlugin;
if (this._plugin is null)
Expand Down Expand Up @@ -121,8 +116,8 @@ protected override BitmapImage GetCommandImage(String actionParameter, PluginIma
bitmapBuilder.FillRectangle(0, 0, 80, 80, BitmapColor.White);

// draw icons for different cases
bitmapBuilder.DrawText("⚠️", x: 45, y: 10, width: 70, height: 70, BitmapColor.Black, fontSize: 60);
bitmapBuilder.DrawText("Error", x: 5, y: 50, width: 70, height: 40, fontSize: 20, color: BitmapColor.Black);
bitmapBuilder.SetBackgroundImage(EmbeddedResources.ReadImage(EmbeddedResources.FindFile("mixerRed80.png")));
bitmapBuilder.DrawText("No Connection", x: 5, y: 50, width: 70, height: 40, fontSize: 15, color: BitmapColor.Black);
return bitmapBuilder.ToImage();
}
}
Expand Down
13 changes: 10 additions & 3 deletions TotalMixPlugin/Actions/MainsTrigger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,14 @@ protected override Boolean OnLoad()
this._plugin.UpdatedInputSetting += (sender, e) => this.ActionImageChanged(e.Address);
return base.OnLoad();
}

protected override Boolean ProcessTouchEvent(String actionParameter, DeviceTouchEvent touchEvent)
{
while (!touchEvent.IsTouchUp() && actionParameter == "mainTalkback")
{
Sender.Send($"/1/{actionParameter}", 1, Globals.interfaceIp, Globals.interfacePort);
}
return base.ProcessTouchEvent(actionParameter, touchEvent);
}
// button is pressed
protected override void RunCommand(String actionParameter)
{
Expand Down Expand Up @@ -130,8 +137,8 @@ protected override BitmapImage GetCommandImage(String actionParameter, PluginIma
bitmapBuilder.FillRectangle(0, 0, 80, 80, BitmapColor.White);

// draw icons for different cases
bitmapBuilder.DrawText("⚠️", x: 45, y: 10, width: 70, height: 70, BitmapColor.Black, fontSize: 60);
bitmapBuilder.DrawText("Error", x: 5, y: 50, width: 70, height: 40, fontSize: 20, color: BitmapColor.Black);
bitmapBuilder.SetBackgroundImage(EmbeddedResources.ReadImage(EmbeddedResources.FindFile("mixerRed80.png")));
bitmapBuilder.DrawText("No Connection", x: 5, y: 50, width: 70, height: 40, fontSize: 15, color: BitmapColor.Black);
return bitmapBuilder.ToImage();
}
}
Expand Down
13 changes: 6 additions & 7 deletions TotalMixPlugin/Actions/MasterVolumeAdjustment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
namespace Loupedeck.TotalMixPlugin
{
using System;
using System.Threading.Tasks;
using Loupedeck.TotalMixPlugin.Actions;

public class MasterVolumeAdjustments : PluginDynamicAdjustment
{
Expand All @@ -15,7 +13,7 @@ public class MasterVolumeAdjustments : PluginDynamicAdjustment
// build the action
public MasterVolumeAdjustments()
: base(hasReset: false) => this.AddParameter("mastervolume", "Master Volume", "Master Channel");
protected override bool OnLoad()
protected override Boolean OnLoad()
{
this._plugin = base.Plugin as TotalMixPlugin;
if (this._plugin is null)
Expand Down Expand Up @@ -52,12 +50,13 @@ protected override String GetAdjustmentValue(String actionParameter)
try
{
Globals.bankSettings["Input"].TryGetValue("/1/mastervolumeVal", out var outputValue);
if (Globals.loggingEnabled) Tracer.Trace($"TotalMix: Dial _Bus: Input (MasterVolume) _ Address: /1/mastervolumeVal _ Value: {outputValue}");
return outputValue;
}
catch
catch (Exception ex)
{
if (Globals.loggingEnabled) Tracer.Warning($"TotalMix: Dial _ Bus: Input (MasterVolume) _ Address: /1/mastervolumeVal _ Error: {ex.Message}");
return "\t❌";

}
}

Expand All @@ -72,8 +71,8 @@ protected override BitmapImage GetAdjustmentImage(String actionParameter, Plugin
bitmapBuilder.FillRectangle(0, 0, 80, 80, BitmapColor.White);

// draw icons for different cases
bitmapBuilder.DrawText("⚠️", x: 25, y: 0, width: 40, height: 40, BitmapColor.Black, fontSize: 30);
bitmapBuilder.DrawText("Error", x: 10, y: 25, width: 30, height: 30, fontSize: 14, color: BitmapColor.Black);
bitmapBuilder.SetBackgroundImage(EmbeddedResources.ReadImage(EmbeddedResources.FindFile("mixerRed80.png")));
bitmapBuilder.DrawText("No Connection", x: 5, y: 50, width: 70, height: 40, fontSize: 15, color: BitmapColor.Black);
return bitmapBuilder.ToImage();
}
}
Expand Down
23 changes: 13 additions & 10 deletions TotalMixPlugin/Actions/OutputChannelAdjustments.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
namespace Loupedeck.TotalMixPlugin
{
using System;
using System.Threading.Tasks;
using Loupedeck.TotalMixPlugin.Actions;

public class OutputChannelAdjustments : PluginDynamicAdjustment
{
Expand Down Expand Up @@ -32,7 +30,7 @@ protected override PluginProfileActionData GetProfileActionData()
}
return tree;
}
protected override bool OnLoad()
protected override Boolean OnLoad()
{
this._plugin = base.Plugin as TotalMixPlugin;
if (this._plugin is null)
Expand Down Expand Up @@ -106,10 +104,12 @@ private String GetValue(String actionParameter)
try
{
Globals.bankSettings[$"{this.bus}"].TryGetValue($"/1/{action}{channel}Val", out var outputValue);
if (Globals.loggingEnabled) Tracer.Trace($"TotalMix: Dial _ Bus: {this.bus} _ Address: /1/{action}{channel}Val _ Value: {outputValue}");
return outputValue;
}
catch
catch (Exception ex)
{
if (Globals.loggingEnabled) Tracer.Warning($"TotalMix: Dial _ Bus: {this.bus} _ Address: /1/{action}{channel}Val _ Error: {ex.Message}");
return "\t❌";
}
}
Expand All @@ -136,23 +136,26 @@ private String GetValue(String actionParameter)
{
outputValue = $"{Math.Round(newValue * -1)} >";
}
if (Globals.loggingEnabled) Tracer.Trace($"TotalMix: Dial _ Bus: {this.bus} _ Address: /1/{action}{channel}Val _ Value: {outputValue}");
return outputValue;
}
catch
catch (Exception ex)
{
if (Globals.loggingEnabled) Tracer.Warning($"TotalMix: Dial _ Bus: {this.bus} _ Address: /1/{action}{channel}Val _ Error: {ex.Message}");
return "\t❌";
}
}
} catch
}
catch (Exception ex)
{
return "\t❌";
if (Globals.loggingEnabled) Tracer.Error($"TotalMix: Dial _ Bus: {this.bus} _ Address: /1/{action}{channel}Val _ Error: {ex.Message}");
}
}
return "err";
}

// drawing what is actually shown on the device (overwriting defaults to make it more useful by including channel names and friendly descriptors)
protected override BitmapImage GetAdjustmentImage(string actionParameter, PluginImageSize imageSize)
protected override BitmapImage GetAdjustmentImage(String actionParameter, PluginImageSize imageSize)
{
if (this.Plugin.PluginStatus.Status.ToString() != "Normal")
{
Expand All @@ -163,8 +166,8 @@ protected override BitmapImage GetAdjustmentImage(string actionParameter, Plugin
bitmapBuilder.FillRectangle(0, 0, 80, 80, BitmapColor.White);

// draw icons for different cases
bitmapBuilder.DrawText("⚠️", x: 25, y: 0, width: 40, height: 40, BitmapColor.Black, fontSize: 30);
bitmapBuilder.DrawText("Error", x: 10, y: 25, width: 30, height: 30, fontSize: 14, color: BitmapColor.Black);
bitmapBuilder.SetBackgroundImage(EmbeddedResources.ReadImage(EmbeddedResources.FindFile("mixerRed80.png")));
bitmapBuilder.DrawText("No Connection", x: 5, y: 50, width: 70, height: 40, fontSize: 15, color: BitmapColor.Black);
return bitmapBuilder.ToImage();
}
}
Expand Down
Loading

0 comments on commit 3ebb1f1

Please sign in to comment.