forked from einfachfelixverdammt/Maschine-Jam-for-Bitwig
-
Notifications
You must be signed in to change notification settings - Fork 0
/
PadMode.js
110 lines (88 loc) · 2.88 KB
/
PadMode.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
/**
* @classdesc Mode in which the Pads are used to play Notes
* @class
* @augments JamMode
*
* @param {NoteView} noteView
* @param {DrumPadView} drumPadView
* @param {TrackViewContainer} trackView reference to Clip Mode object
* @param {SceneView} sceneView reference to Clip Mode object
* @param {Clip} cursorClip
*
* @returns {PadMode}
*/
function PadMode(noteView, drumPadView, trackView, sceneView, cursorClip, cursorDevice, sceneView) {
JamMode.call(this, noteView, trackView, sceneView);
var handleEvent = this.handleEvent;
this.updatePitchNames = function (size, mapping, key, name) {
drumPadView.updatePitchNames(size, mapping, key, name);
};
this.handleEvent = function (sender, row, col, value, notenr) {
handleEvent.call(this,sender, row, col, value, notenr);
var note = 0;
if (this.mainView === drumPadView) {
note = ((7 - row) * 4) + 36 + (col - 4);
cursorDevice.selectParent();
cursorDevice.selectFirstInKeyPad(note);
}
};
this.receiveNote = function (on, note, velocity) {
this.mainView.receiveNote(on, note, velocity);
};
this.updateTrackColor = function (color) {
noteView.updateTrackColor(color);
drumPadView.updateTrackColor(color);
};
this.inNoteView = function () {
return this.mainView === noteView;
};
this.inDrumView = function () {
return this.mainView === drumPadView;
};
this.setToNoteView = function () {
if (this.mainView !== noteView) {
this.mainView.exit();
this.mainView = noteView;
this.mainView.enter();
}
};
this.setToDrumView = function () {
drumPadView.setStepMode(false);
if (this.mainView !== drumPadView) {
this.mainView.exit();
this.mainView = drumPadView;
this.mainView.enter();
}
};
this.selectionModAction = function () {
noteView.selectionModAction();
};
this.update = function () {
sceneView.update();
this.mainView.update();
};
this.notifyShift = function (shiftDown) {
this.mainView.notifyShift(shiftDown);
};
this.notifyModifier = function (modifierState) {
this.mainView.notifyModifier(modifierState);
};
/**
* @return {NoteView}
*/
this.getNoteView = function () {
return noteView;
};
this.navigate = function (direction) {
this.mainView.navigate(direction);
};
this.notifyClear = function (clearDown) {
if (clearDown)
cursorClip.clearSteps();
};
this.postEnter = function () {
modifiers.setLockButtonState(false);
modifiers.setLockButtonHandler(function (value) {
});
};
}