On Building a Simple VST3 Host

This is my first post to the Steinberg forum - so apologies for possibly rehashing old ground, or missing the correct forum.

I am developing a simple VST3 host using the VST3SDK. I am loading the VST3 Halion Sonic SE3 plugin which came as part of a Dorico Pro installation. I have had some success generating audio. However I have the following persistent issues, and could use some guidance.

  1. How does the host programmatically generate a program change? I tried using LegacyMIDICCOutEvent using kCtrlProgramChange for the controller, and have tried input parameter changes, using a ParamID given by midiMapping->getMidiControllerAssignment(…, ControllerNumbers::kCtrlProgramChange, …). But these approaches are not working for me.

  2. For instruments with kewswitches, such as “Violins 1 A Combi”, when I compute process blocks, I note that:
    a) For the first process block, all input NoteOn events are effectively ignored.
    b) On the second process block, new NoteOn events are accepted, but the first keyswitch seems to be activated - in the case above, “Trills WT”.
    c) On subsequent process blocks, that prior kewswitch is set off, new NoteOn events are accepted, and sounds seem to play normally. Also, channel volume seems to work fine, using input param changes.
    I don’t seem to have issues with instruments without keyswitches.

Any thoughts/suggestions?

Does anyone have a reference point to relevant documentation (outside of that in the sdk) or host (code) examples?

this is a user forum, for development stuff, please go to https://sdk.steinberg.net

Thanks you.