And thus was concluded the logarithmicasation of WebStudio.

This commit is contained in:
Marks Polakovs 2020-05-10 13:40:34 +02:00
parent e443719bed
commit 16272bf2e6
2 changed files with 3 additions and 4 deletions

View file

@ -76,7 +76,7 @@ class Player extends ((PlayerEmitter as unknown) as { new (): EventEmitter }) {
} }
_applyVolume() { _applyVolume() {
const level = this.volume * (this.trim === 0 ? 1 : this.trim); const level = this.volume + this.trim;
const linear = Math.pow(10, (level/10)); const linear = Math.pow(10, (level/10));
if (linear < 1) { if (linear < 1) {
this.wavesurfer.setVolume(linear); this.wavesurfer.setVolume(linear);

View file

@ -500,11 +500,11 @@ export const setVolume = (
let uiLevel: number; let uiLevel: number;
switch (level) { switch (level) {
case "off": case "off":
volume = 0; volume = -36;
uiLevel = 0; uiLevel = 0;
break; break;
case "bed": case "bed":
volume = 0.1; volume = -12;
uiLevel = 0.5; uiLevel = 0.5;
break; break;
case "full": case "full":
@ -542,7 +542,6 @@ export const setVolume = (
}); });
const gainTween = new Between(currentGain, volume) const gainTween = new Between(currentGain, volume)
.time(FADE_TIME_SECONDS * 1000) .time(FADE_TIME_SECONDS * 1000)
.easing((Between as any).Easing.Exponential.InOut)
.on("update", (val: number) => { .on("update", (val: number) => {
if (typeof audioEngine.players[player] !== "undefined") { if (typeof audioEngine.players[player] !== "undefined") {
audioEngine.players[player]?.setVolume(val); audioEngine.players[player]?.setVolume(val);