Adding user interface for noise reduction control.

This commit is contained in:
Marat Fayzullin 2022-11-19 12:02:31 -05:00
parent cd690b6ca2
commit 8cb654340b
3 changed files with 42 additions and 0 deletions

View File

@ -24,5 +24,7 @@
<g id="play-button"><circle cx="350" cy="350" r="330" fill="none" stroke="#fff" stroke-width="36"/><path d="M195 211v278l366-139z" fill="#fff"/></g>
<g id="meta-mute" stroke="#fff" stroke-width="5"><path stroke-linejoin="round" style="paint-order:fill" fill="none" d="m21.989 47.699 17.4 15.051V13.769L22.235 28.606H6v19.093z" transform="matrix(5.3513 0 0 5.3723 -.73 -1.542)"/><path d="m48.652 50.27 20.743-24.299M69.395 50.27 48.652 25.971" stroke-linecap="round" transform="matrix(5.3513 0 0 5.3723 -.73 -1.542)"/></g>
<g id="waterfall-continuous"><g stroke="#fff" stroke-width="8"><path d="M5 40A35 35 0 0 1 26.606 7.664a35 35 0 0 1 38.143 7.587" fill="none"/><path d="m68.284 11.716 2.828 9.9-9.899-2.829z" fill="#fff"/></g><path d="m48.008 48.144 2.816 8.624h9.035L45.075 14h-9.739L20.141 56.768h8.976l2.875-8.624zm-2.405-7.333H34.456l5.573-16.72z" fill="#fff" aria-label="A"/><g stroke="#fff" stroke-width="8"><path d="M75 40a35 35 0 0 1-21.606 32.336 35 35 0 0 1-38.143-7.587" fill="none"/><path d="m11.716 68.284-2.828-9.9 9.899 2.829z" fill="#fff"/></g></g>
<g id="noise-reduce" fill="#fff" stroke-width=".767"><path d="m 36.606611,74.237282 -9.008789,0 L 11.11833,30.951149 q 0.659179,3.164062 0.659179,4.96582 l 0,38.320313 -10.0195308,0 0,-68.7744143 9.0087888,0 16.479492,42.4072263 Q 26.58708,44.706032 26.58708,42.904274 l 0,-37.4414063 10.019531,0 0,68.7744143 z"/><path d="m 80.200361,74.237282 -10.722656,0 L 58.139814,42.28904 q 0,0 0,-6.196289 l 10.107422,0 0,-21.796875 -12.963867,0 0,59.941406 -10.283203,0 0,-68.7744143 27.290039,0 q 6.196289,0 6.196289,6.3281253 l 0,25.004883 q 0,4.350585 -2.944336,5.625 -1.582031,0.659179 -6.679688,0.659179 l 11.337891,31.157227 z"/></g>
<g id="disabled" fill="#fff" stroke-width=".767"><path d="M 59.826868,-0.58229828 28.318079,81.155983 l -7.602539,0 31.376953,-81.73828128 7.734375,0 z"/></g>
</defs>
</svg>

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 16 KiB

View File

@ -205,6 +205,12 @@
</div>
<input title="Waterfall maximum level" id="openwebrx-waterfall-color-max" class="openwebrx-panel-slider" type="range" min="-200" max="100" value="50" step="1" onchange="updateWaterfallColors(1);" oninput="updateVolume()">
</div>
<div class="openwebrx-panel-line">
<div title="Noise reduction on/off" class="openwebrx-nr-toggle openwebrx-button openwebrx-slider-button" onclick="toggleNR();">
<svg viewBox="0 0 80 80"><use xlink:href="static/gfx/svg-defs.svg#noise-reduce"></use></svg>
</div>
<input title="Noise reduction level" disabled id="openwebrx-panel-nr" class="openwebrx-panel-slider" type="range" min="-10" max="10" value="0" step="1" onchange="updateNR()" oninput="updateNR()">
</div>
<div class="openwebrx-panel-line">
<div class="openwebrx-button openwebrx-square-button openwebrx-zoom-button" onclick="zoomInOneStep();" title="Zoom in one step"><svg viewBox="0 0 80 80"><use xlink:href="static/gfx/svg-defs.svg#zoom-in"></use></svg></div>
<div class="openwebrx-button openwebrx-square-button openwebrx-zoom-button" onclick="zoomOutOneStep();" title="Zoom out one step"><svg viewBox="0 0 80 80"><use xlink:href="static/gfx/svg-defs.svg#zoom-out"></use></svg></div>

View File

@ -31,6 +31,8 @@ var fft_compression = "none";
var fft_codec;
var waterfall_setup_done = 0;
var secondary_fft_size;
var nr_enabled = false;
var nr_threshold = 0;
function updateVolume() {
audioEngine.setVolume(parseFloat($("#openwebrx-panel-volume").val()) / 100);
@ -51,6 +53,28 @@ function toggleMute() {
updateVolume();
}
function updateNR() {
var $nrPanel = $('#openwebrx-panel-nr');
nr_threshold = Math.round(parseFloat($nrPanel.val()));
$nrPanel.attr('title', 'Noise level (' + nr_threshold + ' dB)');
nr_changed();
}
function toggleNR() {
var $nrPanel = $('#openwebrx-panel-nr');
if ($nrPanel.prop('disabled')) {
$nrPanel.prop('disabled', false);
nr_enabled = true;
} else {
$nrPanel.prop('disabled', true);
nr_enabled = false;
}
nr_changed();
}
function zoomInOneStep() {
zoom_set(zoom_level + 1);
}
@ -1568,3 +1592,13 @@ function sdr_profile_changed() {
var value = $('#openwebrx-sdr-profiles-listbox').val();
ws.send(JSON.stringify({type: "selectprofile", params: {profile: value}}));
}
function nr_changed() {
ws.send(JSON.stringify({
"type": "connectionproperties",
"params": {
"nr_enabled": nr_enabled,
"nr_threshold": nr_threshold
}
}));
}