Skip to content

Commit

Permalink
Add tighter checks on presence of device before rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
FrostyCoolSlug committed Jan 22, 2024
1 parent 8e3cfcb commit 208d0fc
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 17 deletions.
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@ A StreamDeck plugin for controlling a GoXLR through the [GoXLR Utility](https://
* Mutli-Device Support
* Load Profile
* Load Mic Profile
* Load FX Preset
* Set / Adjust a Channel's Volume (includes submixes if available)
* Set / Toggle a Route
* Set / Toggle Fader Mute
* Set / Toggle Microphone Mute
* Set / Toggle FX
* Set / Toggle FX Buttons

## Download
The latest version can be found on the [Releases Page](https://github.com/frostycoolslug/goxlr-utility-streamdeck/releases/latest)
Expand Down Expand Up @@ -39,6 +40,7 @@ Once connected, you should be able to configure actions.

## Troubleshooting
### The Icons are Red
This means that either the Stream Deck cannot connect to the GoXLR Utility, or the GoXLR is unplugged or not found.
This means that either the Stream Deck cannot connect to the GoXLR Utility, the GoXLR is unplugged or not found, or a
selected action cannot be performed on your device (For example, attempting to execute FX commands on a mini).
Double-check the Utility to make sure it's functional and present. If you've swapped your GoXLR with another one, click
on each of the actions, which should make them resync.
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,24 @@ function runPlugin() {
// Set any 'Known' form values, default others.
Utils.setFormValue(pluginSettings, document.querySelector("#display-volume-form"))

loadSettings();

// Get all the default filled fields and store them to settings.
pluginSettings = Utils.getFormValue(document.querySelector("#display-volume-form"));
$PI.setSettings(pluginSettings);

// We're done, disconnect the websocket.
websocket.disconnect();
}

function loadSettings() {
let current_mixer = document.querySelector("#mixers").value;

if (device.mixers[current_mixer] === undefined) {
// Do nothing, we'll get called when the mixer updates.
return;
}

let submix_supported = device.mixers[current_mixer].levels.submix_supported === true;
let submix_enabled = (device.mixers[current_mixer].levels.submix !== null);

Expand All @@ -65,16 +81,11 @@ function runPlugin() {
document.querySelector("#mix").value = "A";
document.querySelector("#mix-a").classList.remove("hidden");
}

// Get all the default filled fields and store them to settings.
pluginSettings = Utils.getFormValue(document.querySelector("#display-volume-form"));
$PI.setSettings(pluginSettings);

// We're done, disconnect the websocket.
websocket.disconnect();
}

document.querySelector("#mixers").addEventListener('change', (e) => {
loadSettings();

pluginSettings = Utils.getFormValue(document.querySelector("#display-volume-form"));
$PI.setSettings(pluginSettings);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,11 @@ function runPlugin() {
function loadEffectBank() {
let selected = document.querySelector("#mixers").value;

if (device.mixers[selected] === undefined) {
// Don't do anything for now, this should fix itself.
return;
}

if (device.mixers[selected].effects === null) {
document.querySelector("#no-mini").classList.remove("hidden");
document.querySelector("#settings").classList.add("hidden");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,24 @@ function runPlugin() {
// Set any 'Known' form values, default others.
Utils.setFormValue(pluginSettings, document.querySelector("#volume-form"))

loadSettings();


// Get all the default filled fields and store them to settings.
pluginSettings = Utils.getFormValue(document.querySelector("#volume-form"));
$PI.setSettings(pluginSettings);

// We're done, disconnect the websocket.
websocket.disconnect();
}

function loadSettings() {
let current_mixer = document.querySelector("#mixers").value;

if (device.mixers[current_mixer] === undefined) {
return;
}

let submix_supported = device.mixers[current_mixer].levels.submix_supported === true;
let submix_enabled = (device.mixers[current_mixer].levels.submix !== null);

Expand All @@ -66,17 +82,11 @@ function runPlugin() {

let volume = document.querySelector("#volume").value;
document.querySelector("#volume-value").innerHTML = `${volume}%`;


// Get all the default filled fields and store them to settings.
pluginSettings = Utils.getFormValue(document.querySelector("#volume-form"));
$PI.setSettings(pluginSettings);

// We're done, disconnect the websocket.
websocket.disconnect();
}

document.querySelector("#mixers").addEventListener('change', (e) => {
loadSettings();

pluginSettings = Utils.getFormValue(document.querySelector("#volume-form"));
$PI.setSettings(pluginSettings);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ function runPlugin() {
function loadSettings() {
let selected = document.querySelector("#mixers").value;

if (device.mixers[selected] === undefined) {
// Don't do anything for now, it should fix itself, and we'll re-trigger...
return;
}

if (device.mixers[selected].effects === null) {
document.querySelector("#no-mini").classList.remove("hidden");
document.querySelector("#settings").classList.add("hidden");
Expand Down

0 comments on commit 208d0fc

Please sign in to comment.