Hmm not sure how you would use libbela this way. libbela allows you to use the Bela audio backend by simply linking against it. This is normally needed when you have an existing large codebase (e.g.: Supercollider, Csound) and you want to implement an "audio backend" for it. Bela projects, those that you build through the Bela IDE, do not need libbela, as all the objects of libbelaare actually linked in (at least at the moment, though in the future they may use libbela, as it would make for faster linker time). If all you need is access some GPIOs from a bash script, that can be arranged without libbela.
This said, there already is one way of achieving what you want: in the IDE where you set the program at startup , you can select loop_*: this will run all the project whose name starts with loop_ ... in a loop. Then, you can press The Bela Button to stop the current program, so that the next one will automatically start. Note that the button can be remoted, if you are building an enclosure (see here).
While this works, there are two caveats:
- the project settings you set in the IDE will not be applied when running in loop_ (because of this)
- it takes some time (e.g.: 0.5 to 1 second) for the next program to start, and you may get clicks in the audio in between
A better solution would be to monitor a GPIO pin from within the render() function and switch between different modes of use while the program is still running. This gives instantaneous switchover but it slightly complicates your code base (actually, it helps you to rationalize it). You would probably have all the equivalents of the render() functions for each effect each in a separate cpp file, e.g.: as methods of a class. Then the main render.cpp file, which contains the actual render() callback called by the Bela backend, would call the callback for the effect that is currently active.
If that can help to reuse pre-existing effects, I have started working on an host for lv2 plugins, here. Please consider it's a work-in-progress, but it is doing what it says on the box.