Browse Source

add dipped crossfade type

master
jeffvli 3 years ago
parent
commit
28debb029e
  1. 8
      src/components/player/Player.tsx
  2. 1
      src/components/settings/Config.tsx

8
src/components/player/Player.tsx

@ -80,6 +80,14 @@ const listenHandler = (
nextPlayerVolumeCalculation =
((fadeDuration - timeLeft) / fadeDuration) * playQueue.volume;
break;
case 'dipped':
// https://math.stackexchange.com/a/4622
percentageOfFadeLeft = timeLeft / fadeDuration;
currentPlayerVolumeCalculation =
(percentageOfFadeLeft * playQueue.volume) ** 2;
nextPlayerVolumeCalculation =
((percentageOfFadeLeft - 1) * playQueue.volume) ** 2;
break;
default:
currentPlayerVolumeCalculation =
(timeLeft / fadeDuration) * playQueue.volume;

1
src/components/settings/Config.tsx

@ -232,6 +232,7 @@ const Config = () => {
>
<Radio value="equalPower">Equal Power</Radio>
<Radio value="linear">Linear</Radio>
<Radio value="dipped">Dipped</Radio>
</RadioGroup>
<br />
<ControlLabel>Volume fade</ControlLabel>

Loading…
Cancel
Save