Automation record in Audio Unit

Hi all,
I have a problem with Audio Unit and parameter automation.

As you can see in the attached screenshot, sometimes the parameter is not well recorded.

[attachment=0]Screen Shot 2013-04-05 at 5.16.44 PM.png[/attachment]

This happens mostly with toggle parameters or discrete parameters.

I am having same kind of problem with DP but it is working fine in Ableton Live.

Does anyone know what could be wrong?

Thanks in advance,

What are you doing in your AudioProcessor setParameter function? Anything that might block?

I have contacted someone at MOTU and he told me that it might be because I am not declaring the parameter in the right way.
The AudioUnitParameterUnit should be kAudioUnitParameterUnit_Boolean for ON/OFF parameter and kAudioUnitParameterUnit_Indexed for discrete parameter.
Indeed, in Juce wrapper they are all declared as kAudioUnitParameterUnit_Generic.

I will do some tests today to check if changing this solve the problem.