I've just finished creating a midi router in Max to replace what I used to do with Apple MainStage. I can load individual patchers (each of which represents a single song) and everything works just fine, i.e, program changes get sent to my hardware, the appropriate keyboard layers get set up and so forth.
Initialization is done by each patcher responding to a loadbang when I open it.
Now that I have separate patchers for each song, I want to be able to use an incoming MIDI program change to open the appropriate patch. The pcontrol seems to be the right approach.
However, I have run into several issues.
By using a gate indexed by the incoming program change and I am able to automatically close the previously opened patcher and open the new patcher as defined by the program change value. However, the loadbang message in the patcher that is opened is not being triggered, as a result of which the newly loaded patcher doesn't get initialized.
Any idea how to fix this?