void bankManager::saveSynth(ofxXmlSettings & XML, ofPtr<triggerZone> z){ vector<synthParam> defSp = synthDictionary::getSynthParams(z->getSynthType()); for(int i = 0; i < defSp.size(); i++){ synthParam sp = z->getSynthParam(i); XML.addTag(defSp[i].name); if(XML.pushTag(defSp[i].name)){ XML.addValue("ABS_VAL", sp.abs_val); XML.addValue("MIN_VAL", sp.min_val); XML.addValue("MAX_VAL", sp.max_val); XML.addValue("MAP", (int)sp.map); XML.popTag(); } } }
void testApp::populateSynthCanvas(ofPtr<triggerZone> zn){ if(synthCanvas != NULL)delete synthCanvas; synthCanvas = new ofxUIScrollableCanvas(ofGetWidth()/2 - tabBarWidth * 0.9 , 0, tabBarWidth * 1.8, 200); synthCanvas->setColorFill(ofxUIColor(200)); synthCanvas->setColorFillHighlight(ofxUIColor(255)); synthCanvas->setColorBack(ofxUIColor(20, 20, 20, 150)); synthCanvas->setVisible(false); synthCanvas->setSnapping(false); vector<synthParam> sp = synthDictionary::getSynthParams(zn->getSynthType()); mapTypeLabels.clear(); for(int i = 0; i < sp.size(); i ++){ synthCanvas->addLabel(sp[i].name, OFX_UI_FONT_MEDIUM); synthParam c_sp = zn->getSynthParam(i); ofxUISlider * absl = new ofxUISlider("abs_val" , sp[i].sl_min, sp[i].sl_max, c_sp.abs_val , 100,20); synthCanvas->addWidgetDown(absl); absl->setID(i); ofxUISlider * mvsl = new ofxUISlider("min_val" , sp[i].sl_min, sp[i].sl_max, c_sp.min_val , 100,20); synthCanvas->addWidgetRight(mvsl); mvsl->setID(i); ofxUISlider * mxsl = new ofxUISlider("max_val" , sp[i].sl_min, sp[i].sl_max, c_sp.max_val , 100,20); synthCanvas->addWidgetRight(mxsl); mxsl->setID(i); ofxUITextArea * l = new ofxUITextArea("MAP_TYPE", "MAP_TYPE: " + synthDictionary::getMapString(c_sp.map), 180,20,0,0, OFX_UI_FONT_SMALL); synthCanvas->addWidgetRight(l); l->setID(i); mapTypeLabels.push_back(l); ofxUILabelButton * zb = (ofxUILabelButton *)synthCanvas->addWidgetRight(new ofxUILabelButton("MINUS", true, 25)); ofxUILabelButton * zc = (ofxUILabelButton *)synthCanvas->addWidgetRight(new ofxUILabelButton( "PLUS", true ,25)); zb->setLabelText("-"); zc->setLabelText("+"); zb->setID(i); zc->setID(i); synthCanvas->addWidgetDown(new ofxUILabel("", OFX_UI_FONT_SMALL)); synthCanvas->addSpacer(); } ofAddListener(synthCanvas->newGUIEvent,this,&testApp::synthEvents); }