Skip to content

Commit

Permalink
changed keys
Browse files Browse the repository at this point in the history
keys now ZXCVBNM,.
  • Loading branch information
gawainhewitt committed Jul 9, 2021
1 parent 3a904b0 commit d033a43
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 38 deletions.
2 changes: 1 addition & 1 deletion dist/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ <h1>loading...<br>loading...<br>loading...<br>loading...<br>loading...<br>loadin
<p id="welcometext">Synth Horn</p>
<p>To play: <br>
touch or click screen, <br>
or use QWERTYUIO keys<br>
or use ZXCVBNM,. keys<br>
on a keyboard<br><br>
On Apple devices,<br>
turn off silent mode</p>
Expand Down
36 changes: 18 additions & 18 deletions dist/sketch.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,71 +78,71 @@ function handleKeyDown(e) {
console.log("keydown "+key); //debugging

switch(key) { /// working here! - retriggering keys so remove the play synth and do a for loop on the array to play
case "KeyQ" :
case "KeyZ" :
if(whichKey[0] === 0) {
playSynth(0);
whichKey[0] = 1;
break;
} else {
break;
}
case "KeyW" :
case "KeyX" :
if(whichKey[1] === 0) {
playSynth(1);
whichKey[1] = 1;
break;
} else {
break;
}
case "KeyE" :
case "KeyC" :
if(whichKey[2] === 0) {
playSynth(2);
whichKey[2] = 1;
break;
} else {
break;
}
case "KeyR" :
case "KeyV" :
if(whichKey[3] === 0) {
playSynth(3);
whichKey[3] = 1;
break;
} else {
break;
}
case "KeyT" :
case "KeyB" :
if(whichKey[4] === 0) {
playSynth(4);
whichKey[4] = 1;
break;
} else {
break;
}
case "KeyY" :
case "KeyN" :
if(whichKey[5] === 0) {
playSynth(5);
whichKey[5] = 1;
break;
} else {
break;
}
case "KeyU" :
case "KeyM" :
if(whichKey[6] === 0) {
playSynth(6);
whichKey[6] = 1;
break;
} else {
break;
}
case "KeyI" :
case "Comma" :
if(whichKey[7] === 0) {
playSynth(7);
whichKey[7] = 1;
break;
} else {
break;
}
case "KeyO" :
case "Period" :
if(whichKey[8] === 0) {
playSynth(8);
whichKey[8] = 1;
Expand All @@ -157,39 +157,39 @@ function handleKeyUp(e) {
var key = e.code;
console.log("keyup "+key); //debugging
switch(key) {
case "KeyQ" :
case "KeyZ" :
stopSynth(0);
whichKey[0] = 0;
break;
case "KeyW" :
case "KeyX" :
stopSynth(1);
whichKey[1] = 0;
break;
case "KeyE" :
case "KeyC" :
stopSynth(2);
whichKey[2] = 0;
break;
case "KeyR" :
case "KeyV" :
stopSynth(3);
whichKey[3] = 0;
break;
case "KeyT" :
case "KeyB" :
stopSynth(4);
whichKey[4] = 0;
break;
case "KeyY" :
case "KeyN" :
stopSynth(5);
whichKey[5] = 0;
break;
case "KeyU" :
case "KeyM" :
stopSynth(6);
whichKey[6] = 0;
break;
case "KeyI" :
case "Comma" :
stopSynth(7);
whichKey[7] = 0;
break;
case "KeyO" :
case "Period" :
stopSynth(8);
whichKey[8] = 0;
break;
Expand Down
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ <h1>loading...<br>loading...<br>loading...<br>loading...<br>loading...<br>loadin
<p id="welcometext">Synth Horn</p>
<p>To play: <br>
touch or click screen, <br>
or use QWERTYUIO keys<br>
or use ZXCVBNM,. keys<br>
on a keyboard<br><br>
On Apple devices,<br>
turn off silent mode</p>
Expand Down
36 changes: 18 additions & 18 deletions sketch.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,71 +78,71 @@ function handleKeyDown(e) {
console.log("keydown "+key); //debugging

switch(key) { /// working here! - retriggering keys so remove the play synth and do a for loop on the array to play
case "KeyQ" :
case "KeyZ" :
if(whichKey[0] === 0) {
playSynth(0);
whichKey[0] = 1;
break;
} else {
break;
}
case "KeyW" :
case "KeyX" :
if(whichKey[1] === 0) {
playSynth(1);
whichKey[1] = 1;
break;
} else {
break;
}
case "KeyE" :
case "KeyC" :
if(whichKey[2] === 0) {
playSynth(2);
whichKey[2] = 1;
break;
} else {
break;
}
case "KeyR" :
case "KeyV" :
if(whichKey[3] === 0) {
playSynth(3);
whichKey[3] = 1;
break;
} else {
break;
}
case "KeyT" :
case "KeyB" :
if(whichKey[4] === 0) {
playSynth(4);
whichKey[4] = 1;
break;
} else {
break;
}
case "KeyY" :
case "KeyN" :
if(whichKey[5] === 0) {
playSynth(5);
whichKey[5] = 1;
break;
} else {
break;
}
case "KeyU" :
case "KeyM" :
if(whichKey[6] === 0) {
playSynth(6);
whichKey[6] = 1;
break;
} else {
break;
}
case "KeyI" :
case "Comma" :
if(whichKey[7] === 0) {
playSynth(7);
whichKey[7] = 1;
break;
} else {
break;
}
case "KeyO" :
case "Period" :
if(whichKey[8] === 0) {
playSynth(8);
whichKey[8] = 1;
Expand All @@ -157,39 +157,39 @@ function handleKeyUp(e) {
var key = e.code;
console.log("keyup "+key); //debugging
switch(key) {
case "KeyQ" :
case "KeyZ" :
stopSynth(0);
whichKey[0] = 0;
break;
case "KeyW" :
case "KeyX" :
stopSynth(1);
whichKey[1] = 0;
break;
case "KeyE" :
case "KeyC" :
stopSynth(2);
whichKey[2] = 0;
break;
case "KeyR" :
case "KeyV" :
stopSynth(3);
whichKey[3] = 0;
break;
case "KeyT" :
case "KeyB" :
stopSynth(4);
whichKey[4] = 0;
break;
case "KeyY" :
case "KeyN" :
stopSynth(5);
whichKey[5] = 0;
break;
case "KeyU" :
case "KeyM" :
stopSynth(6);
whichKey[6] = 0;
break;
case "KeyI" :
case "Comma" :
stopSynth(7);
whichKey[7] = 0;
break;
case "KeyO" :
case "Period" :
stopSynth(8);
whichKey[8] = 0;
break;
Expand Down

0 comments on commit d033a43

Please sign in to comment.