void MLPluginProcessor::getPatchAndEnvStatesAsBinary (MemoryBlock& destData) { // get processor state as JSON cJSON* procRoot = cJSON_CreateObject(); if(procRoot) { mpPatchState->getStateAsJSON(procRoot); } // get environment state as JSON cJSON* envRoot = cJSON_CreateObject(); if(envRoot) { mpEnvironmentState->getStateAsJSON(envRoot); } // combine the states cJSON* combinedRoot = cJSON_CreateObject(); std::string combinedStateStr; if(combinedRoot) { cJSON_AddItemToObject(combinedRoot, "patch", procRoot); cJSON_AddItemToObject(combinedRoot, "environment", envRoot); combinedStateStr = cJSON_Print(combinedRoot); } if(combinedStateStr.length() > 0) { // TODO compress here int stateStrLen = combinedStateStr.size(); destData.replaceWith(combinedStateStr.data(), stateStrLen); } }
//============================================================================== void C74GenAudioProcessor::getStateInformation (MemoryBlock& destData) { // You should use this method to store your parameters in the memory block. // You could do that either as raw data, or use the XML or ValueTree classes // as intermediaries to make it easy to save and load complex data. char *state; size_t statesize = C74_GENPLUGIN::getstatesize(m_C74PluginState); state = (char *)malloc(sizeof(char) * statesize); C74_GENPLUGIN::getstate(m_C74PluginState, state); destData.replaceWith(state, sizeof(char) * statesize); if (state) free(state); }