Changed volume curve from x^2 to x^3
This commit is contained in:
parent
2244554a07
commit
4f7131f59a
2 changed files with 4 additions and 4 deletions
|
@ -457,14 +457,14 @@ class HtmlAudioPlayer {
|
|||
setVolume(val) {
|
||||
const mediaElement = this._mediaElement;
|
||||
if (mediaElement) {
|
||||
mediaElement.volume = Math.pow(val / 100, 2);
|
||||
mediaElement.volume = Math.pow(val / 100, 3);
|
||||
}
|
||||
}
|
||||
|
||||
getVolume() {
|
||||
const mediaElement = this._mediaElement;
|
||||
if (mediaElement) {
|
||||
return Math.min(Math.round(Math.pow(mediaElement.volume, 0.5) * 100), 100);
|
||||
return Math.min(Math.round(Math.pow(mediaElement.volume, 1 / 3) * 100), 100);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1708,14 +1708,14 @@ function tryRemoveElement(elem) {
|
|||
setVolume(val) {
|
||||
const mediaElement = this.#mediaElement;
|
||||
if (mediaElement) {
|
||||
mediaElement.volume = Math.pow(val / 100, 2);
|
||||
mediaElement.volume = Math.pow(val / 100, 3);
|
||||
}
|
||||
}
|
||||
|
||||
getVolume() {
|
||||
const mediaElement = this.#mediaElement;
|
||||
if (mediaElement) {
|
||||
return Math.min(Math.round(Math.pow(mediaElement.volume, 0.5) * 100), 100);
|
||||
return Math.min(Math.round(Math.pow(mediaElement.volume, 1 / 3) * 100), 100);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue