perf+ux: cache reassignment, keep manual dB floor, dedupe load paths

- Split GenerateSpectrogramTexture into ComputeSpectrogramReassignment
  (the expensive synchrosqueezing, cached in app.reassignBuffer) and
  ColorizeSpectrogram (cheap). dB-floor and colormap changes now only
  re-colorize instead of recomputing the whole reassignment every frame —
  the dB slider and colormap switching are smooth on large files.
- AutoScaleAmplitude no longer overwrites a dB floor the user set by hand
  (amplitudeUserSet flag, reset per file load).
- Extract ResetForNewSignal() used by all three load paths; removes the
  duplicated reset blocks and the double ComputeSTFTInit per load. Drag-drop
  now resets the selection like the browser already did.
- Remove the dead lastInteractedFrame field.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-05-25 01:26:51 -07:00
parent 3a8f20b783
commit ddbbe2734c
6 changed files with 94 additions and 70 deletions
+4
View File
@@ -371,6 +371,10 @@ int ComputeSkipFactor(float signalDurationSec)
// ===== Amplitude auto-scaling =====
void AutoScaleAmplitude(StftResult* stft)
{
// Don't clobber a dB floor the user has set by hand. Reset on new file load
// re-enables auto-scaling (see ResetForNewSignal).
if (app.amplitudeUserSet) return;
float maxDb = -999.0f;
float minDb = 0.0f;
for (int seg = 0; seg < stft->numSegments; seg++) {