Moves the controller, bridge and led-driver default ESP-NOW channel to 11 and updates the led-driver and led-tool submodule pointers. Includes the rest of the working tree: web UI, desktop and sim-controller changes, API and bridge code, graphify output, and the .gitea and fixture-driver folders. Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
73 lines
4.2 KiB
C
73 lines
4.2 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);
|
|
|
|
// Whether the input device is "simulated": the beat comes from the clock at audio_simulated_bpm, and
|
|
// only then. Call with the store locked.
|
|
bool seqplay_sim_selected(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. A one-shot (loop off) belongs to seqplay_fire instead.
|
|
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 (a one-shot) over whatever runs in the zone (zone_id NULL or "": the
|
|
// playing sequence's zone). wait: "now" (default), "beat" or "downbeat". The looping sequence underneath
|
|
// keeps time and skips the drivers the one-shot lights; when it ends they go back to that sequence's
|
|
// current step, or the zone's last preset. A new one-shot 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);
|
|
// A looping preset was picked in zone_id: the looping sequence playing there (or queued for it) ends,
|
|
// without clearing the drivers. A one-shot playing over the zone carries on, and comes back to the preset.
|
|
void seqplay_end_base_in(const char *zone_id);
|
|
// Whether sequence seq_id is a one-shot: its `loop` is off (older records: kind "animation")
|
|
bool seqplay_is_oneshot(const char *seq_id);
|
|
// Preview sequence seq_id on the simulated drivers only (devices with "sim": true), alongside whatever plays
|
|
// live: same beats, but the live sequence and one-shot skip the simulated drivers while it plays. It loops unless
|
|
// the sequence is a one-shot; one-shot steps inside it are skipped. A new preview replaces the one playing.
|
|
// zone_id NULL or "": the live sequence's zone. Errors as seqplay_start. Call with the store locked.
|
|
esp_err_t seqplay_preview(const char *seq_id, const char *zone_id, const char *profile_id, const char **msg);
|
|
// End the preview: the simulated drivers go back to what plays live
|
|
void seqplay_preview_stop(void);
|
|
// End the one-shot 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, or previewing (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);
|