-
Notifications
You must be signed in to change notification settings - Fork 15
/
resolvers.js
67 lines (59 loc) · 2.48 KB
/
resolvers.js
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
function key_resolver(key) {
switch ( key ) {
// drum buttons
case '1': return [0, 0, 'drum']; break;
case '2': return [1, 0, 'drum']; break;
case '3': return [2, 0, 'drum']; break;
case '4': return [3, 0, 'drum']; break;
case 'q': return [0, 1, 'drum']; break;
case 'w': return [1, 1, 'drum']; break;
case 'e': return [2, 1, 'drum']; break;
case 'r': return [3, 1, 'drum']; break;
case 'a': return [0, 2, 'drum']; break;
case 's': return [1, 2, 'drum']; break;
case 'd': return [2, 2, 'drum']; break;
case 'f': return [3, 2, 'drum']; break;
case 'z': return [0, 3, 'drum']; break;
case 'x': return [1, 3, 'drum']; break;
case 'c': return [2, 3, 'drum']; break;
case 'v': return [3, 3, 'drum']; break;
// special buttons
case '/': return [0, 0, 'sound']; break;
case '*': return [0, 0, 'pattern']; break;
case '-': return [0, 0, 'bpm']; break;
case '7': return [0, 0, 'knob_A']; break;
case '9': return [0, 0, 'knob_B']; break;
case '+': return [0, 0, 'chord']; break;
case '6': return [0, 0, 'FX']; break;
case ' ': return [0, 0, 'play']; break;
case 'Enter': return [0, 0, 'write']; break;
// controlling sliders ( still in beta sooo... )
case 'ArrowUp': slider_control('bpm', 1, 1); break;
case 'ArrowDown': slider_control('bpm', -1, 1); break;
case 'ArrowLeft': slider_control('a', -1, .1); break;
case 'ArrowRight': slider_control('a', 1, .1); break;
case ',': slider_control('b', -1, .1); break;
case '.': slider_control('b', 1, .1); break;
};
return [0, 0, 'none'];
};
function mouse_resolver() {
// checking for sequencer buttons
for ( let x = 0; x < 4; x++ ) {
for ( let y = 0; y < 4; y++ ) {
let here_x = (interspace_x)*x+padding_x;
let here_y = (interspace_y)*y+padding_y;
if ( dist(here_x, here_y, mouseX, mouseY) < button_size ) {
return [x, y, 'drum'];
};
};
};
// checking for functional buttons
for ( let x = 0; x < 9; x++ ) {
let here_x = (interspace_x)*FUNC_BUTTONS[x][0]+padding_x;
let here_y = (interspace_y)*FUNC_BUTTONS[x][1]+padding_y;
if ( dist(here_x, here_y, mouseX, mouseY) < button_size ) {
return [FUNC_BUTTONS[x][0], FUNC_BUTTONS[x][1], FUNC_BUTTONS[x][2]];
};
};
};