getStateInformation & parameters as binary data?



The Juce Demo plugin use xml stuff for storing/retreiving parameters,but I’m trying to storing/retreive parameters as 32b floats straight in the binary data from getStateInformation().

I need this because I plan to update one of my old plugin with a Juce version, and want to keep recall of the parameters…

What’s the best way for doing so ?

I see that AU lab store the setting of my old plugins as hexadecimal representation of float. In a manner that 1.0 is represented by 3F800000.

As far juce, I understand that the xml stuff convert the float value to a string, that is variable size because of UTF-8, then write an hex representation of the string ?

So I’ve tried to write a float value of my parameter (gain) straight into the binary memory :

destData.copyFrom (&gain, 0, 4);

Now it allow me to get a fixed size + hexadecimal representation of my float, BUT it’s stored in little-endian way so that 1.0 make 0000803F.

At this point I’m guessing, should I just start trying to swap the byte order (but swapByteOrder is for int only, not float ?), or am I going totally in a wrong direction ?

Any helping advice would be very appreciated.