Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added StripLayer support for dials #72

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,17 @@ VoiceMeeter integration and live feedback for the Elgato Stream Deck device.

**Author's website and contact information:** [https://barraider.com](https://barraider.com)

**Modified by:** Rebel2k

## New in v2.4
- Added some validation checks so the `LayerNum` field is only available if the `Layer` mode is selected
- Added a step size of 3 for volume gain
- Renamed `StripLayer` mode to `Layer`
- Changed some labels in the UI

## New in v2.3
- Added `StripLayer` type support for the `Gain Adjust` action which allows you to control the volume of a a StripLayer from the Dials (like what you can do in the Streamer View of VoiceMeeter).

## New in v2.2
- Added `Title` support for Microphone action

Expand Down
23 changes: 21 additions & 2 deletions VoiceMeeter/Actions/VMGainAdjustDialAction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ public static PluginSettings CreateDefaultSettings()
{
Strip = StripBusType.Strip,
StripNum = 0,
LayerNum = 0,
Title = String.Empty
};

Expand All @@ -40,6 +41,9 @@ public static PluginSettings CreateDefaultSettings()
[JsonProperty(PropertyName = "stripNum")]
public int StripNum { get; set; }

[JsonProperty(PropertyName = "layerNum")]
public int LayerNum { get; set; }

[JsonProperty(PropertyName = "stepSize")]
public string StepSize { get; set; }

Expand Down Expand Up @@ -212,12 +216,27 @@ public override void ReceivedGlobalSettings(ReceivedGlobalSettingsPayload payloa

private string BuildDeviceName()
{
return $"{settings.Strip}[{settings.StripNum}].gain";
if ( $"{settings.Strip}".Equals("2") )
{
return $"Strip[{settings.StripNum}].GainLayer[{settings.LayerNum}]";
}
else
{
return $"{settings.Strip}[{settings.StripNum}].gain";
}

}

private string BuildMuteName()
{
return $"{settings.Strip}[{settings.StripNum}].mute";
if ( $"{settings.Strip}".Equals("2") )
{
return $"Strip[{settings.StripNum}].mute";
}
else
{
return $"{settings.Strip}[{settings.StripNum}].mute";
}
}

private Task SaveSettings()
Expand Down
85 changes: 82 additions & 3 deletions VoiceMeeter/PropertyInspector/VoiceMeeter/GainAdjustDial.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE html>
 <!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
Expand All @@ -10,15 +10,80 @@
<script src="https://cdn.jsdelivr.net/gh/barraider/streamdeck-easypi@latest/src/sdtools.common.js"></script>
</head>
<body>
<script>

function updateLayerNumState() {
var stripValue = document.getElementById('strip').value;
var layerNumElement = document.getElementById('layerNum');
if (stripValue === '2') {
layerNumElement.removeAttribute('disabled');
} else {
layerNumElement.setAttribute('disabled', 'disabled');
}
}

function loadConfiguration(payload) { //needed to override that function from the sdtools.common.js source file to update the layerNum field state on configuration load
console.log('loadConfiguration');
console.log(payload);
for (var key in payload) {
try {
var elem = document.getElementById(key);
if (elem.classList.contains("sdCheckbox")) { // Checkbox
elem.checked = payload[key];
}
else if (elem.classList.contains("sdFile")) { // File
var elemFile = document.getElementById(elem.id + "Filename");
elemFile.innerText = payload[key];
if (!elemFile.innerText) {
elemFile.innerText = "No file...";
}
}
else if (elem.classList.contains("sdList")) { // Dynamic dropdown
var textProperty = elem.getAttribute("sdListTextProperty");
var valueProperty = elem.getAttribute("sdListValueProperty");
var valueField = elem.getAttribute("sdValueField");

var items = payload[key];
elem.options.length = 0;

for (var idx = 0; idx < items.length; idx++) {
var opt = document.createElement('option');
opt.value = items[idx][valueProperty];
opt.text = items[idx][textProperty];
elem.appendChild(opt);
}
elem.value = payload[valueField];
}
else if (elem.classList.contains("sdHTML")) { // HTML element
elem.innerHTML = payload[key];
}
else { // Normal value
elem.value = payload[key];
}
console.log("Load: " + key + "=" + payload[key]);
}
catch (err) {
console.log("loadConfiguration failed for key: " + key + " - " + err);
}
updateLayerNumState();
}
}

document.getElementById("strip").addEventListener("change", function () {
updateLayerNumState();
});

</script>
<div class="sdpi-wrapper">
<details class="message info">
<summary>For feedback/suggestions contact me at <span class="linkspan" onclick="openWebsite()">https://BarRaider.com</span> </summary>
</details>
<div class="sdpi-item" id="select_single">
<div class="sdpi-item-label">Strip/Bus</div>
<select class="sdpi-item-value select sdProperty" id="strip" oninput="setSettings()">
<div class="sdpi-item-label">Strip/Bus/Layer</div>
<select class="sdpi-item-value select sdProperty" id="strip" onchange="updateStripNumState(this.value)" oninput="setSettings()">
<option value="0">Strip</option>
<option value="1">Bus</option>
<option value="2">Layer</option>
</select>
</div>
<div class="sdpi-item" id="select_single">
Expand All @@ -34,6 +99,19 @@
<option value="7">7</option>
</select>
</div>
<div class="sdpi-item" id="select_single">
<div class="sdpi-item-label">Layer Num</div>
<select class="sdpi-item-value select sdProperty" id="layerNum" disabled oninput="setSettings()">
<option value="0">0</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
</select>
</div>
<div class="sdpi-item" id="dvStepSize">
<div class="sdpi-item-label">Step Size</div>
<select class="sdpi-item-value select sdProperty" id="stepSize" oninput="setSettings()">
Expand All @@ -42,6 +120,7 @@
<option value="0.5">0.5</option>
<option value="1" selected>1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="5">5</option>
<option value="10">10</option>
</select>
Expand Down
4 changes: 2 additions & 2 deletions VoiceMeeter/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -153,12 +153,12 @@
"PropertyInspectorPath": "PropertyInspector/VoiceMeeter/AdjustSettingDial.html"
}
],
"Author": "BarRaider",
"Author": "BarRaider modified by Rebel2k",
"Description": "VoiceMeeter integration and live feedback. Includes Dials, Hotkey and MIDI Support",
"Name": "VoiceMeeter Integration",
"Icon": "Images/pluginIcon",
"URL": "https://BarRaider.com/",
"Version": "2.2",
"Version": "2.4",
"CodePath": "com.barraider.voicemeeter.exe",
"Category": "VoiceMeeter [BarRaider]",
"CategoryIcon": "Images/categoryIcon",
Expand Down