Cleaned up volume to gain translation.
This commit is contained in:
parent
2bdc8b3e06
commit
7db50080c3
|
|
@ -75,13 +75,11 @@ UI.setVolume = function(x) {
|
||||||
this.volume = x;
|
this.volume = x;
|
||||||
LS.save('volume', x);
|
LS.save('volume', x);
|
||||||
$('#openwebrx-panel-volume').val(x)
|
$('#openwebrx-panel-volume').val(x)
|
||||||
//Map 0-150 to -60 to 0db gain
|
if (audioEngine) {
|
||||||
xdb = (x / 2.5) - 60;
|
// Map 0..150 to -60..0db gain
|
||||||
gain = Math.pow(10, xdb / 20);
|
gain = x > 0? Math.pow(10, ((x / 2.5) - 60) / 20) : 0;
|
||||||
if (x == 0) {
|
audioEngine.setVolume(gain);
|
||||||
gain = 0;
|
|
||||||
}
|
}
|
||||||
if (audioEngine) audioEngine.setVolume(gain);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue