I would rather use a Lock Free queue rather than using any lock.
At least I think this is safer to put the lock inside the process loop.
Something like this:
void AutomationNotifier::process()
{
for (int i = 0; i < this->numberOfMessages; i++)
{
this->audioProcessor->getCallbackLock().enter();
MidiMessage message = this->midiMessageQueue[i];
audioProcessor->postMessage(new ParameterChangedMessage(message));
this->audioProcessor->getCallbackLock().exit();
}
this->numberOfMessages = 0;
}