Skip to content

Commit e656472

Browse files
author
Greg Smith
committed
Added Home tab to web interface, to be a starting page with some general info that minimises the chance of accidental parameter changing.
1 parent a1693a3 commit e656472

File tree

2 files changed

+136
-2
lines changed

2 files changed

+136
-2
lines changed

locator/Windows/.gitignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# macOS folder attributes
2+
.DS_Store
3+
4+
obj
5+
bin/Debug
6+
7+
8+

source/main/index.html

Lines changed: 128 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -380,13 +380,30 @@
380380
display: none;
381381
}
382382

383+
.home-label {
384+
color: #ccc;
385+
text-align:center;
386+
}
387+
383388
.fx_icon_container {
384389
display: flex;
385390
justify-content: space-around; /* or space-evenly */
386391
width: 98%;
387392
margin: 0 auto;
388393
padding: 5px;
389394
}
395+
396+
.oscilloscope-container {
397+
display: flex;
398+
justify-content: center;
399+
align-items: center;
400+
width: 100%;
401+
height: 400px;
402+
}
403+
canvas {
404+
width: 100%;
405+
height: 300px;
406+
}
390407
</style>
391408

392409
<script>
@@ -800,6 +817,22 @@
800817
// Init web socket when the page loads
801818
window.addEventListener('load', onload);
802819

820+
// waveform display
821+
let canvas = null;
822+
let ctx = null;
823+
824+
// Canvas dimensions
825+
let width = 0;
826+
let height = 0;
827+
828+
// Signal parameters
829+
let time = 0;
830+
let baseAmplitude = 50; // Base amplitude for the wave
831+
const baseFrequency = 0.06; // Base frequency for the wave
832+
const speed = 0.3; // Faster animation speed
833+
const noiseLevel = 5; // Subtle noise for audio-like randomness
834+
let variationTime = 2; // For amplitude/frequency variation
835+
803836
function onload(event) {
804837
// Get the element with id="defaultOpen" and click on it
805838
document.getElementById("defaultOpen").click();
@@ -824,6 +857,13 @@
824857
populateExternalFootswitches();
825858
populateInternalFootswitches();
826859
setEffectIcons();
860+
861+
// draw waveform
862+
canvas = document.getElementById('oscilloscopeCanvas');
863+
ctx = canvas.getContext('2d');
864+
width = canvas.width;
865+
height = canvas.height;
866+
drawSignal();
827867
}
828868

829869
function setEffectIcons() {
@@ -2967,6 +3007,69 @@
29673007
setToast('Ensure mDNS/Bonjour is<br>enabled on your router<br>before applying Station Mode!');
29683008
}
29693009
}
3010+
3011+
function drawSignal() {
3012+
// Clear the canvas
3013+
ctx.clearRect(0, 0, width, height);
3014+
3015+
// Draw oscilloscope grid
3016+
ctx.beginPath();
3017+
ctx.strokeStyle = 'rgba(48, 54, 61, 0.8)';
3018+
ctx.lineWidth = 1;
3019+
3020+
// Horizontal lines
3021+
const numHorizontal = 5;
3022+
const horizontalSpacing = height / (numHorizontal - 1);
3023+
for (let i = 0; i < numHorizontal; i++) {
3024+
const y = i * horizontalSpacing;
3025+
ctx.moveTo(0, y);
3026+
ctx.lineTo(width, y);
3027+
}
3028+
3029+
// Vertical lines
3030+
const numVertical = 10;
3031+
const verticalSpacing = width / (numVertical - 1);
3032+
for (let i = 0; i < numVertical; i++) {
3033+
const x = i * verticalSpacing;
3034+
ctx.moveTo(x, 0);
3035+
ctx.lineTo(x, height);
3036+
}
3037+
3038+
ctx.stroke();
3039+
3040+
// Calculate varying amplitude and frequency
3041+
const amplitude = baseAmplitude * (0.5 + 0.5 * Math.sin(variationTime * 0.1));
3042+
const frequency = baseFrequency * (0.8 + 0.4 * Math.cos(variationTime * 0.1));
3043+
3044+
// Draw the oscilloscope signal with fewer samples
3045+
ctx.beginPath();
3046+
ctx.strokeStyle = '#FB9230'; // Vibrant orange waveform
3047+
ctx.lineWidth = 2;
3048+
3049+
for (let x = 0; x < width; x += 5) { // Fewer samples with larger step size
3050+
// Combine multiple sine waves with noise for audio-like effect
3051+
const y = height / 2 + amplitude * (
3052+
0.6 * Math.sin(frequency * x + time) +
3053+
0.3 * Math.sin(frequency * 2 * x + time * 0.5) +
3054+
0.1 * Math.sin(frequency * 4 * x + time * 0.2)
3055+
) + (Math.random() - 0.5) * noiseLevel;
3056+
ctx.lineTo(x, y);
3057+
}
3058+
3059+
ctx.stroke();
3060+
3061+
// Update time for animation
3062+
time += speed;
3063+
variationTime += 0.6; // Faster variation
3064+
3065+
// Reset amplitude periodically to simulate new audio input
3066+
if (variationTime % 100 === 0) {
3067+
baseAmplitude = 30 + Math.random() * 40; // Random amplitude between 30 and 70
3068+
}
3069+
3070+
// Loop the animation
3071+
requestAnimationFrame(drawSignal);
3072+
}
29703073
</script>
29713074

29723075
<nav class="navbar navbar-dark bg-dark">
@@ -2991,7 +3094,8 @@
29913094
</div>
29923095

29933096
<div class="tab" id="MainMenu">
2994-
<button class="tablinks" onclick="openTab(event, 'NoiseGate')" id="defaultOpen">Gate</button>
3097+
<button class="tablinks" onclick="openTab(event, 'Home')" id="defaultOpen">Home</button>
3098+
<button class="tablinks" onclick="openTab(event, 'NoiseGate')">Gate</button>
29953099
<button class="tablinks" onclick="openTab(event, 'Compressor')">Comp</button>
29963100
<button class="tablinks" onclick="openTab(event, 'Equalisation')">EQ</button>
29973101
<button class="tablinks" onclick="openTab(event, 'Reverb')">Reverb</button>
@@ -3008,8 +3112,30 @@
30083112
<button class="tablinks" onclick="openTab(event, 'Miscellaneous')">Misc</button>
30093113
</div>
30103114

3115+
<div id="Home" class="tabcontent">
3116+
<div class="col py-3 text-white">
3117+
<div class="container" style="text-align: center;">
3118+
<label class="home-label">Tonex One and Tonex Pedal Controller</label>
3119+
</div>
3120+
<div class="container" style="text-align: center;">
3121+
<label class="home-label">Version V2.0.0.2</label>
3122+
</div>
3123+
<br>
3124+
<div class="container" style="text-align: center; color:#FB9230;">
3125+
<label>https://github.com/Builty/TonexOneController</label>
3126+
</div>
3127+
<div class="oscilloscope-container">
3128+
<canvas id="oscilloscopeCanvas"></canvas>
3129+
</div>
3130+
3131+
<div class="container" style="text-align: center; color:#777;">
3132+
<label>TONEX is a registered trademark of IK Multimedia Production Srl</label>
3133+
</div>
3134+
</div>
3135+
</div>
3136+
30113137
<div id="NoiseGate" class="tabcontent">
3012-
<div class="col py-3 text-white">
3138+
<div class="col py-3 text-white">
30133139
<h5 class="selected_text">Noise Gate</h5>
30143140
<p class="lead">
30153141
<div class="container">

0 commit comments

Comments
 (0)