Change volume slider to a logarithmic scale
This commit is contained in:
parent
dffb7a84b6
commit
2be9d73943
|
|
@ -225,7 +225,7 @@
|
|||
<svg class="unmuted" viewBox="0 0 80 80"><use xlink:href="static/gfx/svg-defs.svg#speaker"></use></svg>
|
||||
<svg class="muted" viewBox="0 0 80 80"><use xlink:href="static/gfx/svg-defs.svg#speaker-muted"></use></svg>
|
||||
</div>
|
||||
<input title="Volume" id="openwebrx-panel-volume" class="openwebrx-panel-slider" type="range" min="0" max="150" value="50" step="1" onchange="UI.setVolume(this.value);" oninput="UI.setVolume(this.value);">
|
||||
<input title="Volume" id="openwebrx-panel-volume" class="openwebrx-panel-slider" type="range" min="0" max="150" value="100" step="1" onchange="UI.setVolume(this.value);" oninput="UI.setVolume(this.value);">
|
||||
<div title="Tuning step" class="openwebrx-button openwebrx-slider-button" onclick="tuning_step_reset();">
|
||||
<svg viewBox="0 0 80 80"><use xlink:href="static/gfx/svg-defs.svg#tuning-step"></use></svg>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -75,7 +75,10 @@ UI.setVolume = function(x) {
|
|||
this.volume = x;
|
||||
LS.save('volume', x);
|
||||
$('#openwebrx-panel-volume').val(x)
|
||||
if (audioEngine) audioEngine.setVolume(x / 100);
|
||||
//Map 0-150 to -60 to 0db gain
|
||||
xdb = (x / 2.5) - 60;
|
||||
gain = Math.pow(10, xdb / 20);
|
||||
if (audioEngine) audioEngine.setVolume(gain);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue