The backend's Command::Reset (full teardown: rebuilds Project, audio/buffer pools, ID counters) was never invoked from the UI. New File and project loads only cleared app-side maps, so the previous file's tracks and loaded instruments stayed resident in the backend and kept getting mixed on every audio callback. Add a reset_audio_backend() helper (controller.reset() + clear app-side track maps and backend-derived caches) and call it in the three teardown paths: NewFile, create_new_project_with_focus, and apply_loaded_project. Also drops a duplicate layer_to_track_map.clear() in the NewFile handler. Race-free: the audio thread drains all command_tx commands before any query_tx queries each callback, so Reset (a command) runs before the track/pool rebuild (queries), even though they travel on separate channels. |
||
|---|---|---|
| .. | ||
| assets | ||
| examples | ||
| src | ||
| Cargo.toml | ||
| PLAN.md | ||
| TOOL_IMPLEMENTATION_PLAN.md | ||
| build.rs | ||