mirror of
https://codeberg.org/armin/noiz.git
synced 2026-09-01 05:50:52 +02:00
wire volume gain node in audio graph and volume slider
This commit is contained in:
parent
a225805f27
commit
dae39818f9
1 changed files with 5 additions and 3 deletions
|
|
@ -364,7 +364,10 @@ function initAudioCtx() {
|
|||
gainB.connect(splitter);
|
||||
splitter.connect(analyserL, 0);
|
||||
splitter.connect(analyserR, 1);
|
||||
analyser.connect(audioCtx.destination);
|
||||
volumeGain = audioCtx.createGain();
|
||||
volumeGain.gain.value = parseFloat(volumeSlider.value);
|
||||
analyser.connect(volumeGain);
|
||||
volumeGain.connect(audioCtx.destination);
|
||||
} catch (e) {}
|
||||
}
|
||||
const canvas = document.getElementById('spectrum');
|
||||
|
|
@ -1673,8 +1676,7 @@ waveformWrap.addEventListener('click', (e) => {
|
|||
});
|
||||
volumeSlider.addEventListener('input', () => {
|
||||
const v = parseFloat(volumeSlider.value);
|
||||
audioElA.volume = v;
|
||||
audioElB.volume = v;
|
||||
if (volumeGain) volumeGain.gain.value = v;
|
||||
volDisplay.textContent = Math.round(v * 100);
|
||||
});
|
||||
addFolderBtn.addEventListener('click', addFolder);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue