feat: sequences v2, bridges, and sim-controller
Rework sequences (engine, seqplay, envelope, API, web UI), add bridge support, add the host sim-controller and rig simulation tests, and update docs, presets and project tooling config. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
d664026ee5
commit
2543673bd8
68 files changed
+5761
-460
No files matched your search
+21
-1
@@ -7,6 +7,7 @@ void env_blob_init(env_blob_t *b)
|
||||
{
|
||||
b->data[0] = 0;
|
||||
b->len = 1;
|
||||
b->v3 = false;
|
||||
}
|
||||
|
||||
static bool put(env_blob_t *b, const void *src, size_t n)
|
||||
@@ -112,6 +113,15 @@ bool env_add_preset(env_blob_t *b, const char *name, const cJSON *p)
|
||||
if (nl > 250 || pl > 250 || ncol > 255) {
|
||||
return false;
|
||||
}
|
||||
const cJSON *fade = get2(p, "f", "fade"), *tb = get2(p, "tb", "beat_time");
|
||||
int fade_ms = clamp(num_or(fade, 0), 0, 10000);
|
||||
bool beat = truthy(tb);
|
||||
bool ext = fade_ms > 0 || beat;
|
||||
if (b->data[0] == 0) {
|
||||
b->v3 = ext;
|
||||
} else if (b->v3 != ext) {
|
||||
return false;
|
||||
}
|
||||
|
||||
uint8_t rgbs[255][3];
|
||||
int nvalid = 0;
|
||||
@@ -136,6 +146,16 @@ bool env_add_preset(env_blob_t *b, const char *name, const cJSON *p)
|
||||
char key[4] = { 'n', '0' + i, 0 };
|
||||
ok = put_le16(b, (uint16_t)(int16_t)clamp(num_or(cJSON_GetObjectItem(p, key), 0), -32768, 32767));
|
||||
}
|
||||
if (ok && b->v3) {
|
||||
uint8_t ext_len = (fade_ms ? 4 : 0) + (beat ? 3 : 0);
|
||||
ok = put_u8(b, ext_len);
|
||||
if (ok && fade_ms) {
|
||||
ok = put_u8(b, ENV_EXT_FADE) && put_u8(b, 2) && put_le16(b, fade_ms);
|
||||
}
|
||||
if (ok && beat) {
|
||||
ok = put_u8(b, ENV_EXT_BEAT) && put_u8(b, 1) && put_u8(b, 1);
|
||||
}
|
||||
}
|
||||
if (!ok) {
|
||||
b->len = save_len;
|
||||
b->data[0] = save_count;
|
||||
@@ -172,7 +192,7 @@ size_t env_frame(uint8_t *out, int brightness, const env_blob_t *presets, const
|
||||
if (brightness >= 0) {
|
||||
wire = brightness > 255 ? 127 : (brightness * 127 + 127) / 255; // 0-127 scales to 0-255
|
||||
}
|
||||
out[0] = 2;
|
||||
out[0] = lp && presets->v3 ? 3 : 2;
|
||||
out[1] = wire;
|
||||
out[2] = lp;
|
||||
out[3] = ls;
|
||||
|
||||
Reference in new issue
Block a user