Exemplo n.º 1
0
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);
    

}
Exemplo n.º 2
0
void bankManager::saveScene(ofxXmlSettings & XML, ofPtr<scene> sn){
    
    XML.addValue("NAME", sn->getName());
    XML.addValue("UID", sn->getUid());
    XML.addValue("FADE_IN", sn->getFadeIn());
    XML.addValue("FADE_OUT", sn->getFadeOut());
    
    vector <ofPtr<triggerZone> > t_tzs = sn->getTriggerZones();
    vector <ofPtr<triggerZone> > ::iterator it;
    int count = 0;
    
    for(it = t_tzs.begin(); it != t_tzs.end(); it++){
        
        XML.addTag("ZONE");
        
        ofPtr<triggerZone> z = (*it);
        
        if(XML.pushTag("ZONE", count)){
            
            saveZone(XML, z);
                        
            count++;
            
            //zone tag
            XML.popTag();
        }
        
        
    }

    
}
Exemplo n.º 3
0
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);
    
    
}
Exemplo n.º 4
0
void nodeManager::implementReactions(ofPtr<clamourNode> n, ofPtr<clamourNode> tgt) {

    vector<reaction> r = n->getReactions();
    vector<reaction>::iterator it = r.begin();

    while(it != r.end()) {

        if(it->trig != "COLLIDE") {
            ++it;
            continue;
        }

        if(it->floatParams.find("DELAY_SECS") != it->floatParams.end()) {

            eventComm e;
            int delFrames = it->floatParams["DELAY_SECS"] * ofGetFrameRate();
            e.execAt = ofGetFrameNum() + delFrames;
            if(it->intParams.find("ENV_INDEX") != it->intParams.end())e.eventIndex = it->intParams["ENV_INDEX"];
            e.ownerIndex = tgt->getName();
            e.r = *it;
            mFutureEvents.push_back(e);


        } else {
            //implement immediately
            implementReaction(*it, tgt);
        }

        ++it;
    }



}
Exemplo n.º 5
0
void nodeManager::implementReaction(reaction & r, ofPtr<clamourNode> t, bool isOn) {

    if(r.rType == "sleep") {

        appReactions[t->getName()] = "resetControl";
        killNode(t->getName());

    } else if(r.rType == "transform") {

        clamourNode temp = presetStore::nodePresets[r.stringParams["PRESET"]]; //load the node into the reaction for easier variation
        setNode(t, temp);

    } else if(r.rType == "scaleNode") {

        parameter p = t->getDrawData().getParameter("size");

        p.abs_val *= r.floatParams["SCALE"];
        p.abs_val = min(1.0f, p.abs_val);
        t->setDrawParameter(p);
        ofPath pt = t->getEdgeTemplate();
        pt.scale(r.floatParams["SCALE"], r.floatParams["SCALE"]);
        t->setEdgeTemplate(pt);
        t->updatePath();

    } else if(r.rType == "scaleShift") {

        float shift = t->getShiftAmount() * r.floatParams["SCALE"];
        t->setShiftAmount(shift);

    } else if(r.rType == "scaleAttack") {

        float att = t->getAttSecs() * r.floatParams["SCALE"];
        t->setAttSecs(att);

    } else if(r.rType == "event") {

        t->triggerEvent(r.intParams["ENV_INDEX"]);


    } else if(r.rType == "eventOff") {

        t->endEvent(r.intParams["ENV_INDEX"]); // not sure this one is necessary

    }

}
Exemplo n.º 6
0
void zoneManager::onReact(ofPtr<zone> z) {

    z->setIsFired(true);
    z->react();
    z->setChanged(CLAMOUR_ON_OFF); //still needed ?
    scMessenger::startSynth(z->getName(), *z, z->getSoundData());
    implementReactions(z, true);

}
Exemplo n.º 7
0
void ofxAlembic::IGeom::visit_geoms(ofPtr<IGeom> &obj, map<string, IGeom*> &object_map)
{
	for (int i = 0; i < obj->m_children.size(); i++)
		visit_geoms(obj->m_children[i], object_map);

	if (obj->isTypeOf(UNKHOWN)) return;

	object_map[obj->getName()] = obj.get();
}
Exemplo n.º 8
0
void zoneManager::offReact(ofPtr<zone> z) {

    z->setIsFired(false);

    if(z->getEnvType() == CLAMOUR_ASR){
        scMessenger::stopSynth(z->getName(), z->getSoundData());
        z->setChanged(CLAMOUR_ON_OFF); // is this still needed
    }
    implementReactions(z, false);

}
Exemplo n.º 9
0
void ofxAlembic::IGeom::visit_geoms(ofPtr<IGeom> &obj, map<string, IGeom*> &object_name_map, map<string, IGeom*> &object_fullname_map)
{
	for (int i = 0; i < obj->m_children.size(); i++)
		visit_geoms(obj->m_children[i], object_name_map, object_fullname_map);
	
	if (obj->isTypeOf(UNKHOWN)) return;
	
//	assert(object_name_map.find(obj->getName()) == object_name_map.end());
	object_name_map[obj->getName()] = obj.get();
	
//	assert(object_fullname_map.find(obj->getFullName()) == object_fullname_map.end());
	object_fullname_map[obj->getFullName()] = obj.get();
}
Exemplo n.º 10
0
void testApp::updateBankElements(ofPtr<bank> b, ofPtr<scene> s){
    
    
    sc3TextInput->setTextString(b->name);
    perfBankText->setTextString(b->name);
    string nm = s->getName();
    if(nm.length() > 30)nm.resize(30);
    sceneText->setTextString(nm);
    
    string b_str = "\n\n";
    
    for(int i = 0; i < b->scenes.size(); i++){
        
        b_str += "   " + b->scenes[i]->getName();
        b_str += (i == b->selSceneIndex) ? "   <--- \n\n" : "\n\n";
        
    }
    
    bankText->setTextString(b_str);
    perfSceneText->setTextString(b_str);
    
    
}
Exemplo n.º 11
0
void testApp::updateSceneControls(ofPtr<scene> s, ofPtr<triggerZone> zn){
    
    sc2TextInput[0]->setTextString(s->getName());
    
    fInSlid->setValue(s->getFadeIn());
    fOutSlid->setValue(s->getFadeOut());
    
    if(s->getNumTriggerZones() > 0){
        
        if(displayMode == DT_DM_3D){
            
            zoneCanvases[0]->setVisible(true);
            
            if(zn->getShape() == TZ_SPHERE){
                zoneCanvases[1]->setVisible(true);
                zoneCanvases[2]->setVisible(false);
                zoneCanvases[3]->setVisible(false);
            }else if(zn->getShape() == TZ_BOX){
                zoneCanvases[1]->setVisible(false);
                zoneCanvases[2]->setVisible(true);
                zoneCanvases[3]->setVisible(false);
            }else{
                zoneCanvases[1]->setVisible(false);
                zoneCanvases[2]->setVisible(false);
                zoneCanvases[3]->setVisible(true);
            }
        }
        
        updateTZGuiElements(zn);
        
    }else{
        for(int i = 0; i < 4; i++)zoneCanvases[i]->setVisible(false);
        sc2TextInput[1]->setTextString("none");
    }
    
    
}