fix: Clear SoundFonts on SamplePool reset#254
Conversation
|
Hey thanks a lot for the fix! |
|
It wouldn't cause a crash, but it would result in SoundFonts failing to load on any subsequent projects unless LittleGPTracker is restarted. More concretely, loading the same project (containing one SoundFont) four times silently fails to load the SoundFonts the fourth time (and in any subsequently loaded projects): The project appears to load properly, but on playback the SoundFont samples are missing. This is because the array of loaded SoundFonts isn't cleared when a new project is loaded, which results in this branch never being executed when it is full: |
|
Hey I appreciate you putting time into this, I'm sorry but I haven't had the time to test it out yet. |
Description
This PR clears loaded SoundFonts on
SoundFontManager(thus alsoSamplePool) reset. This fixes a bug where loading SoundFont-containing projects successively results in unloaded SoundFonts once the maximum number of loaded SoundFonts (set to 3) is exhausted, e.g. loading a project containing one SoundFont four times in a row results in an unloaded SoundFont in the last instance. I've also added logs for SoundFont loads and allowed the aforementioned limit to be specified at compile-time (documented in the reference manual).Type of change
How Has This Been Tested?
The workflow described above involving projects with SoundFonts was checked with the proposed changes and resulted in loaded SoundFonts in all cases. The preprocessor directive was also tested with projects containing more than 3 SoundFonts.
Test Configuration:
Checklist:
sources/Application/Model/Project.h