feat: sequence window, finer timeline, zone brightness to Wi-Fi drivers

- A sequence's length is a fixed window (window_beats / window_seconds), not its presets.
  The timeline is exactly the window long; clips past it are cut on save.
- The ruler adds finer ticks when zoomed in; Snap has Auto (follows the zoom), 0.25 s and 0.05 s.
  Steps and the window go down to 50 ms.
- Ctrl+wheel zooms around the pointer; the zoom buttons zoom around the last pointer position.
- Sequence start and the zone brightness slider reach Wi-Fi drivers (matched by hostname or MAC).
- A preset select with brightness also sends the brightness to Wi-Fi drivers, as ESP-NOW does.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
This commit is contained in:
jimmyandClaude Haiku 5.5 committed 2026-11-16 21:22:17 +13:00
1 parent 581b751904
commit a1c8ce853b
21 files changed
+419 -318

No files matched your search

+32 -11
View File
@@ -568,7 +568,7 @@ static int load_lanes(player_t *p, const cJSON *seq)
double beats = num(s, "beats", 1);
beats = beats < 0.25 ? 1 : beats;
double secs = num(s, "seconds", 3);
secs = secs < 0.1 ? 0.1 : (secs > 3600 ? 3600 : secs);
secs = secs < 0.05 ? 0.05 : (secs > 3600 ? 3600 : secs);
if (st->anim && str_is(s, "length", "animation")) {
seqplay_length(st->id, &beats, &secs);
}
@@ -617,6 +617,21 @@ static void clear_drivers(const char *zone)
}
}
// One driver's combined brightness, sent as a v1 brightness message (ESP-NOW by MAC, Wi-Fi by hostname)
static void zone_brightness_push(const char *id, int zone_b)
{
cJSON *m = cJSON_CreateObject();
cJSON_AddStringToObject(m, "v", "1");
cJSON_AddNumberToObject(m, "b", api_effective_brightness(id, zone_b));
cJSON_AddTrueToObject(m, "save");
cJSON *messages = cJSON_CreateArray(), *targets = cJSON_CreateArray();
cJSON_AddItemToArray(messages, m);
cJSON_AddItemToArray(targets, cJSON_CreateString(id));
engine_push(messages, targets);
cJSON_Delete(messages);
cJSON_Delete(targets);
}
// Every driver the zone reaches gets its combined brightness with the zone's slider value
static void zone_brightness(const char *zone_id)
{
@@ -635,16 +650,13 @@ static void zone_brightness(const char *zone_id)
}
}
for (int i = 0; i < macs.n; i++) {
cJSON *m = cJSON_CreateObject();
cJSON_AddStringToObject(m, "v", "1");
cJSON_AddNumberToObject(m, "b", api_effective_brightness(macs.m[i], zone_b));
cJSON_AddTrueToObject(m, "save");
cJSON *messages = cJSON_CreateArray(), *targets = cJSON_CreateArray();
cJSON_AddItemToArray(messages, m);
cJSON_AddItemToArray(targets, cJSON_CreateString(macs.m[i]));
engine_push(messages, targets);
cJSON_Delete(messages);
cJSON_Delete(targets);
zone_brightness_push(macs.m[i], zone_b);
}
// Wi-Fi drivers are listed by hostname, so they are not among the MACs above
char w[MACS_MAX][GROUP_ID_MAX];
int nw = engine_zone_wifi_ids(zone_id, w, MACS_MAX);
for (int i = 0; i < nw; i++) {
zone_brightness_push(w[i], zone_b);
}
}
@@ -1246,6 +1258,15 @@ bool seqplay_sync(const char *mode)
void seqplay_length(const char *seq_id, double *beats, double *secs)
{
const cJSON *seq = cJSON_GetObjectItem(store_coll("sequence"), seq_id);
// The window is the sequence's length, whatever its presets run for (the editor pads every lane to it).
// Records saved before windows fall through to the lanes.
const cJSON *wb = cJSON_GetObjectItem(seq, "window_beats");
const cJSON *ws = cJSON_GetObjectItem(seq, "window_seconds");
if (cJSON_IsNumber(wb) && cJSON_IsNumber(ws) && wb->valuedouble > 0 && ws->valuedouble > 0) {
*beats = wb->valuedouble;
*secs = ws->valuedouble;
return;
}
const cJSON *opts = cJSON_GetObjectItem(seq, "lane_opts");
bool seq_timed = seq_oneshot(seq) || str_is(seq, "advance_mode", "time");
double b = 0, s = 0;