void bankManager::loadSynth(ofxXmlSettings & XML, ofPtr<triggerZone> z){ vector<synthParam> defSp = synthDictionary::getSynthParams(z->getSynthType()); for(int i = 0; i < defSp.size(); i++){ synthParam sp = defSp[i]; if(XML.pushTag(defSp[i].name)){ sp.abs_val = XML.getValue("ABS_VAL", defSp[i].abs_val); sp.min_val = XML.getValue("MIN_VAL", defSp[i].min_val); sp.max_val = XML.getValue("MAX_VAL", defSp[i].max_val); sp.map = mapType(XML.getValue("MAP", defSp[i].map)); z->setSynthParam(i, sp); XML.popTag(); } } }
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 bankManager::saveZone(ofxXmlSettings & XML, ofPtr<triggerZone> z){ XML.addValue("NAME", z->getName()); XML.addValue("POS_X", z->getPos().x); XML.addValue("POS_Y", z->getPos().y); XML.addValue("POS_Z", z->getPos().z); XML.addValue("SHAPE", z->getShape()); XML.addValue("DIM_X", z->getBoxDims().x); XML.addValue("DIM_Y", z->getBoxDims().y); XML.addValue("DIM_Z", z->getBoxDims().z); XML.addValue("RADIUS", z->getRadius()); XML.addValue("SOUNDFILE", z->getSoundFileName()); XML.addValue("IS_LOOP", z->getIsLoop()); XML.addValue("IS_PLAY_TO_END", z->getIsPlayToEnd()); XML.addValue("INVERTED", z->getIsOccInvert()); //left as is for compatability XML.addValue("MOV_ENABLED", z->getIsMovEnabled()); XML.addValue("MOV_INVERTED", z->getIsMovInvert()); XML.addValue("ENABLED", z->getIsEnabled()); //XML.addValue("SENSITIVITY", z->getSensitivity()); XML.addValue("MIN_REPLAY", z->getMinReplaySecs()); XML.addValue("CHANGE_BUFF", z->getChangeBuff()); XML.addValue("SYNTH_TYPE", z->getSynthType()); XML.addValue("SELECTOR_TYPE", z->getSelectorType()); saveSynth(XML, z); }
void testApp::updateTZGuiElements(ofPtr<triggerZone> zn){ sc2TextInput[1]->setTextString(zn->getName()); sc2TextInput[2]->setTextString(zn->getSoundFileName()); ofVec3f tp = zn->getPos(); tPosX->setValue(tp.x); tPosY->setValue(tp.y); tPosZ->setValue(tp.z); radSlid->setValue(zn->getRadius()); eblTog->setValue(zn->getIsEnabled()); loopTog->setValue(zn->getIsLoop()); playToEndTog->setValue(zn->getIsPlayToEnd()); occInvTog->setValue(zn->getIsOccInvert()); movEnaTog->setValue(zn->getIsMovEnabled()); movInvTog->setValue(zn->getIsMovInvert()); xDimSlid->setValue(zn->getBoxDims().x); yDimSlid->setValue(zn->getBoxDims().y); zDimSlid->setValue(zn->getBoxDims().z); //sensSlider->setValue(zn->getSensitivity()); repSlider->setValue(zn->getMinReplaySecs()); cbSlider->setValue(zn->getChangeBuff()); synthTypeDisp->setLabel("SYNTH_TYPE: " + synthDictionary::getSynthString(zn->getSynthType())); selTypeDisp->setLabel("SELECTOR_TYPE: " + synthDictionary::getSelectorString(zn->getSelectorType())); shapeText->setTextString(zn->getShapeString()); zn->setIsSelected(true); }
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); }