Send Midi CC directly or via ProcessBlock?

{
    buffer.clear();
    midiMessages.clear();
    MidiBuffer generatedMidi;
    int time;
    MidiMessage m;
    int8 ccTempVal;
    int8 myVal = (int8)CC00Val;

    if (myVal != ccTempVal)
    {
        m = MidiMessage::controllerEvent(2, 1, myVal);
        generatedMidi.addEvent(m, midiMessages.getLastEventTime());
    }
    else generatedMidi.clear();

    ccTempVal = myVal;
    midiMessages.swapWith (generatedMidi);
    
    
}

This is what I saw in another post and they recommended this:

So I can keep the code but move the ccTempVal out.
Is it maybe wise then, since I need to check 30-40 variables that I make an array and then put the checking loop and the sending in the processBlock?