ui updates

This commit is contained in:
Emanuel Rodriguez 2023-10-07 01:27:15 -07:00
parent 98247eb11c
commit 7431d06f79
2 changed files with 10 additions and 10 deletions

View File

@ -38,7 +38,7 @@
<span id="detunevoice1display">0</span> <span id="detunevoice1display">0</span>
</div> </div>
<button id="activateVoice1" style="background-color: greenyellow;">Start</button> <button id="activateVoice1" style="background-color: greenyellow;">On</button>
</div> </div>
<div> <div>
@ -63,7 +63,7 @@
</fieldset> </fieldset>
</div> </div>
<button id="activateVoice2" style="background-color: greenyellow;">Start</button> <button id="activateVoice2" style="background-color: greenyellow;">On</button>
</div> </div>
<div> <div>
@ -88,7 +88,7 @@
</fieldset> </fieldset>
</div> </div>
<button id="activateVoice3" style="background-color: greenyellow;">Start</button> <button id="activateVoice3" style="background-color: greenyellow;">On</button>
</div> </div>

View File

@ -25,7 +25,7 @@ class Synth {
this.gain = this.audioContext.createGain(); this.gain = this.audioContext.createGain();
this.oscillators = [ this.oscillators = [
this.createOscillator("sawtooth", 440, 0), this.createOscillator("sawtooth", 440, 0),
this.createOscillator("sawtooth", 435, 0), this.createOscillator("sawtooth", 440, 0),
this.createOscillator("sawtooth", 440, 0), this.createOscillator("sawtooth", 440, 0),
]; ];
this.gain.connect(this.audioContext.destination); this.gain.connect(this.audioContext.destination);
@ -152,11 +152,11 @@ window.onload = function () {
let osc1 = synth.oscillators[0]; let osc1 = synth.oscillators[0];
if (osc1.isPlaying) { if (osc1.isPlaying) {
synth.stopOsc(osc1); synth.stopOsc(osc1);
event.target.textContent = "Start"; event.target.textContent = "On";
event.target.style.backgroundColor = "greenyellow"; event.target.style.backgroundColor = "greenyellow";
} else { } else {
synth.startOsc(osc1); synth.startOsc(osc1);
event.target.textContent = "Stop"; event.target.textContent = "Off";
event.target.style.backgroundColor = "red"; event.target.style.backgroundColor = "red";
} }
}); });
@ -169,11 +169,11 @@ window.onload = function () {
let osc2 = synth.oscillators[1]; let osc2 = synth.oscillators[1];
if (osc2.isPlaying) { if (osc2.isPlaying) {
synth.stopOsc(osc2); synth.stopOsc(osc2);
event.target.textContent = "Start"; event.target.textContent = "On";
event.target.style.backgroundColor = "greenyellow"; event.target.style.backgroundColor = "greenyellow";
} else { } else {
synth.startOsc(osc2); synth.startOsc(osc2);
event.target.textContent = "Stop"; event.target.textContent = "Off";
event.target.style.backgroundColor = "red"; event.target.style.backgroundColor = "red";
} }
}); });
@ -186,11 +186,11 @@ window.onload = function () {
let osc3 = synth.oscillators[2]; let osc3 = synth.oscillators[2];
if (osc3.isPlaying) { if (osc3.isPlaying) {
synth.stopOsc(osc3); synth.stopOsc(osc3);
event.target.textContent = "Start"; event.target.textContent = "On";
event.target.style.backgroundColor = "greenyellow"; event.target.style.backgroundColor = "greenyellow";
} else { } else {
synth.startOsc(osc3); synth.startOsc(osc3);
event.target.textContent = "Stop"; event.target.textContent = "Off";
event.target.style.backgroundColor = "red"; event.target.style.backgroundColor = "red";
} }
}); });