fix float numbers sent to psto not being handled properly by tc.preset

This commit is contained in:
2025-09-10 20:10:56 +02:00
parent a3f5769a6a
commit cc3bf58117

View File

@@ -782,19 +782,20 @@ function text() {
function recall() { function recall() {
var args = arrayfromargs(arguments); var args = arrayfromargs(arguments);
var val, src_slot, trg_slot, interp;
if (args.length == 1) { if (args.length == 1) {
previous_active_slot = active_slot; val = Math.abs(args[0]);
is_interpolating = 0; src_slot = Math.floor(val);
set_active_slot(args[0]); interp = val % 1;
outlet(0, 'recall', args[0]); trg_slot = interp == 0 ? src_slot : src_slot + 1;
} else if (args.length == 3) { } else if (args.length == 3) {
var src_slot = args[0]; src_slot = Math.abs(args[0]);
var trg_slot = args[1]; trg_slot = Math.abs(args[1]);
interp = Math.min( 1, Math.max(0, args[2]));
}
for (var i = 0; i < filled_slots.length; i++) { for (var i = 0; i < filled_slots.length; i++) {
slots[filled_slots[i]].interp = -1; slots[filled_slots[i]].interp = -1;
} }
if (slots[src_slot].name != null && slots[trg_slot].name != null) { if (slots[src_slot].name != null && slots[trg_slot].name != null) {
if (ignore_slot_zero == 1 && src_slot == 0) { if (ignore_slot_zero == 1 && src_slot == 0) {
@@ -807,15 +808,14 @@ function recall() {
src_slot = active_slot; src_slot = active_slot;
} }
} }
var interp = Math.min( 1, Math.max(0, args[2]));
if (interp == 0.0) { if (interp == 0.0) {
slots[src_slot].interp = -1; slots[src_slot].interp = -1;
slots[trg_slot].interp = -1; slots[trg_slot].interp = -1;
is_interpolating = 0; is_interpolating = 0;
if (previous_target != active_slot) { if (previous_target != active_slot) {
previous_active_slot = active_slot; previous_active_slot = active_slot;
} else if (args[0] != 0) { } else if (src_slot != 0) {
previous_active_slot = args[0]; previous_active_slot = src_slot;
} else { } else {
previous_active_slot = previous_target; previous_active_slot = previous_target;
} }
@@ -837,7 +837,6 @@ function recall() {
outlet(0, "recall", src_slot, trg_slot, interp); outlet(0, "recall", src_slot, trg_slot, interp);
} }
}
mgraphics.redraw(); mgraphics.redraw();
} }