Maybe I’m missing something obvious, but I couldn’t find any method to directly copy a String into a MemoryBlock, so I could give a human-readable string description of my plugin’s settings in AudioProcessor::getStateInformation(). I don’t want to use any base 64 encoding or anything like that.
Thanks a lot in advance for your hints and solutions,
Fritz
Before switching to XML I just used to put a length byte, followed by the string contents so it was trivial to write a small helper function. I switched everything to work with the XML classes recently and working with saving/restoring state is much easier
Thanks a lot for your replies. In the meanwhile I found a solution which was the kind of straightforward solution I was looking for. It seems to work fine, but please let me know if there’s something wrong with it:
destData.append(settings.toRawUTF8(), CharPointer_UTF8::getBytesRequiredFor(settings.getCharPointer()));
I think it is just a virtual file representation, where you can use any write method. And it has no size limitations too…
The opposite way can use a raw pointer and size, because the size is already known.