Auto VJ: selectable family pool (smart / all / custom checklist)

Three modes for where the director draws presets from: 'smart' keeps the
curated per-mood pools, 'all' removes the family restriction, 'custom'
limits picks to a user checklist (mood still shapes the speed variant,
with a fallback when the checklist exhausts it). Config persists in
localStorage and is re-pushed live while the director runs.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
lucianoandClaude Fable 5 committed 2026-07-17 15:37:25 +02:00
1 parent 46afd5d318
commit 48ac3dfa85
4 files changed
+60 -4

No files matched your search

+14 -3
View File
@@ -306,6 +306,8 @@ djv.onControl(async (m) => {
break;
case 'autoVj':
autoVj = !!m.on;
if (m.mode) avMode = m.mode;
avFamilies = Array.isArray(m.families) ? m.families : avFamilies;
if (autoVj) { avLastSwitch = 0; avBeatMark = audio.beatCount || 0; }
djv.report({ type: 'autoVj', on: autoVj });
break;
@@ -480,10 +482,19 @@ const AV_POOLS = {
peak: ['Julia', 'Iperspazio', 'Tunnel', 'Moiré', 'Fluido Anello', 'Fluido Fuoco',
'Vortice', 'Griglia Neon', 'Cristalli']
};
let avMode = 'smart', avFamilies = []; // 'smart' | 'all' | 'custom'
function avPick(mood) {
const fams = AV_POOLS[mood] || AV_POOLS.groove;
const cands = window.EFFECTS.list.filter(e => fams.indexOf(e.familyName) >= 0 &&
(mood === 'peak' ? e.speed >= 1.0 : e.speed <= 1.4) && avRecent.indexOf(e.name) < 0);
// Family pool: smart = curated per-mood lists; custom = the user's checklist
// (mood still shapes the speed variant); all = no family restriction.
let fams = null;
if (avMode === 'smart') fams = AV_POOLS[mood] || AV_POOLS.groove;
else if (avMode === 'custom' && avFamilies.length) fams = avFamilies;
const speedOk = (e) => (mood === 'peak' ? e.speed >= 1.0 : e.speed <= 1.4);
let cands = window.EFFECTS.list.filter(e => (!fams || fams.indexOf(e.familyName) >= 0) &&
speedOk(e) && avRecent.indexOf(e.name) < 0);
// A tight custom list can exhaust the speed filter: retry without it.
if (!cands.length) cands = window.EFFECTS.list.filter(e =>
(!fams || fams.indexOf(e.familyName) >= 0) && avRecent.indexOf(e.name) < 0);
const e = cands.length ? cands[Math.floor(Math.random() * cands.length)] : window.EFFECTS.list[0];
avRecent = [e.name].concat(avRecent).slice(0, 6); // don't repeat the last few
return e;