Spaces:
Running
Running
RemiFabre
commited on
Commit
·
214a331
1
Parent(s):
b9ae085
QoL
Browse files- Theremini/config.json +6 -5
- Theremini/webui/app.js +1 -29
- Theremini/webui/index.html +0 -1
- Theremini/webui/style.css +4 -19
Theremini/config.json
CHANGED
|
@@ -1,9 +1,10 @@
|
|
| 1 |
{
|
| 2 |
"active_instruments": [
|
| 3 |
-
"
|
| 4 |
-
"
|
| 5 |
-
"
|
| 6 |
-
"
|
| 7 |
-
"
|
|
|
|
| 8 |
]
|
| 9 |
}
|
|
|
|
| 1 |
{
|
| 2 |
"active_instruments": [
|
| 3 |
+
"choir_aahs",
|
| 4 |
+
"orchestra_hit",
|
| 5 |
+
"taiko_drum",
|
| 6 |
+
"trumpet",
|
| 7 |
+
"french_horn",
|
| 8 |
+
"soundtrack"
|
| 9 |
]
|
| 10 |
}
|
Theremini/webui/app.js
CHANGED
|
@@ -18,13 +18,11 @@ const configStatusEl = document.getElementById("configStatus");
|
|
| 18 |
const dialSegmentsGroup = document.getElementById("dialSegments");
|
| 19 |
const dialPointer = document.getElementById("dialPointer");
|
| 20 |
const dialAngleEl = document.getElementById("dialAngle");
|
| 21 |
-
const dialLabelsEl = document.getElementById("dialLabels");
|
| 22 |
|
| 23 |
const RIGHT_ANT_RANGE = { min: -Math.PI / 3, max: Math.PI / 3 };
|
| 24 |
const DIAL_CENTER = 120;
|
| 25 |
const DIAL_RADIUS = 85;
|
| 26 |
const POINTER_RADIUS = 88;
|
| 27 |
-
const LABEL_RADIUS = 110;
|
| 28 |
|
| 29 |
const ranges = {
|
| 30 |
roll: { min: -60, max: 60, meter: rollMeterEl, display: rollValueEl, unit: "°" },
|
|
@@ -56,7 +54,7 @@ function radToDeg(rad) {
|
|
| 56 |
}
|
| 57 |
|
| 58 |
function angleToDial(angleRad) {
|
| 59 |
-
return radToDeg(angleRad)
|
| 60 |
}
|
| 61 |
|
| 62 |
function setMeter(meterEl, value, min, max) {
|
|
@@ -121,33 +119,7 @@ async function pollStatus() {
|
|
| 121 |
}
|
| 122 |
|
| 123 |
function renderDialDisplay() {
|
| 124 |
-
dialLabelsEl.innerHTML = "";
|
| 125 |
renderDialSegments();
|
| 126 |
-
|
| 127 |
-
if (!activeVoices.length) {
|
| 128 |
-
const empty = document.createElement("p");
|
| 129 |
-
empty.className = "meta";
|
| 130 |
-
empty.textContent = "No voices selected";
|
| 131 |
-
dialLabelsEl.appendChild(empty);
|
| 132 |
-
return;
|
| 133 |
-
}
|
| 134 |
-
|
| 135 |
-
const segments = computeInstrumentSegments(activeVoices.length);
|
| 136 |
-
segments.forEach(({ index, start, end }) => {
|
| 137 |
-
const label = document.createElement("span");
|
| 138 |
-
label.className = "dial-label";
|
| 139 |
-
label.textContent = activeVoices[index];
|
| 140 |
-
const mid = (start + end) / 2;
|
| 141 |
-
const point = polarToCartesian(
|
| 142 |
-
DIAL_CENTER,
|
| 143 |
-
DIAL_CENTER,
|
| 144 |
-
LABEL_RADIUS,
|
| 145 |
-
angleToDial(mid),
|
| 146 |
-
);
|
| 147 |
-
label.style.left = `${point.x}px`;
|
| 148 |
-
label.style.top = `${point.y}px`;
|
| 149 |
-
dialLabelsEl.appendChild(label);
|
| 150 |
-
});
|
| 151 |
}
|
| 152 |
|
| 153 |
function renderAvailableList() {
|
|
|
|
| 18 |
const dialSegmentsGroup = document.getElementById("dialSegments");
|
| 19 |
const dialPointer = document.getElementById("dialPointer");
|
| 20 |
const dialAngleEl = document.getElementById("dialAngle");
|
|
|
|
| 21 |
|
| 22 |
const RIGHT_ANT_RANGE = { min: -Math.PI / 3, max: Math.PI / 3 };
|
| 23 |
const DIAL_CENTER = 120;
|
| 24 |
const DIAL_RADIUS = 85;
|
| 25 |
const POINTER_RADIUS = 88;
|
|
|
|
| 26 |
|
| 27 |
const ranges = {
|
| 28 |
roll: { min: -60, max: 60, meter: rollMeterEl, display: rollValueEl, unit: "°" },
|
|
|
|
| 54 |
}
|
| 55 |
|
| 56 |
function angleToDial(angleRad) {
|
| 57 |
+
return radToDeg(angleRad);
|
| 58 |
}
|
| 59 |
|
| 60 |
function setMeter(meterEl, value, min, max) {
|
|
|
|
| 119 |
}
|
| 120 |
|
| 121 |
function renderDialDisplay() {
|
|
|
|
| 122 |
renderDialSegments();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 123 |
}
|
| 124 |
|
| 125 |
function renderAvailableList() {
|
Theremini/webui/index.html
CHANGED
|
@@ -100,7 +100,6 @@
|
|
| 100 |
<line id="dialPointer" x1="120" y1="120" x2="120" y2="32" />
|
| 101 |
<circle id="dialCenter" cx="120" cy="120" r="20" />
|
| 102 |
</svg>
|
| 103 |
-
<div class="dial-labels" id="dialLabels"></div>
|
| 104 |
</div>
|
| 105 |
<p class="meta">Antenna angle: <span id="dialAngle">0°</span></p>
|
| 106 |
</div>
|
|
|
|
| 100 |
<line id="dialPointer" x1="120" y1="120" x2="120" y2="32" />
|
| 101 |
<circle id="dialCenter" cx="120" cy="120" r="20" />
|
| 102 |
</svg>
|
|
|
|
| 103 |
</div>
|
| 104 |
<p class="meta">Antenna angle: <span id="dialAngle">0°</span></p>
|
| 105 |
</div>
|
Theremini/webui/style.css
CHANGED
|
@@ -179,7 +179,8 @@ body {
|
|
| 179 |
.program-card {
|
| 180 |
display: flex;
|
| 181 |
flex-direction: column;
|
| 182 |
-
gap: 1.
|
|
|
|
| 183 |
}
|
| 184 |
|
| 185 |
.dial-wrapper {
|
|
@@ -197,8 +198,8 @@ body {
|
|
| 197 |
|
| 198 |
.dial-canvas {
|
| 199 |
position: relative;
|
| 200 |
-
width: min(
|
| 201 |
-
height: min(
|
| 202 |
}
|
| 203 |
|
| 204 |
#dialSvg {
|
|
@@ -206,22 +207,6 @@ body {
|
|
| 206 |
height: 100%;
|
| 207 |
}
|
| 208 |
|
| 209 |
-
.dial-labels {
|
| 210 |
-
position: absolute;
|
| 211 |
-
inset: 0;
|
| 212 |
-
pointer-events: none;
|
| 213 |
-
font-size: 0.8rem;
|
| 214 |
-
}
|
| 215 |
-
|
| 216 |
-
.dial-label {
|
| 217 |
-
position: absolute;
|
| 218 |
-
transform: translate(-50%, -50%);
|
| 219 |
-
text-align: center;
|
| 220 |
-
color: rgba(248, 250, 252, 0.85);
|
| 221 |
-
text-shadow: 0 2px 6px rgba(2, 6, 23, 0.8);
|
| 222 |
-
width: 90px;
|
| 223 |
-
line-height: 1.1;
|
| 224 |
-
}
|
| 225 |
|
| 226 |
#dialSegments path,
|
| 227 |
#dialSegments circle {
|
|
|
|
| 179 |
.program-card {
|
| 180 |
display: flex;
|
| 181 |
flex-direction: column;
|
| 182 |
+
gap: 1.1rem;
|
| 183 |
+
padding: 1.2rem 1.3rem;
|
| 184 |
}
|
| 185 |
|
| 186 |
.dial-wrapper {
|
|
|
|
| 198 |
|
| 199 |
.dial-canvas {
|
| 200 |
position: relative;
|
| 201 |
+
width: min(360px, 85vw);
|
| 202 |
+
height: min(360px, 85vw);
|
| 203 |
}
|
| 204 |
|
| 205 |
#dialSvg {
|
|
|
|
| 207 |
height: 100%;
|
| 208 |
}
|
| 209 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 210 |
|
| 211 |
#dialSegments path,
|
| 212 |
#dialSegments circle {
|