Commit 9f26b6d2 authored by pumpkin's avatar pumpkin

Support of category + fix responsivness.

parent 6c8913fc
......@@ -28,6 +28,10 @@ select {
min-width: 200px;
}
.flex-column * {
margin: 5px 0;
}
.tab-content select {
width: 100%;
}
......@@ -46,7 +50,7 @@ select {
margin-left: 10px;
}
#synth {
#synth, #category {
background-color: #282c34;
border: none;
......
......@@ -5,103 +5,134 @@ var STATUS_NOT_COMPATIBLE = "Web browser not compatible!";
var WARNING_PATCH_LOAD = 'By loading a patch you are going to lose the current patch edition.';
var WARNING_PATCH_NEW = 'By initializing a new patch you are going to lose the current patch edition.';
var CATEGORIES = [
'None',
'Arp',
'Bass',
'Bell',
'Classic',
'Drum',
'Keyboard',
'Lead',
'Movement',
'Pad',
'Poly',
'SFX',
'String',
'User',
'Voc/Tune'
];
var GENRES = [
'None',
'Classic',
'D&B/Breaks',
'House',
'Industrial',
'Jazz',
'R&B/HHop',
'Rock/Pop',
'Techno',
'Dubstep'
];
// LFO computed values
var LFO_MAP_FROM_CIRCUIT = {
1: {
"FADE_MODE": {
48: 3,
32: 2,
16: 1,
0: 0,
},
"ONE_SHOT": {
0: 12,
1: 13
},
"KEY_SYNC": {
0: 14,
2: 15
},
"COMMON_SYNC": {
0: 16,
4: 17,
},
"DELAY_TRIGGER": {
0: 18,
8: 19
}
1: {
"FADE_MODE": {
48: 3,
32: 2,
16: 1,
0: 0,
},
"ONE_SHOT": {
0: 12,
1: 13
},
"KEY_SYNC": {
0: 14,
2: 15
},
"COMMON_SYNC": {
0: 16,
4: 17,
},
"DELAY_TRIGGER": {
0: 18,
8: 19
}
},
2: {
"FADE_MODE": {
48: 7,
32: 6,
16: 5,
0: 4,
},
"ONE_SHOT": {
0: 22,
1: 23
},
"KEY_SYNC": {
0: 24,
2: 25
},
2: {
"FADE_MODE": {
48: 7,
32: 6,
16: 5,
0: 4,
},
"ONE_SHOT": {
0: 22,
1: 23
},
"KEY_SYNC": {
0: 24,
2: 25
},
"COMMON_SYNC": {
0: 26,
4: 27,
},
"DELAY_TRIGGER": {
0: 28,
8: 29
}
"COMMON_SYNC": {
0: 26,
4: 27,
},
"DELAY_TRIGGER": {
0: 28,
8: 29
}
}
};
var LFO_MAP_TO_CIRCUIT = {
1: {
// Fade mode
0: 0,
1: 16,
2: 32,
3: 48,
1: {
// Fade mode
0: 0,
1: 16,
2: 32,
3: 48,
// One shot
12: 0,
13: 1,
// One shot
12: 0,
13: 1,
// Key sync
14: 0,
15: 2,
// Key sync
14: 0,
15: 2,
// Common sync
16: 0,
17: 4,
// Common sync
16: 0,
17: 4,
// Delay trigger
18: 0,
19: 8,
},
2: {
// Fade mode
4: 0,
5: 16,
6: 32,
7: 48,
// Delay trigger
18: 0,
19: 8,
},
2: {
// Fade mode
4: 0,
5: 16,
6: 32,
7: 48,
// One shot
22: 0,
23: 1,
// One shot
22: 0,
23: 1,
// Key sync
24: 0,
25: 2,
// Key sync
24: 0,
25: 2,
// Common sync
26: 0,
27: 4,
// Common sync
26: 0,
27: 4,
// Delay trigger
28: 0,
29: 8,
}
// Delay trigger
28: 0,
29: 8,
}
}
......@@ -67,10 +67,13 @@ function getData() {
// Synth values
let synthData = extractSynthValuesFromDOM(allItems);
return mergeDataWithSysexMetadata(synthData);
// Category value
let category = document.querySelector('#category').value;
return mergeDataWithSysexMetadata(synthData, category);
}
function mergeDataWithSysexMetadata(data, type) {
function mergeDataWithSysexMetadata(data, category) {
if (data.length !== 308) {
throw "Synth data incoherent. Must be 308: " + data.length;
}
......@@ -104,8 +107,8 @@ function mergeDataWithSysexMetadata(data, type) {
}
metadata = metadata.concat(patchNameCode);
// 2 Patch genre & category
metadata = metadata.concat([0, 0]);
// 2 Patch category & genre
metadata = metadata.concat([category, 0]);
// 14 Empty
metadata = metadata.concat([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]);
......@@ -174,7 +177,7 @@ function resetPatch() {
}
function resetValues() {
let allItems = [].slice.call(document.querySelectorAll('fieldset input, fieldset select'));
let allItems = [].slice.call(document.querySelectorAll('fieldset input, fieldset select, #category'));
for (var i = 0; i < allItems.length; i++) {
var item = allItems[i];
......
......@@ -69,12 +69,29 @@
<br/>
<p class="d-flex justify-content-between">
<p class="d-flex justify-content-between flex-column flex-md-row">
<input id="patchName" placeholder="Patch name" maxlength="16" name="name" class="patchName"/>
<select id="synth" >
<option value="1">Synth 1</option>
<option value="2">Synth 2</option>
</select>
<select id="category" default="0" >
<option value="0" selected>No category</option>
<option value="1">Arp</option>
<option value="2">Bass</option>
<option value="3">Bell</option>
<option value="4">Classic</option>
<option value="5">Drum</option>
<option value="6">Keyboard</option>
<option value="7">Lead</option>
<option value="8">Movement</option>
<option value="9">Pad</option>
<option value="10">Poly</option>
<option value="11">SFX</option>
<option value="12">String</option>
<option value="13">User</option>
<option value="14">Voc/Tune</option>
</select>
</p>
<div class="tab-content synth1">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment