Saving MIDI mappings in a preset

Greetings,

I wish to save/restore my MIDI-Learn controller-mappings to/from an XML file. Is there a recommended way to do this?

Following foleys_gui_magic/State/foleys_MidiParameterMapper.cpp
I can obtain the mappings and convert them to a nice looking XML string, but I have to use an apparently private ID to do it:

auto mappings = settings->settings.getChildWithName (IDs::mappings);

It would be great if MidiParameterMapper had public member functions getMidiParameterMapXml() and setMidiParameterMapFromXml() or something like that. Otherwise, I suppose exposing foleys::IDs::mappings is enough.

What’s the best approach? Thanks!

Great idea, I will look into it.
I like your suggestion of getMidiParameterMapXml() and setMidiParameterMapFromXml().
I might use the ValueTree instead of XML though.

1 Like

Sorry for the delay, I added the access method here:

I realised that exposing the settings ValueTree is sufficient. There is a ValueTree::Listener, so it will update the mappingd if you change the ValueTree contents. Let me know if that works for you.

1 Like