feat: main's import/export, zones, audio API and web UI
Profiles, presets and sequences export and import as main's bundles. Zones carry group_ids, preset_group_ids, sequence_ids, content_kind and brightness; profiles seed rainbow as colour_cycle, and deleting a profile also deletes its sequences. Groups, zones and sequences written by older versions are migrated at boot. /api/audio (status, event stream, start/stop, reset, anchor-bar, devices) maps main's audio detector onto the mic's beat detector. Audio start/stop picks whether mic beats or the BPM clock time sequences; the clock's beats also go to the drivers while the mic is off. /ws now greets from a post-handshake callback (httpd does not call the handler for the upgrade). The web UI is main's, plus v2's outputs editor, list search and hostname/static IP settings; the bridge, Wi-Fi AP and led-tool parts are gone. API tests follow main's behaviour (119 pass on the board). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
04b56c6ef2
commit
bfeeb958df
44 files changed
+8709
-2338
No files matched your search
+24
@@ -105,9 +105,13 @@ static void dsp_event(void *ctx, int events, const beat_dsp_t *d)
|
||||
}
|
||||
}
|
||||
|
||||
static float s_rate;
|
||||
static bool s_reset;
|
||||
|
||||
esp_err_t beat_start(float sample_rate)
|
||||
{
|
||||
float gate_rms = powf(10.0f, CONFIG_BEAT_GATE_DBFS / 20.0f);
|
||||
s_rate = sample_rate;
|
||||
beat_dsp_init(&s_dsp, sample_rate, gate_rms, CONFIG_BEAT_LEAD_MS / 1000.0f);
|
||||
s_info.meter = s_dsp.meter;
|
||||
s_subs_mutex = xSemaphoreCreateMutex();
|
||||
@@ -128,6 +132,13 @@ esp_err_t beat_start(float sample_rate)
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
void beat_reset(void)
|
||||
{
|
||||
portENTER_CRITICAL(&s_lock);
|
||||
s_reset = true;
|
||||
portEXIT_CRITICAL(&s_lock);
|
||||
}
|
||||
|
||||
void beat_tap(void)
|
||||
{
|
||||
portENTER_CRITICAL(&s_lock);
|
||||
@@ -137,6 +148,19 @@ void beat_tap(void)
|
||||
|
||||
void beat_feed(const float *x, size_t n)
|
||||
{
|
||||
portENTER_CRITICAL(&s_lock);
|
||||
bool reset = s_reset;
|
||||
s_reset = false;
|
||||
portEXIT_CRITICAL(&s_lock);
|
||||
if (reset) { // start tempo and bar tracking over, in the detector's task
|
||||
beat_dsp_init(&s_dsp, s_rate, powf(10.0f, CONFIG_BEAT_GATE_DBFS / 20.0f), CONFIG_BEAT_LEAD_MS / 1000.0f);
|
||||
portENTER_CRITICAL(&s_lock);
|
||||
s_info.bar_beat = 0;
|
||||
s_info.bar_sure = false;
|
||||
s_info.meter = s_dsp.meter;
|
||||
portEXIT_CRITICAL(&s_lock);
|
||||
ESP_LOGI(TAG, "Tracking reset");
|
||||
}
|
||||
beat_dsp_feed(&s_dsp, x, n, dsp_event, NULL);
|
||||
|
||||
// Taps arrive from the HTTP task; apply them here, in the detector's task
|
||||
|
||||
Reference in new issue
Block a user