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>
57 lines
3.0 KiB
C
57 lines
3.0 KiB
C
#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, and
|
|
// one animation (a sequence played once) can play over it. Each lane is a list of steps sent to the
|
|
// lane's targets; a step lasts its beats (beat lanes, counted in quarter beats) or seconds (time lanes). 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);
|
|
|
|
// Play sequence seq_id once as an animation over whatever runs in the zone (zone_id NULL or "": the
|
|
// playing sequence's zone). wait: "now" (default), "beat" or "downbeat". The sequence underneath keeps
|
|
// time and skips the drivers the animation lights; when it ends they go back to the sequence's current
|
|
// step, or the zone's last preset. A new animation replaces the one playing. Call with the store locked.
|
|
esp_err_t seqplay_fire(const char *seq_id, const char *zone_id, const char *profile_id, const char *wait,
|
|
const char **msg);
|
|
// End the animation now and restore its drivers
|
|
void seqplay_overlay_stop(void);
|
|
// How long sequence seq_id plays once: *beats and *secs (each converted from the other at the current
|
|
// tempo); unchanged when it has no steps. Call with the store locked.
|
|
void seqplay_length(const char *seq_id, double *beats, double *secs);
|
|
|
|
// Stop the sequence and any animation; 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);
|
|
|
|
// The start-switch wait in effect: "downbeat" (saved, and the mic is timing) or "beat"
|
|
const char *seqplay_switch_wait(void);
|
|
// The clock's bar position (1..4) and how many beats it has ticked
|
|
void seqplay_clock(int *bar_beat, uint32_t *tick);
|