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
@@ -13,7 +13,11 @@ float MeasureTextScaled(const char* text, float baseSize);
void GenerateColormapTexture(void);
// --- Spectrogram texture ---
// GenerateSpectrogramTexture recomputes the synchrosqueezed reassignment (use
// when the STFT changes). ColorizeSpectrogram only re-maps the cached
// reassignment to colors (use for dB-floor / colormap changes).
void GenerateSpectrogramTexture(StftResult* stft, Image* image, Texture2D* texture);
void ColorizeSpectrogram(Image* image, Texture2D* texture);
// --- On-screen drawing (operate on the global app state) ---
void DrawSpectrogramGrid(Rectangle bounds, int numCellsX, int numCellsY, Color color);