summaryrefslogtreecommitdiff
path: root/src/audio/tracker.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/audio/tracker.cc')
-rw-r--r--src/audio/tracker.cc10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/audio/tracker.cc b/src/audio/tracker.cc
index 95b8022..a511a62 100644
--- a/src/audio/tracker.cc
+++ b/src/audio/tracker.cc
@@ -255,9 +255,17 @@ static int get_free_pool_slot() {
}
// If all slots are active, reuse the oldest one (round-robin)
- // This automatically handles cleanup of old patterns
+ // Clean up the old slot before reuse
const int slot = g_next_pool_slot;
g_next_pool_slot = (g_next_pool_slot + 1) % MAX_SPECTROGRAMS;
+
+ if (g_spec_pool[slot].synth_id >= 0) {
+ synth_unregister_spectrogram(g_spec_pool[slot].synth_id);
+ }
+ delete[] g_spec_pool[slot].data;
+ g_spec_pool[slot].data = nullptr;
+ g_spec_pool[slot].synth_id = -1;
+ g_spec_pool[slot].active = false;
return slot;
}