예제 #1
0
파일: device.cpp 프로젝트: rmnzr/murmur
//--------------------------------------------------------------
void Device::loadXML(string dir)
{
    ofxXmlSettings settings;
    string pathFile = getPathXML(dir);
    if ( settings.loadFile(pathFile) )
    {
        string surfaceId = settings.getAttribute("device:surface", "id", "main");
        float xNorm = settings.getValue("device:surface:xNorm", 0.5f);
        float yNorm = settings.getValue("device:surface:yNorm", 0.5f);
        
        
        printf("Device, loaded %s\n", pathFile.c_str());
        printf("    - volMax=%.3f\n", settings.getValue("device:soundInput:volMax",0.05f));
        printf("    - volHistoryNb=%d\n", settings.getValue("device:soundInput:volHistoryNb",400));
        printf("    - volHistoryTh=%.3f\n", settings.getValue("device:soundInput:volHistoryTh",0.1f));
        printf("    - enableStandby=%s\n", settings.getValue("device:enableStandby",1) ? "true" : "false");
        printf("    - timeStandby=%.2f\n", settings.getValue("device:timeStandby",10.0f) );
        printf("    - nbLEDsStandby=%d\n", settings.getValue("device:nbLEDsStandby",50) );
        printf("    - speedStandby=%d\n", settings.getValue("device:speedStandby",70.0) );
        printf("    - surface=%s (xNorm=%.2f,yNorm=%.2f)\n",surfaceId.c_str(), xNorm, yNorm);
        
        setSoundInputVolumeMax( settings.getValue("device:soundInput:volMax",0.05f) );
        setSoundInputVolHistorySize( settings.getValue("device:soundInput:volHistoryNb",400) );
        setSoundInputVolHistoryTh( settings.getValue("device:soundInput:volHistoryTh",0.1f) );
        setEnableStandbyMode( settings.getValue("device:enableStandby",1)==1 ? true : false );
        setTimeStandby( settings.getValue("device:timeStandby",10.0f) );
        setNbLEDsStandby( settings.getValue("device:nbLEDsStandby", 50) );
        setSpeedStandbyOSC( settings.getValue("device:speedStandby", 70.0) );
        setPointSurface(xNorm, yNorm);
        
    }
    else{
        printf("Device, error loading %s\n", pathFile.c_str());
    }
}
예제 #2
0
파일: device.cpp 프로젝트: v3ga/murmur
//--------------------------------------------------------------
void Device::loadXMLSoundInput(ofxXmlSettings& settings)
{
  int	 	useRawVol 			= settings.getValue("device:soundInput:useRawVol",0.05f);
  int		mute				= settings.getValue("device:soundInput:mute",0);
  float 	volMax 				= settings.getValue("device:soundInput:volMax",0.05f);
  float 	volMaxMin 			= settings.getValue("device:soundInput:volMaxMin",0.0f);
  float 	volMaxMax 			= settings.getValue("device:soundInput:volMaxMax",0.05f);
  int 		volHistoryNb 		= settings.getValue("device:soundInput:volHistoryNb", 400);
  float 	volHistoryTh		= settings.getValue("device:soundInput:volHistoryTh",0.1f);
  float 	pitchMin			= settings.getValue("device:soundInput:pitchMin",30.0f);
  float 	pitchMax			= settings.getValue("device:soundInput:pitchMax",100.0f);
  int		enableStandby		= settings.getValue("device:enableStandby",1);
  float 	timeStandby			= settings.getValue("device:timeStandby",10.0f);
  float 	sampleVolStandby	= settings.getValue("device:sampleVolStandby",0.35f);
  int		enableStandup		= settings.getValue("device:enableStandup",1);
 


   setSoundInputUseRawVolume(useRawVol==1 ? true : false );
   setSoundInputMute(mute==1 ? true : false );
   setSoundInputVolumeMax( volMax );
   setSoundInputVolumeMaxMin( volMaxMin );
   setSoundInputVolumeMaxMax( volMaxMax );
   setSoundInputVolHistorySize( volHistoryNb );
   setSoundInputVolHistoryTh( volHistoryTh );
   setSoundInputPitchMin(pitchMin);
   setSoundInputPitchMax(pitchMax);
   setEnableStandbyMode( enableStandby == 1 ? true : false );
   setTimeStandby( timeStandby );
   setSampleVolumeStandby( sampleVolStandby );
   // setEnableStandup( enableStandup );
   // setStandupVol( volStandup );


   OFAPPLOG->println(" - useRawVol="+ofToString(useRawVol));
   OFAPPLOG->println(" - mute="+ofToString(mute));
   OFAPPLOG->println(" - volMax="+ofToString(volMax));
   OFAPPLOG->println(" - volMaxMin="+ofToString(volMaxMax));
   OFAPPLOG->println(" - volMaxMax="+ofToString(volMaxMax));
   OFAPPLOG->println(" - volHistoryNb="+ofToString(volHistoryNb));
   OFAPPLOG->println(" - volHistoryTh="+ofToString(volHistoryTh));
   OFAPPLOG->println(" - pitchMin="+ofToString(pitchMin));
   OFAPPLOG->println(" - pitchMax="+ofToString(pitchMax));
   OFAPPLOG->println(" - enableStandby="+ofToString(timeStandby));
   OFAPPLOG->println(" - timeStandby="+ofToString(enableStandby));
   OFAPPLOG->println(" - sampleVolStandby="+ofToString(sampleVolStandby));
   OFAPPLOG->println(" - enableStandup="+ofToString(enableStandup));
//   OFAPPLOG->println(" - volStandup="+ofToString(volStandup));
}