-
Notifications
You must be signed in to change notification settings - Fork 0
/
demo.html
38 lines (36 loc) · 1.04 KB
/
demo.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<!DOCTYPE html>
<html>
<head>
<link rel="import" href="bower_components/polymer/polymer.html">
<link rel="import" href="web-midi.html">
</head>
<body>
<web-midi></web-midi>
<div class="container">
<div class="value"></div>
<div class="button"></div>
</div>
<script type="text/javascript">
//https://webaudio.github.io/web-midi-api/#examples
document.querySelector('web-midi').addEventListener('change', (e)=>{
document.querySelector('.value').innerHTML = e.detail.value;
var buttonStr = '';
switch(e.detail.value) {
case '92 24 7f ':
buttonStr = '1x1';
break;
case '92 25 7f ':
buttonStr = '1x2';
break;
case '92 26 7f ':
buttonStr = '1x3';
break;
case '92 27 7f ':
buttonStr = '1x4';
break;
}
document.querySelector('.button').innerHTML = buttonStr;
});
</script>
</body>
</html>