HTMLMediaElement: Add logarithmic volume controls
This commit is contained in:
@@ -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;
|
||||
}
|
||||
});
|
||||
})();
|
||||
Reference in New Issue
Block a user