Skip to content

Commit

Permalink
feat: 🚀 enable more incoming OSC messages
Browse files Browse the repository at this point in the history
enable more incoming OSC messages  (/precision, /index, /sendRate, /factor)
  • Loading branch information
dewiweb committed Feb 26, 2024
1 parent cec10ad commit 2eb54a9
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
><input type="text" id="prefix" name="prefix" value="/track" />
<br>
</td>
<td colspan="2" align="right" style="visibility: visible;">
<td colspan="2" text-align="right" style="visibility: visible;">
<br>
<label for="index">Index : </label
><input
Expand All @@ -58,7 +58,7 @@
/>
<br>
</td>
<td align="left">
<td text-align="left">
<br>
<button class="button_up byp" id="byp0">Bypass</button>
<br>
Expand Down
12 changes: 12 additions & 0 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,16 @@ function handleMode(args) {
}
}

function handleIndex(args) {
// Function implementation for handling "/index" address
const indexArg = args[0].value;
if(parseInt(indexArg) > 0 || indexArg === "on" || indexArg === "off" || indexArg === "reset") {
win.webContents.send("indexChanged", indexArg);
}else{
win.webContents.send("logInfo", "Invalid index value: " + indexArg);
}
}

function handlePrecision(args) {
// Function implementation for handling "/precision" address
const precisionValue = args[0].value;
Expand Down Expand Up @@ -497,6 +507,8 @@ function handleMode(args) {

const oscAddressFunctions = {
"/mode": handleMode,
// "/prefix": handlePrefix,
"/index": handleIndex,
"/precision": handlePrecision,
"/factor": handleFactor,
"/sendRate": handleSendRate
Expand Down
24 changes: 24 additions & 0 deletions src/renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,30 @@ ipcRenderer.on("modeChanged", (event, mode) => {
}
});

ipcRenderer.on("indexChanged", (event, index) => {
idButton = document.getElementById("byp0");
const indexCell = idButton.parentElement.previousElementSibling;
indexCell.children[1].style.visibility = 'visible';
if (index === "on" ){
if (indexCell.style.visibility === 'hidden'){
indexCell.style.visibility = 'visible';
idButton.innerHTML = "Bypass";
idButton.className = "button_up byp";
};
}else if (index === "off"){
if (indexCell.style.visibility === 'visible'){
indexCell.style.visibility = 'hidden';
idButton.innerHTML = "Enable";
idButton.className = "button byp";
}
}else if (index === "reset"){
document.getElementById("index").value = 1;
}
else{
document.getElementById("index").value = index;
}
})

ipcRenderer.on("factorChanged", (event, factor) => {
document.getElementById("factor").value = factor;
})
Expand Down

0 comments on commit 2eb54a9

Please sign in to comment.