//-------------------------------------------------------------- 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()); } }
//-------------------------------------------------------------- void Device::loadXMLSurface(ofxXmlSettings& settings) { 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); OFAPPLOG->println(" - surface="+surfaceId+" (xNorm="+ofToString(xNorm)+",yNorm="+ofToString(yNorm)+")"); setPointSurface(xNorm, yNorm); }
//-------------------------------------------------------------- Device::Device(string id, int nbLEDs, float distLEDs) { mp_soundInput = 0; m_indexPacketReceived = 0; setPointSurface(0.5f,0.5f); set(id,nbLEDs,distLEDs); m_isActive = false; m_isEnableStandbyMode = true; m_stateStandby = EStandby_active; m_stateStandbyDuration = 0.0f; m_timeStandby = 10.0f; mp_sampleStandBy = 0; m_sampleVolStandby = 0.35f; m_sampleNameStandby = "Sounds/StandBy/theme1-4.wav"; m_soundInputVolEmpiricalMaxMin = 0.0; m_soundInputVolEmpiricalMaxMax = 0.04; m_soundInputPitchMin = 30.0f; m_soundInputPitchMax = 128.0f; m_bEnablePitch = true; m_bpmEnable = false; m_bpm = 120; m_bpmTime = 0.0f; m_isEnableStandup = false; m_standupTh = 0.55f; m_color.setHsb(200, 255, 255); // Brightness not used as set by packets m_colorMode = colorMode_manual_hsb; m_colorSpeedOscillation = 10.0f; m_color2.setHsb(200, 255, 255); for (int i=0;i<3;i++){ m_colorHsv[i]=0.0f; m_colorHsv2[i]=0.0f; } m_isUpdatingPacket = false; m_isSendMessagesOSC = true; m_isEnableColor = false; m_isInvertPacketsVolume = false; m_isReverseDirPackets = false; m_soundInputUseRawVol = true; m_soundInputMute = false; m_volHistoryPingTh = 0.5; m_bGenerative = true; }
//-------------------------------------------------------------- Device::Device(string id, int nbLEDs, float distLEDs) { mp_soundInput = 0; m_indexPacketReceived = 0; setPointSurface(0.5f,0.5f); set(id,nbLEDs,distLEDs); m_isActive = false; m_isEnableStandbyMode = true; m_stateStandby = EStandby_active; m_stateStandbyDuration = 0.0f; m_timeStandby = 10.0f; m_nbLEDsStandby = 50; mp_sampleStandBy = 0; m_angleSampleStandby = 0.0f; m_angleSampleStandbySpeed = 70.0f; mp_sampleStandBy = new float[m_nbLEDs]; for (int i=0;i<m_nbLEDs;i++){ mp_sampleStandBy[i]=0.0f; } }