I'm trying to make a "patchmanager" that listens to four midi notes (64->67) and switches between four independent patches when a new key from these four is pressed. This is done by closing the previously called patch using |; pd-nameofpatch menuclose 1( messages, and then I open the new patch using a |; pd open nameothenewpatch.pd thepath( message.
The proof of concept (see joined files) works well when I don't use the midi input, but the testing hradio. I can switch tens of times with the mouse flawless, but when I use my midicontroller I get frequent segmentation faults on switching ! I mean, not with the dummy files I put in this examples, but bigger patches (but not so big either).
I tried opening the new patch first and then closing the old one, with or without "security" delay (see patch) too, and I couldn't find a way get it work flawlessly. But I must say that the bigger the "security delay" the better the stability, but this is never enough.
Has anyone an idea of how this problem could be worked around ? I simply don't want to load all patches at a time because of evident hardware constraints.