Parse cubase xml track (state of plugin)

Hi, I was parsing xml cubase track exported because I want to do in multiple tracks almost the same actions throw script, but I see the state of plugins is saved in hexadecimals, there’s a way to read it getting values of parameters or maybe converting it in base64 readible in juce setStateInformation?

Thank you in advance

You can always decode xml from binary data. But if you want to make it human-readible:

xml->writeTo(juce::File("file.xml"));

which writes a XmlElement to the file as UTF-8.

1 Like

I’m trying to decode this in this way:

[...]    
if (XmlElement* insertsChild = itemElement->getChildByAttribute("name", "Slot"))
{
     for (XmlElement* itemElement : insertsChild->getChildWithTagNameIterator("item"))
     {
         for (XmlElement* itemChildAttribute : itemElement->getChildWithTagNameIterator("member"))
         {
             for (XmlElement* binaryElement : itemChildAttribute->getChildWithTagNameIterator("bin"))
             {
                  if (hasAttributeAndValue(binaryElement, "name", "audioComponent"))
                  {
                      for (int i = 0; i < binaryElement->getNumAttributes(); i++)
                      {
                           String binaryText = binaryElement->getAllSubText();
                                                                    
                            MemoryBlock memoryBlock;
                                                                    
                             memoryBlock.loadFromHexString (binaryText);
                                                                    
                             std::unique_ptr<XmlElement> xml { AudioProcessor::getXmlFromBinary(memoryBlock.getData(), memoryBlock.getSize()) };
                                                                    
                             DBG(xml->toString()); //here it crashes 'cause xml is invalid
[...]                              

Here where the state of plugin is:

<bin name="audioComponent">
										46616246020000000F00000044656661756C742053657474696E670000000008
										00000000000000000000000000803F000020C100000000000000000000000000
										0000000100000001000000
                           </bin>

And in attachment a screen of the state of plugin saved in binary

But In this case I want to get the state from (i suppose) an hexadeicmal

I totally misinterpreted your problem (I thought you own the plugin’s code).
The state of the plugin seems written in binary format. I am afraid that only FabFilter engineers know how to decode it :melting_face:

1 Like

Really thank you, But I’m not interested in decode it, I only want to pass it to plugin to update his state, but I don’t know how… :blush:

I tried to write this (searching hardcode my micro on graph to test) to set state of the plugin (with this code with setStateInformation nothing happens), but it seems strange what memoryBlock.toString() prints…
I don’t know if with this procedure I’m on the right track to get what I need, 'cause I’m afraid cubase adds something of its own to this hexadecimal string…

code:

String binaryText = binaryElement->getAllSubText();
                                                                    
MemoryBlock memoryBlock;
                                                                    
memoryBlock.loadFromHexString (binaryText);

AudioProcessorGraph::Node::Ptr node;

for (AudioProcessorGraph::Node::Ptr n : graph.getAllNodes())
      if ((int)n->nodeID.uid == 7) { node = n; }
                                                                    
AudioProcessor* processor = node->getProcessor();
                                                                    
processor->setStateInformation (memoryBlock.getData(), (int) memoryBlock.getSize()); // nothing happens here
                                                                    
DBG(binaryText);
DBG((int) memoryBlock.getSize());
DBG(memoryBlock.toString());
DBG(memoryBlock.toBase64Encoding());

Print:

46616246020000000F00000044656661756C742053657474696E670000000008000000000000000000000000000000000020C1000000000000000000000000000000000100000001000000
                           
75
FabF
75.FElXFI....vC....DUlYgUGazAxTkQGco41Y.....f........................Rv.....................D....P.....

It seems also very compressed because if I print plugin state (with exactly the same param values) from my app it looks like this:

265.VMjLg.P....O+fWarAhckI2bo8la8HRLt.iHfTlai8FYo41Y8HRUTYTK3HxO9.BOVMEUy.Ea0cVZtMEcgQWY9vSRC8Vav8lak4Fc9bSMtXTQrgkQI4hKt3hcC4hKt3BQUwVVmU0QgoWP3Q0ZQczXuQSLY4hKt3hKl4hKt3hKt3hKt3hKt3hKt3hKt3RNC4hKtHkct3hKt3hKt3BTHwjKt3xY14hKt3hKD4hKt3BTt3hKt3BOujzPu0Fbu4VYtQmO7jTQjkFcC8lazI2arwVYx4SLx3hQYQUVpEjKt3hKt3hKtLyS77RREQVZzMzatQmbuwFakImO77hUSQ0LPwVcmklaSQWXzUlO..

There’s no requirement that the hosts have to store the plugin binary state data in some particular way. (It just needs to somehow end up exactly the same as the plugin originally provided it.) The hosts may add their own things and they may compress and/or encrypt the data. The chances are pretty low you will be able to get the plugin state data from another host and reuse it elsewhere.

1 Like

…pity… really thank you anyway :upside_down_face:

just a thing that I don’t understand: I’d like to have from juce::MemoryBlock a binary string that represent the state of plugin (so 0 and 1 digits), how can I get it? also toBase64Encoding doesn’t encode only the state of plugin (and add dots, it’s not a real base64…).

I observed what steinberg store on Hexadecimal string that represents the state of plugin and it doesn’t seem it’s so cripted… so my idea is transform steinberg hexadecimal to binary, get on my app the binary of the same plugin and compare them, I expect to have in the middle the same piece of digits and then reconvert this piece of digits in something readible from setStateInformation

What are you even trying to do? What does Cubase have to do with your own host?

1 Like

I only want to import state of plugins I use in cubase in the same plugins loaded in my host to have the same presets without saving and loading them each time (I’m speaking of thousand plugins…)

Got it! However, I am not familiar with the host-related or DAW part :smiling_face_with_tear: In Reaper, presets are stored in a specific format (defined by Reaper?)

1 Like

Not yet used reaper … but it would be very useful to be able to read this content from daws like cubase or reaper to recreate the state of the plugins in a proprietary daw and also vice versa to load work done on an xml into these daws (on the other hand, for example, cubase already provides a xml in which all track parameters are in the clear, it’s a pity you can’t take advantage of this also for the plugin binary)…