make radio buttons happen
This commit is contained in:
parent
3d85edfc98
commit
3273b1e6db
|
@ -64,12 +64,28 @@ window.onload = function() {
|
||||||
console.log("hello world!");
|
console.log("hello world!");
|
||||||
console.log(synth);
|
console.log(synth);
|
||||||
|
|
||||||
var selectedWaveType = document.querySelector("input[name='wave']");
|
|
||||||
selectedWaveType.addEventListener("change", () => {
|
var waveTypeChoicesButtons = document.querySelectorAll("input[name='wave']");
|
||||||
let selectedWaveTypeValue = document.querySelector("input[name='wave']:checked").value;
|
// waveTypeChoicesButtons.forEach((radio) => {
|
||||||
console.log("the value of the wave has changed to" + selectedWaveTypeValue);
|
// radio.addEventListener("change", (event) => {
|
||||||
synth.setOscWaveType(selectedWaveTypeValue);
|
// if (event.target.checked) {
|
||||||
|
// let selectedWaveType = event.target.value;
|
||||||
|
// synth.setOscWaveType(selectedWaveType);
|
||||||
|
// }
|
||||||
|
// })
|
||||||
|
// })
|
||||||
|
|
||||||
|
waveTypeChoicesButtons.forEach((rb) => {
|
||||||
|
rb.addEventListener("change", (event) => {
|
||||||
|
let selectedWave = document.querySelector("input[name='wave']:checked").value;
|
||||||
|
synth.setOscWaveType(selectedWave);
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
console.info(waveTypeChoicesButtons);
|
||||||
|
console.log("the selected wave:" + waveTypeChoicesButtons);
|
||||||
var detune = document.getElementById("detune");
|
var detune = document.getElementById("detune");
|
||||||
detune.addEventListener("input", () => {
|
detune.addEventListener("input", () => {
|
||||||
synth.setOscDetune(parseFloat(detune.value))
|
synth.setOscDetune(parseFloat(detune.value))
|
||||||
|
|
Loading…
Reference in New Issue