Skip to content

Commit

Permalink
Added auto reset for max levels
Browse files Browse the repository at this point in the history
  • Loading branch information
BackTrak committed Dec 19, 2023
1 parent a2ddc25 commit d4ed84b
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
6 changes: 6 additions & 0 deletions PropertyInspector/PluginActionPI.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@
</select>
</div>

<div class="sdpi-item" id="auto_peak_reset_select">
<div class="sdpi-item-label" title="Set this to true if you like the meter to be more full (generally audio outputs), and false for a more realistic output (generally mics).">Auto Peak Reset</div>
<input type="checkbox" id="auto_peak_reset" class="sdProperty sdCheckbox" value="true" oninput="setSettings()" />
<label for="auto_peak_reset"><span></span>Try ON for audio out, and OFF for mics.</label>
</div>

<div class="sdpi-item" id="custom_color_select">
<div class="sdpi-item-label">Custom Color</div>
<select class="sdProperty sdpi-item-value select" id="custom_color" oninput="setSettings()">
Expand Down
6 changes: 5 additions & 1 deletion VisualizerPlugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ public class VisualizerPlugin : KeypadBase
private KnownColor _customColor = KnownColor.AliceBlue;
private KnownColor _gradientColor = KnownColor.Coral;
private string _targetDeviceID = String.Empty;
private bool _autoPeakReset = false;

private bool _wasEnabledOnLastTick = false;

Expand Down Expand Up @@ -58,6 +59,8 @@ private void UpdateSettings(JObject settings)

CaptureTargetAudioDevice();
}

_autoPeakReset = settings.Value<bool>("auto_peak_reset") == true;
}

public VisualizerPlugin(SDConnection connection, InitialPayload payload) : base(connection, payload)
Expand Down Expand Up @@ -192,7 +195,8 @@ private void RenderData()
peaks[i] -= max[i] / 20;

// Decay max over a longer time so that a loud sound doesn't pin the levels too low over time.
//max[i] -= max[i] / 2000;
if(_autoPeakReset == true)
max[i] -= max[i] / 2000;


double rangeMax = 0;
Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"CategoryIcon": "Images/categoryIcon",
"Icon": "Images/zhgold288",
"URL": "https://github.com/BackTrak/StreamDeckVisualizerPlugin",
"Version": "1.0",
"Version": "1.0.0.1",
"PropertyInspectorPath": "PropertyInspector/PluginActionPI.html",
"OS": [
{
Expand Down

0 comments on commit d4ed84b

Please sign in to comment.