forked from wizgrav/novation-launchpad
-
Notifications
You must be signed in to change notification settings - Fork 1
/
launchpad_keys.js
122 lines (103 loc) · 2.19 KB
/
launchpad_keys.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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
/*
* KEYS PAGE
*
* */
keysPage = new Page();
keysPage.title = "Keys / Drums";
keysPage.updateOutputState = function()
{
clear();
this.canScrollUp = activeNoteMap.canScrollUp();
this.canScrollDown = activeNoteMap.canScrollDown();
this.canScrollLeft = activeNoteMap.canScrollLeft();
this.canScrollRight = activeNoteMap.canScrollRight();
this.updateScrollButtons();
setTopLED(5,
TEMPMODE == TempMode.USER1
? Colour.GREEN_FULL
: (TEMPMODE == TempMode.OFF
? Colour.YELLOW_FULL
: Colour.OFF));
for(var i=0; i<4; i++)
{
var isCurrent = noteMaps[i] == activeNoteMap;
var hasMap = noteMaps[i] != null;
setRightLED(i, hasMap ? (isCurrent ? Colour.GREEN_FULL : Colour.GREEN_LOW) : Colour.OFF);
}
this.drawKeys();
};
keysPage.onShift = function(isPressed)
{
}
keysPage.onSceneButton = function(row, isPressed)
{
if (!isPressed) return;
if (noteMaps[row] != null)
{
activeNoteMap = noteMaps[row];
host.showPopupNotification("Scale: " + activeNoteMap.getName());
updateNoteTranlationTable(activeNoteMap);
}
};
keysPage.onLeft = function(isPressed)
{
if (isPressed)
{
activeNoteMap.scrollLeft();
}
};
keysPage.onRight = function(isPressed)
{
if (isPressed)
{
activeNoteMap.scrollRight();
}
};
keysPage.onUp = function(isPressed)
{
if (isPressed)
{
activeNoteMap.scrollUp();
}
};
keysPage.onDown = function(isPressed)
{
if (isPressed)
{
activeNoteMap.scrollDown();
}
};
keysPage.scrollKey = function(offset)
{
keysPage.rootKey = Math.max(0, Math.min(70, keysPage.rootKey + offset));
};
keysPage.onGridButton = function(row, column, velocity)
{
/*var pressed = velocity > 0;
var key = activeNoteMap.cellToKey(column, row);
if (key >= 0)
{
if (pressed)
{
cursorTrack.startNote(key, velocity);
}
else
{
cursorTrack.stopNote(key, velocity);
}
}*/
};
keysPage.drawKeys = function()
{
for(var y=0; y<8; y++)
{
for(var x=0; x<8; x++)
{
activeNoteMap.drawCell(x, y, false);
}
}
};
keysPage.shouldKeyBeUsedForNoteInport = function(x,y)
{
return true;
}