FilterModel FilterGraph::formatFilterModel (AudioProcessorGraph::Node* const node) { //FOR SAVING AND UPDATING FilterModel filter; AudioPluginInstance* plugin = dynamic_cast<AudioPluginInstance*>(node->getProcessor()); if (plugin == nullptr) { jassertfalse; return filter; } PluginDescription pd; plugin->fillInPluginDescription(pd); fill_in_filter_pd_info(node, filter, pd); return filter; }
XmlElement* PMixDocument::createNodeXml (AudioProcessorGraph::Node* const node) noexcept { AudioPluginInstance* plugin = dynamic_cast <AudioPluginInstance*> (node->getProcessor()); if (plugin == nullptr) { jassertfalse; return nullptr; } XmlElement* e = new XmlElement ("NODE"); e->setAttribute ("uid", (int) node->nodeID); e->setAttribute ("x", node->properties ["x"].toString()); e->setAttribute ("y", node->properties ["y"].toString()); e->setAttribute ("uiLastX", node->properties ["uiLastX"].toString()); e->setAttribute ("uiLastY", node->properties ["uiLastY"].toString()); e->setAttribute ("uiStatus", node->properties ["uiStatus"].toString()); PluginDescription pd; plugin->fillInPluginDescription (pd); if(!InternalPluginFormat::isInternalFormat(pd.name)) { e->setAttribute("colour", node->properties ["colour"].toString()); e->setAttribute ("iposx", node->properties ["iposx"].toString()); e->setAttribute ("iposy", node->properties ["iposy"].toString()); } e->addChildElement (pd.createXml()); XmlElement* state = new XmlElement ("STATE"); MemoryBlock m; node->getProcessor()->getStateInformation (m); state->addTextElement (m.toBase64Encoding()); e->addChildElement (state); if(!InternalPluginFormat::isInternalFormat(pd.name)) { XmlElement* params = new XmlElement ("PARAMS"); Array<var>* paramsArray = node->properties.getVarPointer("params")->getArray(); params->addTextElement("["); for(int i=0;i<paramsArray->size();i++) { var parameterIdx = paramsArray->getReference(i); params->addTextElement(parameterIdx.toString()); if(i != paramsArray->size()-1) params->addTextElement(", "); } params->addTextElement("]"); e->addChildElement(params); Array<var>* presetsArr = node->properties.getVarPointer("presets")->getArray(); for(int i=0;i<presetsArr->size();i++) { XmlElement* presetXML = new XmlElement ("PRESET"); DynamicObject* thePreset = presetsArr->getReference(i).getDynamicObject(); presetXML->setAttribute("name", thePreset->getProperty("name").toString()); presetXML->setAttribute("x", thePreset->getProperty("x").toString()); presetXML->setAttribute("y", thePreset->getProperty("y").toString()); presetXML->setAttribute("radius", thePreset->getProperty("radius").toString()); presetXML->setAttribute("hidden", thePreset->getProperty("hidden").toString()); //presetXML->setAttribute("distance", thePreset->getProperty("distance").toString()); presetXML->setAttribute("coeff", thePreset->getProperty("coeff").toString()); presetXML->setAttribute("uid", thePreset->getProperty("uid").toString()); Array<var>* paramsArray = thePreset->getProperty("state").getArray(); presetXML->addTextElement("["); for(int i=0;i<paramsArray->size();i++) { var parameterIdx = paramsArray->getReference(i); presetXML->addTextElement(parameterIdx.toString()); if(i != paramsArray->size()-1) presetXML->addTextElement(", "); } presetXML->addTextElement("]"); e->addChildElement(presetXML); } } return e; }