HTMLMediaElement: Add logarithmic volume controls

This commit is contained in:
Michael Fabian 'Xaymar' Dirks
2022-11-27 06:04:57 +01:00
parent 56e0f8775e
commit b54ad6fe22
+15
View File
@@ -0,0 +1,15 @@
'use strict';
(function() {
// Used by PulseAudio, sounds good enough.
const EXPONENT = 3;
Object.defineProperty(HTMLMediaElement.prototype, 'logVolume', {
get () {
return this.volume ** (1 / EXPONENT);
},
set (originalVolume) {
this.volume = originalVolume ** EXPONENT;
}
});
})();