So I have some functions that read/write files, and parse JSON using a library that might throw exceptions.
void loadSynth(std::string filename, Track& track);
void saveSynth(std::string filename, Track& track);
Now, I'd like to call them from render()
and I think I can do this using auxiliary tasks. However, none of the examples using auxtasks use arguments. Also, as auxtasks might not run if they are already running, how would I make sure that successive calls (with different arguments) will all run eventually?
I guess I could push a struct/class containing filename
and track
into the pipe from render()
, and then schedule an auxtask which reads the pipe and calls loadSynth()
? Is there a better way to do this?