I’m building a synthesizer audio plugin and the user is able import some audio files from the disk but I’m having a really hard time deciding on which is the best approach on saving the plugin’s state. To be more concrete it’s not clear how to save the imported audio files.
Here are some different solutions:
Case 1: Save audio clips full paths to host’s memory block
The main problem here is that I cannot have extra dependencies to the DAW session. Additionally, I should let the user locate the missing files (e.g when she deleted the audio files from the disk, or imported files from external disk). Also, in this case the DAW projects cannot be portable (e.g Ableton’s Live feature “Collect All and Save” won’t work correctly).
Case 2: Save imported audio data to host’s memory block
Is there any limitation concerning the size of the given memory block in “getStateInformation”? I read this post but the answer in not so clear.
What is more the save/load process might become heavy depending on the size of audio data and this certainly results to bad UX especially when auto-save is enabled in DAW or “Duplicate DAW track” is selected.
Case 3: Create temp files containing the imported audio data (as binary)
A reference to this file is saved in
getStateInformationand the plugin can restore its state by reading this file in
But when should I delete these files?
Obviously it’s not a good technique to fill user’s disk with unnecessary files. I could delete the temp file when new audio data are imported.
However when using the duplicate feature or the Save As… option from the DAW menu, the plugin instances will share the same temporary project files. If we overwrite any of these, we risk invalidating other instances that refer to them!
Has anyone faced a similar issue before? If yes, then which were the priorities to solve this? For example, what is more important from UX perspective? Is it more important to keep user’s disk clear from junk files or have a smooth save/load system?