From e68c45396bce7523f706df0b02a78cb08ac8d1cc Mon Sep 17 00:00:00 2001 From: Florian Jung Date: Sun, 9 Jan 2011 18:08:06 +0100 Subject: Loaded note-shared-objects are now unloaded --- TODO | 4 ++-- synth/main.cpp | 3 +++ synth/note_loader.cpp | 10 ++++++++++ synth/note_loader.h | 2 +- 4 files changed, 16 insertions(+), 3 deletions(-) diff --git a/TODO b/TODO index a934046..b277b66 100644 --- a/TODO +++ b/TODO @@ -1,5 +1,5 @@ TODO für den synth - o .so unloaden! + x .so unloaden! o beide parser: envelopes von oscs mit out=0 standardmäßig deaktivieren o envelope, filter, ggf. auch alles aus program.o im hauptprogramm lassen? d.h. via init funktionspointer übergeben oder virtuelle @@ -9,7 +9,7 @@ TODO für den synth o statt lfo-nummer direkten zugriff auf curr_lfo angeben? o bei tremolo (und vibrato?): eventuell nicht prüfen, obs aktiviert ist, sondern zur not einfach *1 rechnen? - o wenn sync global aus ist, kann auch osc.sync genullt werden + x wenn sync global aus ist, kann auch osc.sync genullt werden o beim default_program vielleicht auch ein optimiertes objekt benutzen? o programme on-the-fly (um)laden diff --git a/synth/main.cpp b/synth/main.cpp index 646e371..25287eb 100644 --- a/synth/main.cpp +++ b/synth/main.cpp @@ -186,6 +186,9 @@ void cleanup() channel[i]=NULL; } + for (int i=0;i<128;i++) + maybe_unload_note(program_settings[i]); + delete [] program_settings; } diff --git a/synth/note_loader.cpp b/synth/note_loader.cpp index b7ccc99..28613b9 100644 --- a/synth/note_loader.cpp +++ b/synth/note_loader.cpp @@ -42,3 +42,13 @@ void load_note_from_so(string file, program_t &prog) throw err; } } + +void maybe_unload_note(program_t &prog) +{ + if (prog.dl_handle) + { + dlclose(prog.dl_handle); + prog.dl_handle=NULL; + prog.create_func=NULL; + } +} diff --git a/synth/note_loader.h b/synth/note_loader.h index a922f3c..6731da1 100644 --- a/synth/note_loader.h +++ b/synth/note_loader.h @@ -9,5 +9,5 @@ using namespace std; void load_note_from_so(string file, program_t &prog); //throws string - +void maybe_unload_note(program_t &prog); #endif -- cgit v1.2.1