feat: device groups, combined brightness and beat-driven sequences from main
Groups (registry of driver MACs, optionally scoped to a profile) become
the drivers' group membership, alongside z<zone id> for zones that still
name drivers. Zones play to their group_ids. Group and device routes for
driver config, brightness (global x groups x device x zone) and identify.
The push path takes main's message shape: select as a list, groups as a
filter (one GROUP_CMD per group, or JSON when a preset has a background),
short keys so JSON fits a frame.
Sequences follow main: lanes of {preset_id, beats} steps played to each
lane's groups, advanced by the mic's beats or a clock at
audio_simulated_bpm; a switch waits for the next beat or downbeat; sync-
phase, stop (clears the zone's drivers) and status. This replaces the
time-based per-zone sequencer and scene playback, as in main.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
19fea0b0a1
commit
04b56c6ef2
12 files changed
+1922
-579
No files matched your search
@@ -0,0 +1,39 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdbool.h>
|
||||
#include "cJSON.h"
|
||||
#include "esp_err.h"
|
||||
|
||||
// Sequence playback, as main's util/sequence_playback.py: one sequence plays at a time in a zone.
|
||||
// Each lane is a list of {preset_id, beats} steps sent to the lane's groups; a step lasts its number
|
||||
// of beats. Beats come from the mic's beat detector while audio timing is on and the tempo is locked,
|
||||
// otherwise from a clock at settings.audio_simulated_bpm (default 120).
|
||||
|
||||
// Start the beat task (after beat_start)
|
||||
esp_err_t seqplay_init(void);
|
||||
|
||||
// Start sequence seq_id in zone_id. While another sequence plays, the switch waits for the next beat
|
||||
// (or downbeat, settings.sequence_switch_wait) and *queued is set. ESP_ERR_NOT_FOUND: no such sequence
|
||||
// in the profile; ESP_ERR_INVALID_ARG: no zone (msg says which); ESP_ERR_INVALID_SIZE: no steps.
|
||||
// Call with the store locked.
|
||||
esp_err_t seqplay_start(const char *seq_id, const char *zone_id, const char *profile_id, const char **msg);
|
||||
|
||||
// Stop; with clear, the zone's drivers drop their presets
|
||||
void seqplay_stop(bool clear);
|
||||
// Stop when seq_id is the one playing (it was edited or deleted)
|
||||
void seqplay_stop_if(const char *seq_id);
|
||||
|
||||
// Align beat counters: "step" restarts the current step's beat count, "pass" restarts the sequence.
|
||||
// False when nothing plays.
|
||||
bool seqplay_sync(const char *mode);
|
||||
|
||||
// Playback snapshot (main's playback_status) and the queued start (pending_play_status); caller owns them
|
||||
cJSON *seqplay_status(void);
|
||||
cJSON *seqplay_pending(void);
|
||||
|
||||
// "6/6" from the last sequence that ran to its end ("" otherwise)
|
||||
const char *seqplay_done_readout(void);
|
||||
|
||||
// Use the mic's beats for timing (main's audio start/stop); off falls back to the clock
|
||||
void seqplay_set_audio(bool on);
|
||||
bool seqplay_audio(void);
|
||||
Reference in new issue
Block a user