Skip to content

Commit 28cf3ab

Browse files
author
maurinElectroTextile
committed
Mapping_lib Updated with e256_firmware
1 parent 0da6556 commit 28cf3ab

12 files changed

Lines changed: 370 additions & 190 deletions

File tree

docs/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
<script type="importmap">
3434
{
3535
"imports": {
36-
"three": "./js/lib/three.module.js"
36+
"three": "./js/lib/three.module.min.js"
3737
}
3838
}
3939
</script>

docs/js/e256_config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ const DATA1 = {
105105
const DATA2 = {
106106
0x80: "velo",
107107
0x90: "velo",
108-
0xA0: "ctr", // TESTING
108+
0xA0: "ctr",
109109
0xB0: null,
110110
0xC0: null,
111111
0xD0: "msb",

docs/js/e256_mappings/grid.js

Lines changed: 30 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ function grid_factory() {
2727
var _grid = new paper.Group({
2828
"name": "grid",
2929
"modes": {
30-
0: "NOTE_ON", // TRIGGER WITH VELOCITY
31-
1: "C_CHANGE", // PRESSURE ONLY
32-
2: "AFTERTOUCH_POLY" // TRIGGER AND PRESSURE
30+
0: "NOTE_ON", // TRIGGER NOTE WITH VELOCITY
31+
1: "C_CHANGE", // PRESSURE ONLY
32+
2: "AFTERTOUCH_POLY" // TRIGGER NOTE AND MODULATE
3333
},
3434
"data": {
3535
"from": null,
@@ -75,7 +75,7 @@ function grid_factory() {
7575
this.data.cols = params.cols;
7676
this.data.rows = params.rows;
7777
this.data.msg = params.msg;
78-
let status = midi_msg_status_unpack(params.msg[0].press.midi.status);
78+
let status = midi_msg_status_unpack(params.msg[0].press.midi.status).type;
7979
this.data.mode_z = status.type;
8080
},
8181

@@ -90,7 +90,7 @@ function grid_factory() {
9090
previous_key_count = current_key_count;
9191
current_key_count = this.data.cols * this.data.rows;
9292
this.data.msg = [];
93-
if (this.data.mode_z !== previous_key_mode_z) {
93+
if (this.data.mode_z != previous_key_mode_z) {
9494
for (let _key = 0; _key < current_key_count; _key++) {
9595
let key_msg = {};
9696
key_msg.press = midi_msg_builder(this.data.mode_z);
@@ -100,9 +100,10 @@ function grid_factory() {
100100
else {
101101
for (let _key = 0; _key < current_key_count; _key++) {
102102
if (_key < previous_key_count) {
103-
let status = midi_msg_status_unpack(this.children["keys-group"].children[_key].msg.press.midi.status);
104-
let new_status = midi_msg_status_pack(this.data.mode_z, status.channel);
105-
this.children["keys-group"].children[_key].msg.press.midi.status = new_status;
103+
// ERROR -> QUIK_FIXME
104+
//let status = midi_msg_status_unpack(this.children["keys-group"].children[_key].msg.press.midi.status);
105+
//let new_status = midi_msg_status_pack(this.data.mode_z, status.channel);
106+
//this.children["keys-group"].children[_key].msg.press.midi.status = new_status;
106107
this.data.msg.push(this.children["keys-group"].children[_key].msg);
107108
}
108109
else {
@@ -146,41 +147,54 @@ function grid_factory() {
146147

147148
_key_frame.onMouseEnter = function () {
148149
this.style.fillColor = "orange";
149-
}
150+
};
150151

151152
_key_frame.onMouseLeave = function () {
152153
this.style.fillColor = "pink";
153-
}
154+
};
154155

155156
_key_frame.onMouseDown = function () {
156157
previous_touch = current_touch;
157158
current_touch = _key_group;
158159
this.style.fillColor = "red";
159160
switch (e256_current_mode) {
160161
case EDIT_MODE:
162+
// N/A
161163
break;
162-
case PLAY_MODE:
164+
case THROUGH_MODE:
163165
// Set midi_msg status to NOTE_ON
164166
_key_group.msg.press.midi.status = _key_group.msg.press.midi.status | NOTE_ON;
165167
_key_group.msg.press.midi.data2 = 127;
166168
send_midi_msg(_key_group.msg.press.midi);
167169
break;
170+
case PLAY_MODE:
171+
// N/A
172+
break;
168173
}
169-
}
174+
};
170175

171176
_key_frame.onMouseUp = function () {
172177
this.style.fillColor = "orange";
173178
switch (e256_current_mode) {
174179
case EDIT_MODE:
180+
// N/A
175181
break;
176-
case PLAY_MODE:
182+
case THROUGH_MODE:
177183
// Set midi_msg status to NOTE_OFF
178184
_key_group.msg.press.midi.status = _key_group.msg.press.midi.status & NOTE_OFF;
179185
_key_group.msg.press.midi.data2 = 0;
180186
send_midi_msg(_key_group.msg.press.midi);
181187
break;
188+
case PLAY_MODE:
189+
// N/A
190+
break;
182191
}
183-
}
192+
};
193+
194+
_key_frame.onMidiMsg = function (midiMsg) {
195+
// TODO
196+
//midiMsg
197+
};
184198

185199
_key_group.addChild(_key_frame);
186200

@@ -358,7 +372,7 @@ function grid_factory() {
358372
}
359373
break;
360374
case PLAY_MODE:
361-
// NA
375+
// N/A
362376
break;
363377
}
364378
}
@@ -376,7 +390,7 @@ function grid_factory() {
376390
}
377391
break;
378392
case PLAY_MODE:
379-
// NA
393+
// N/A
380394
break;
381395
}
382396
}

docs/js/e256_mappings/knob.js

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ function knob_factory() {
2020
"radius": null,
2121
"theta": null,
2222
"modes": {
23-
0: "NOTE_ON", // TRIGGER WITH VELOCITY
24-
1: "C_CHANGE", // PRESSURE ONLY
25-
2: "AFTERTOUCH_POLY" // TRIGGER AND PRESSURE
23+
0: "NOTE_ON", // TRIGGER NOTE WITH VELOCITY
24+
1: "C_CHANGE", // PRESSURE ONLY
25+
2: "AFTERTOUCH_POLY" // TRIGGER NOTE AND MODULATE
2626
},
2727
"data": {
2828
"touchs": null,
@@ -90,7 +90,7 @@ function knob_factory() {
9090

9191
this.data.msg = [];
9292
let midi_touch;
93-
if (this.data.mode_z !== previous_touch_mode_z) {
93+
if (this.data.mode_z != previous_touch_mode_z) {
9494
for (let _touch = 0; _touch < this.data.touchs; _touch++) {
9595
midi_touch = {};
9696
midi_touch.radius = midi_msg_builder(DEFAULT_KNOB_MODE_R);
@@ -102,9 +102,10 @@ function knob_factory() {
102102
else {
103103
for (let _touch = 0; _touch < this.data.touchs; _touch++) {
104104
if (_touch < previous_touch_count) {
105-
let status = midi_msg_status_unpack(this.children["touchs-group"].children[_touch].msg.press.midi.status);
106-
let new_status = midi_msg_status_pack(this.data.mode_z, status.channel);
107-
this.children["touchs-group"].children[_touch].msg.press.midi.status = new_status;
105+
// ERROR -> QUIK_FIXME
106+
//let status = midi_msg_status_unpack(this.children["touchs-group"].children[_touch].msg.press.midi.status);
107+
//let new_status = midi_msg_status_pack(this.data.mode_z, status.channel);
108+
//this.children["touchs-group"].children[_touch].msg.press.midi.status = new_status;
108109
this.data.msg.push(this.children["touchs-group"].children[_touch].msg);
109110
}
110111
else {
@@ -191,7 +192,7 @@ function knob_factory() {
191192
_knob_touch.onMouseDrag = function (mouseEvent) {
192193
switch (e256_current_mode) {
193194
case EDIT_MODE:
194-
// NA
195+
// N/A
195196
break;
196197
case PLAY_MODE:
197198
let x = mouseEvent.point.x - _knob.center.x; // Place the x origin to the circle center
@@ -291,7 +292,7 @@ function knob_factory() {
291292
}
292293
break;
293294
case PLAY_MODE:
294-
// NA
295+
// N/A
295296
break;
296297
}
297298
}
@@ -326,7 +327,7 @@ function knob_factory() {
326327
update_item_main_params(_knob_group.parent);
327328
break;
328329
case PLAY_MODE:
329-
// NA
330+
// N/A
330331
break;
331332
}
332333
}

docs/js/e256_mappings/path.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ function path_factory() {
1616
"data": {
1717
"touchs": null,
1818
"segments": null,
19+
"mode_z": null,
1920
"msg": null
2021
},
2122

@@ -108,7 +109,7 @@ function path_factory() {
108109
_touch_group.onMouseMove = function (mouseEvent) {
109110
switch (e256_current_mode) {
110111
case EDIT_MODE:
111-
// NA
112+
// N/A
112113
break;
113114
case PLAY_MODE:
114115
if (_touch_group.data.midi.position.val != _touch_group.prev_position) {
@@ -213,7 +214,7 @@ function path_factory() {
213214
}
214215
break;
215216
case PLAY_MODE:
216-
// NA
217+
// N/A
217218
break;
218219
}
219220
}

docs/js/e256_mappings/slider.js

Lines changed: 49 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ function slider_factory() {
1212
const DEFAULT_SLIDER_MIN_WIDTH = 50;
1313
const DEFAULT_SLIDER_MIN_HEIGHT = 100;
1414
const DEFAULT_SLIDER_TOUCHS = 1;
15-
const DEFAULT_SLIDER_TOUCHS_MODE = C_CHANGE;
16-
const DEFAULT_SLIDER_TOUCHS_MODE_Z = NOTE_ON;
15+
const DEFAULT_SLIDER_MODE_POS = C_CHANGE;
16+
const DEFAULT_SLIDER_MODE_Z = NOTE_ON;
1717
const DEFAULT_SLIDER_DIR = "V_SLIDER";
1818

1919
let current_frame_width = null;
@@ -25,9 +25,9 @@ function slider_factory() {
2525
"name": "slider",
2626
"dir": null,
2727
"modes": {
28-
0: "NOTE_ON", // TRIGGER WITH VELOCITY
29-
1: "C_CHANGE", // PRESSURE ONLY
30-
2: "AFTERTOUCH_POLY" // TRIGGER AND PRESSURE
28+
0: "NOTE_ON", // TRIGGER NOTE WITH VELOCITY
29+
1: "C_CHANGE", // PRESSURE ONLY
30+
2: "AFTERTOUCH_POLY" // TRIGGER NOTE AND MODULATE
3131
},
3232
"data": {
3333
"touchs": null,
@@ -40,7 +40,7 @@ function slider_factory() {
4040
setup_from_mouse_event: function (mouseEvent) {
4141
this.dir = DEFAULT_SLIDER_DIR;
4242
this.data.touchs = DEFAULT_SLIDER_TOUCHS;
43-
this.data.mode_z = DEFAULT_SLIDER_TOUCHS_MODE_Z;
43+
this.data.mode_z = DEFAULT_SLIDER_MODE_Z;
4444
this.data.from = new paper.Point(
4545
mouseEvent.point.x - (DEFAULT_SLIDER_WIDTH / 2),
4646
mouseEvent.point.y - (DEFAULT_SLIDER_HEIGHT / 2)
@@ -50,12 +50,23 @@ function slider_factory() {
5050
mouseEvent.point.y + (DEFAULT_SLIDER_HEIGHT / 2)
5151
);
5252
this.data.msg = [];
53-
let touch_msg;
5453
for (let _touch = 0; _touch < DEFAULT_SLIDER_TOUCHS; _touch++) {
55-
touch_msg = {};
56-
touch_msg.pos = midi_msg_builder(DEFAULT_SLIDER_TOUCHS_MODE);
57-
touch_msg.press = midi_msg_builder(DEFAULT_SLIDER_TOUCHS_MODE_Z);
58-
this.data.msg.push(touch_msg);
54+
let touch_msg = {};
55+
touch_msg.pos = midi_msg_builder(DEFAULT_SLIDER_MODE_POS);
56+
switch (this.data.mode_z) {
57+
case NOTE_ON:
58+
touch_msg.note = midi_msg_builder(NOTE_ON);
59+
//touch_msg.press = null;
60+
break;
61+
case C_CHANGE:
62+
//touch_msg.note = null;
63+
touch_msg.press = midi_msg_builder(C_CHANGE);
64+
break;
65+
case AFTERTOUCH_POLY:
66+
touch_msg.note = midi_msg_builder(NOTE_ON);
67+
touch_msg.press = midi_msg_builder(C_CHANGE);
68+
break;
69+
} this.data.msg.push(touch_msg);
5970
}
6071
},
6172

@@ -84,32 +95,49 @@ function slider_factory() {
8495
save_params: function () {
8596
this.dir = this.children["slider-group"].dir;
8697
let previous_touch_count = this.data.touchs;
87-
let previous_touch_mode_z = this.data.mode_z;
8898
this.data.touchs = this.children["slider-group"].data.touchs;
8999
this.data.from = this.children["slider-group"].data.from;
90100
this.data.to = this.children["slider-group"].data.to;
101+
102+
let previous_mode_z = this.data.mode_z;
91103
this.data.mode_z = this.children["slider-group"].data.mode_z;
92104

93105
this.data.msg = [];
94-
if (this.data.mode_z !== previous_touch_mode_z) {
106+
if (this.data.mode_z != previous_mode_z) {
95107
for (let _touch = 0; _touch < this.data.touchs; _touch++) {
96108
let touch_msg = {};
97-
touch_msg.pos = midi_msg_builder(DEFAULT_SLIDER_TOUCHS_MODE);
109+
touch_msg.pos = midi_msg_builder(DEFAULT_SLIDER_MODE_POS);
98110
touch_msg.press = midi_msg_builder(this.data.mode_z);
99111
this.data.msg.push(touch_msg);
100112
}
101113
}
102114
else {
103115
for (let _touch = 0; _touch < this.data.touchs; _touch++) {
104116
if (_touch < previous_touch_count) {
105-
let status = midi_msg_status_unpack(this.children["touchs-group"].children[_touch].msg.press.midi.status);
106-
let new_status = midi_msg_status_pack(this.data.mode_z, status.channel);
107-
this.children["touchs-group"].children[_touch].msg.press.midi.status = new_status;
117+
// ERROR -> QUIK_FIXME
118+
//let status = midi_msg_status_unpack(this.children["touchs-group"].children[_touch].msg.press.midi.status);
119+
//let new_status = midi_msg_status_pack(this.data.mode_z, status.channel);
120+
//this.children["touchs-group"].children[_touch].msg.press.midi.status = new_status;
108121
this.data.msg.push(this.children["touchs-group"].children[_touch].msg);
109122
}
110123
else {
111124
let touch_msg = {};
112-
touch_msg.pos = midi_msg_builder(DEFAULT_SLIDER_TOUCHS_MODE);
125+
touch_msg.pos = midi_msg_builder(DEFAULT_SLIDER_MODE_POS);
126+
switch (this.data.mode_z) {
127+
case NOTE_ON:
128+
touch_msg.note = midi_msg_builder(NOTE_ON);
129+
//touch_msg.press = null;
130+
break;
131+
case C_CHANGE:
132+
//touch_msg.note = null;
133+
touch_msg.press = midi_msg_builder(C_CHANGE);
134+
break;
135+
case AFTERTOUCH_POLY:
136+
touch_msg.note = midi_msg_builder(NOTE_ON);
137+
touch_msg.press = midi_msg_builder(C_CHANGE);
138+
break;
139+
}
140+
113141
touch_msg.press = midi_msg_builder(this.data.mode_z);
114142
this.data.msg.push(touch_msg);
115143
}
@@ -221,7 +249,7 @@ function slider_factory() {
221249
_touch_circle.onMouseDrag = function (mouseEvent) {
222250
switch (e256_current_mode) {
223251
case EDIT_MODE:
224-
// NA
252+
// N/A
225253
break;
226254
case PLAY_MODE:
227255
switch (_slider.dir) {
@@ -468,7 +496,7 @@ function slider_factory() {
468496
update_item_main_params(_slider_group.parent);
469497
break;
470498
case PLAY_MODE:
471-
// NA
499+
// N/A
472500
break;
473501
}
474502
}
@@ -487,7 +515,7 @@ function slider_factory() {
487515
}
488516
break;
489517
case PLAY_MODE:
490-
// NA
518+
// N/A
491519
break;
492520
}
493521
}

0 commit comments

Comments
 (0)