Skip to content
This repository has been archived by the owner on Jul 9, 2024. It is now read-only.

Commit

Permalink
feat: increment gain by 2
Browse files Browse the repository at this point in the history
  • Loading branch information
adil192 committed May 2, 2024
1 parent fec4f35 commit d7599a6
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/scripts/amplify_videos.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,13 @@
}

function onAmplifyButtonClick() {
console.log('Amplifying volume');
if (!audioContextGain) return;

let gain = Math.round(audioContextGain.gain.value);
gain = (gain < maxGain) ? (gain + 1) : 1;
if (gain <= 1) gain = 2;
else if (gain >= maxGain) gain = 1;
else gain += 2;
console.log('Amplifying volume to', gain);

audioContextGain.gain.value = gain;
updateButton();
Expand All @@ -77,7 +79,10 @@
e.preventDefault();

let gain = Math.round(audioContextGain.gain.value);
gain = (gain > 1) ? (gain - 1) : maxGain;
if (gain <= 1) gain = maxGain;
else if (gain == 2) gain = 1;
else gain -= 2;
console.log('Unamplifying volume to', gain);

audioContextGain.gain.value = gain;
updateButton();
Expand Down

0 comments on commit d7599a6

Please sign in to comment.