Browsing developer’s help I don’t see any command which could purge/unload certain samples (zones) out of RAM to free it. Is there anything like this? Maybe it’s called somehow specifically
I don’t think this is possible. But I’m not 100% sure.
Unless you remove the zones or layers from the program and load them again when needed.
Usually Halion presets don’t use too much RAM.
Eagle for instance uses about 7 GB on disk and only about 150 MB of memory when loaded.
Something to watch out for though is StartRange for the sample zones. It loads everything to the left of the slider into memory. Doing this on a large amount of samples is not a good choice.
If this is causing problems, you will have to script it so they return to zero when those layers are not selected for playback.
PreloadedBytes can be seen in paramList at zone => SampleOsc or Layer / Program param list.
My instrument is about 40Gb with samples captured by several mics and 900Mb is loaded into RAM. So I want to give user an option to purge samples of a certain mic to save memory. So far I found undocumented layer parameters called PreloadLevel (equals 0 by default) and DesiredPreloadLevel (equals 32 by default). They are controllable, but can’t get how they work. A hint would be appreciated.
So far I was able to get controllable load/unload of certain layers like this:
defineParameter("purge_src_1_button", nil, 1, 0, 1, 1,function() purge_src_1_button_changed() end) function purge_src_1_button_changed() for i = 1, #groups_for_src_1_array do layers[groups_for_src_1_array[i]]:setParameter("DesiredPreloadLevel",purge_src_1_button*32) end end
where groups_for_src_1_array is a predefined array with layers’ numbers to load/unload
However it seems that the idea is not working when opening the program, i.e. purge_src_1_button state is not relayed to a function purge_src_1_button_changed.
To fix it I’ve tried to add:
function onInit() purge_src_1_button_changed() end
so that the load/unload would happen on initialization according to purge_src_1_button state, but I got an error: “onInit: attempt to yield from outside a coroutine”. Any suggestion what could be wrong?
If you do it like this?
defineParameter("purge_src_1_button", nil, 1, 0, 1, 1,function() purge_src_1_button_changed() end) function purge_src_1_button_changed() for i = 1, #groups_for_src_1_array do layers[groups_for_src_1_array[i]]:setParameter("DesiredPreloadLevel",purge_src_1_button*32) end end purge_src_1_button_changed()
onInit is a processor callback. Parameter callbacks are executed in controller thread. This could be the error message.
You could also try