Skip to content

Commit ed570f0

Browse files
authored
Merge pull request #654 from shorepine/patch_event_gen
patch event gen
2 parents 5a52b38 + 7d7c621 commit ed570f0

4 files changed

Lines changed: 46 additions & 86 deletions

File tree

tulip/amyboardweb/static/amy_event_layout.generated.js

Lines changed: 45 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -9,65 +9,64 @@ window.AMY_EVENT_LAYOUT = {
99
"NUM_COMBO_COEFS": 9
1010
},
1111
"offsets": {
12-
"algo_source": 264,
13-
"algorithm": 246,
12+
"algo_source": 260,
13+
"algorithm": 242,
1414
"amp_coefs": 20,
15-
"bp0": 340,
16-
"bp1": 596,
17-
"bp_is_set": 260,
18-
"chained_osc": 242,
19-
"chorus_depth": 920,
20-
"chorus_level": 908,
21-
"chorus_lfo_freq": 916,
22-
"chorus_max_delay": 912,
23-
"detune": 212,
15+
"bp0": 336,
16+
"bp1": 592,
17+
"bp_is_set": 256,
18+
"chained_osc": 238,
19+
"chorus_depth": 916,
20+
"chorus_level": 904,
21+
"chorus_lfo_freq": 912,
22+
"chorus_max_delay": 908,
2423
"duty_coefs": 128,
25-
"echo_delay_ms": 892,
26-
"echo_feedback": 900,
27-
"echo_filter_coef": 904,
28-
"echo_level": 888,
29-
"echo_max_delay_ms": 896,
30-
"eg_type": 852,
31-
"eq_h": 256,
32-
"eq_l": 248,
33-
"eq_m": 252,
24+
"echo_delay_ms": 888,
25+
"echo_feedback": 896,
26+
"echo_filter_coef": 900,
27+
"echo_level": 884,
28+
"echo_max_delay_ms": 892,
29+
"eg_type": 848,
30+
"eq_h": 252,
31+
"eq_l": 244,
32+
"eq_m": 248,
3433
"feedback": 200,
3534
"filter_freq_coefs": 92,
36-
"filter_type": 247,
35+
"filter_type": 243,
3736
"freq_coefs": 56,
38-
"grab_midi_notes": 863,
39-
"latency_ms": 228,
37+
"grab_midi_notes": 859,
38+
"latency_ms": 224,
4039
"midi_note": 12,
41-
"mod_source": 244,
42-
"note_source": 881,
43-
"num_voices": 866,
40+
"mod_source": 240,
41+
"note_source": 877,
42+
"num_voices": 862,
4443
"osc": 4,
4544
"pan_coefs": 164,
4645
"patch_number": 16,
47-
"pedal": 864,
46+
"pedal": 860,
4847
"phase": 208,
49-
"pitch_bend": 220,
50-
"portamento_ms": 240,
48+
"pitch_bend": 216,
49+
"portamento_ms": 236,
5150
"preset": 8,
52-
"ratio": 232,
53-
"reset_osc": 884,
54-
"resonance": 236,
55-
"reverb_damping": 932,
56-
"reverb_level": 924,
57-
"reverb_liveness": 928,
58-
"reverb_xover_hz": 936,
59-
"sequence": 868,
60-
"status": 880,
61-
"synth": 854,
62-
"synth_delay_ms": 860,
63-
"synth_flags": 856,
64-
"tempo": 224,
51+
"ratio": 228,
52+
"reset_osc": 880,
53+
"resonance": 232,
54+
"reverb_damping": 928,
55+
"reverb_level": 920,
56+
"reverb_liveness": 924,
57+
"reverb_xover_hz": 932,
58+
"sequence": 864,
59+
"status": 876,
60+
"synth": 850,
61+
"synth_delay_ms": 856,
62+
"synth_flags": 852,
63+
"tempo": 220,
6564
"time": 0,
66-
"to_synth": 862,
65+
"to_synth": 858,
6766
"velocity": 204,
68-
"voices": 276,
69-
"volume": 216,
67+
"voices": 272,
68+
"volume": 212,
7069
"wave": 6
7170
},
72-
"size": 940
71+
"size": 936
7372
};

tulip/amyboardweb/static/amy_parameters.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,6 @@ function set_knobs_from_patch_number(patch_number) {
422422
// if this is a memory patch, load it. if not, load the amyboard base patch
423423
if(patch_number >= 1024 && patch_number < 1024+32) {
424424
amy_add_log_message("i"+window.current_synth+"iv6K"+patch_number);
425-
return; // we can't set the knobs from memory patches yet.
426425
} else {
427426
amy_add_log_message("i"+window.current_synth+"iv6K257"); // The amyboardsynth base patch - 3 oscs, bp2 for filter.
428427
}

tulip/amyboardweb/static/spss.js

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,6 @@ var amy_module = null;
3131
var pendingPatchKnobIndex = null;
3232
var patchKnobSyncAttempts = 0;
3333
window.current_synth = 1;
34-
var knob_positions = {};
35-
3634

3735
// Once AMY module is loaded, register its functions and start AMY (not yet audio, you need to click for that)
3836
amyModule().then(async function(am) {
@@ -235,9 +233,6 @@ function get_events_for_patch_number(patch_number) {
235233
for (let i = 0; i < limit; i += 1) {
236234
const base = eventsPtr + i * layout.size;
237235
const status = view.getUint8(base + offsets.status);
238-
if (status === EVENT_EMPTY) {
239-
break;
240-
}
241236
events.push(readEvent(base));
242237
}
243238

@@ -399,46 +394,13 @@ function save_to_patch(patchNumber) {
399394
amy_add_log_message("K" + patchNumber + payload);
400395
}
401396
amy_add_log_message("i" + window.current_synth + "K" + patchNumber);
402-
// also save the positions of the knobs to a map, like knob_positions[patchNumber] = {knob_index: value, ...}
403-
if (Array.isArray(knobList)) {
404-
const patchState = {};
405-
knobList.forEach(function(knob, index) {
406-
if (!knob || knob.knob_type === "spacer" || knob.knob_type === "spacer-half") {
407-
return;
408-
}
409-
patchState[index] = Number(knob.default_value);
410-
});
411-
knob_positions[patchNumber] = patchState;
412-
}
413-
414397
}
415398

416399
function load_from_patch(patchNumber) {
417400
// Hook for loading a saved memory patch number.
418-
// This doesn't set the knobs yet because we don't have access to events from a memory patch number
419401
set_knobs_from_patch_number(patchNumber);
420-
// and here reload the positions of the knobs (set them) from the stored knob_posistions[patchNumber] if it is set
421-
restore_knobs_from_saved_knobs(patchNumber);
422402
}
423403

424-
function restore_knobs_from_saved_knobs(patchNumber) {
425-
const patchState = knob_positions[patchNumber];
426-
const knobList = window.get_current_knobs ? window.get_current_knobs() : [];
427-
if (!patchState || !Array.isArray(knobList)) {
428-
return;
429-
}
430-
Object.keys(patchState).forEach(function(key) {
431-
const index = Number(key);
432-
if (!Number.isInteger(index) || !knobList[index]) {
433-
return;
434-
}
435-
const value = patchState[key];
436-
if (!Number.isFinite(value)) {
437-
return;
438-
}
439-
set_knob_ui_value(knobList[index], value, false);
440-
});
441-
}
442404

443405
async function amy_external_midi_input_js_hook(bytes, len, sysex) {
444406
mp.midiInHook(bytes, len, sysex);

0 commit comments

Comments
 (0)