コード例 #1
0
ファイル: main.cpp プロジェクト: oskrs111/pimcw
int main(int argc, char *argv[])
{
    QCoreApplication a(argc, argv);
    qDebug() << "toniManero starting...";
    g_appParameters = new QtKApplicationParameters(0,QString("toniManero"));

    if(g_appParameters->fileLoad(false))
    {
        setDefaultParameters();
        QString msg = "toniManero.cfg not found!\r\nSetting default configuration.";
        qDebug() << msg;
        a.exit();
    }

    if(!g_appParameters->loadParam(QString("app"),QString("fileLog"),0).compare("1"))
    {
        qInstallMessageHandler(debugLogger);
    }

    //http://stackoverflow.com/questions/19375141/udp-packet-is-not-received-in-qthread

    pca9685Interface interface((quint16)g_appParameters->loadParam(QString("network"),QString("udpPort"),0).toInt(),
                               (quint8)g_appParameters->loadParam(QString("i2c"),QString("i2cBus"),0).toInt(),
                               (quint8)g_appParameters->loadParam(QString("i2c"),QString("i2cAddr"),0).toInt(),
                               (quint8)g_appParameters->loadParam(QString("midi"),QString("noteOffset"),0).toInt(),
                               &a);


    QtkHttpServer server((quint16)g_appParameters->loadParam(QString("network"),QString("httpPort"),0).toInt(), &a);

    qDebug() << "toniManero (0.1) is dancing now!";
    return a.exec();
}
コード例 #2
0
ファイル: MMAS.cpp プロジェクト: Changhe160/OFEC
MMAS::MMAS(ParamMap &v) : AS(v), m_isHaveGlobalBest(false), m_isHaveRestartBest(false), m_globalBest(), m_restartBest(), m_impRadio(0)
{
	setDefaultParameters();
	if (m_globalBest.getNumDim() <= 20)
		m_length = m_globalBest.getNumDim() - 1;
	findnearghbor();
}
コード例 #3
0
CpeopleTracker::CpeopleTracker()
{
	nextTargetId = 1;
      followMeTargetId = -1;//initially there is no folloMe target Id 
	for (unsigned int ii=0; ii<NUM_DETECTORS; ii++) nextDetectionId[ii] = 1;
	setDefaultParameters();
}
コード例 #4
0
TrajectoryGraphicsItem::TrajectoryGraphicsItem(const QList<QPointF> &trajectory,
        QGraphicsItem *parent) :
    QGraphicsItemGroup(parent)
{
    setTrajectory(trajectory);
    setDefaultParameters();
}
コード例 #5
0
ファイル: MMAS.cpp プロジェクト: Changhe160/OFEC
MMAS::MMAS(double alpha, double beta, double Q, int Popsize, int NC, int numDim, double coeff) : AS(alpha, beta, Q, Popsize, NC, numDim, coeff),\
m_isHaveGlobalBest(false), m_isHaveRestartBest(false), m_globalBest(), m_restartBest(), m_impRadio(0)
{
	setDefaultParameters();
	if (m_globalBest.getNumDim() <= 20)
		m_length = m_globalBest.getNumDim() - 1;
	findnearghbor();
}
コード例 #6
0
ファイル: main.cpp プロジェクト: oskrs111/pimcw
int main(int argc, char *argv[])
{
    QCoreApplication a(argc, argv);
    qDebug() << "discoFever starting...";

    g_appParameters = new QtKApplicationParameters(0,QString("discoFever"));

    if(g_appParameters->fileLoad(false))
    {
            setDefaultParameters();
            QString msg = "discoFever.cfg not found!\r\nSetting default configuration.";
            qDebug() << msg;
            a.exit();
    }

    if(!g_appParameters->loadParam(QString("aplicacion"),QString("fileLog"),0).compare("1"))
    {
        qInstallMessageHandler(debugLogger);
    }

    qtkVirtualMIDI midi;
    networkThread network(QHostAddress(g_appParameters->loadParam(QString("network"),QString("udpHost"),0)),
                          (quint16)g_appParameters->loadParam(QString("network"),QString("udpPort"),0).toInt(),
                          (quint8)g_appParameters->loadParam(QString("network"),QString("statusRepeat"),0).toInt(),
                          (quint8)g_appParameters->loadParam(QString("network"),QString("midiOffIgnore"),0).toInt(),
                          (quint8)g_appParameters->loadParam(QString("network"),QString("midiChannelFilter"),0).toInt(),
                          (quint8)g_appParameters->loadParam(QString("network"),QString("midiChannelFilterEnable"),0).toInt(),
                          (quint8)g_appParameters->loadParam(QString("network"),QString("midiNoteOffset"),0).toInt());

    switch(midi.getStatus())
    {
        case stReady:
            QObject::connect(&midi,SIGNAL(midiReceived(midiMessage)),&network, SLOT(OnMidiReceived(midiMessage)));
            network.start();
            qDebug() << "discoFever is ready to dance!";
            return a.exec();
            break;

        case stUnknown:
        case stClosed:
        case stError:
        default:
            qDebug() << "qtkVirtualMIDI error, status: " << midi.getStatus();
            qDebug() << "discoFever will exit now...";
            break;
    }

    return 0;
}
コード例 #7
0
// first -- inner; second -- outer
Docking::Docking(const pair<string, string>& receptorFile, const pair<string, string>& ligandFile)
{
    exit(1);	ligandPath_ = "";
	receptorPath_ = "";
	radiiPath_ = "";
	receptor_.inner_.importFromFile(receptorFile.first);
	receptor_.outer_.importFromFile(receptorFile.second);

	ligand_.inner_.importFromFile(ligandFile.first);
	ligand_.outer_.importFromFile(ligandFile.second);

	setDefaultParameters();
	checkOrders();
	rotatationsCalculated_ = false;
	trigonometricCalculated_ = false;
	coeffMappingNLMCalculated_ = false;

	ligandPath_ = "";
	receptorPath_ = "";
	radiiPath_ = "";
}
コード例 #8
0
Docking::Docking(const Grid& receptorInner, const Grid& receptorOuter, const Grid& ligandInner, const Grid& ligandOuter, int order)
{
    exit(1);
	receptor_.inner_.init(order);
	receptor_.outer_.init(order);
	ligand_.inner_.init(order);
	ligand_.outer_.init(order);

	receptor_.inner_.calculateFromGrid(receptorInner);
	receptor_.outer_.calculateFromGrid(receptorOuter);

	ligand_.inner_.calculateFromGrid(ligandInner);
	ligand_.outer_.calculateFromGrid(ligandOuter);

	setDefaultParameters();
	checkOrders();
	rotatationsCalculated_ = false;
	trigonometricCalculated_ = false;
	coeffMappingNLMCalculated_ = false;

	ligandPath_ = "";
	receptorPath_ = "";
	radiiPath_ = "";
}
コード例 #9
0
ファイル: runtime.c プロジェクト: ashleysommer/FreeDSO
int fd_runtime_connectdevice(FDRuntime* self)
{
	FDDeviceClass *deviceclass = FD_DEVICE_GET_CLASS(FD_DEVICE(self->device));
	char* out = g_malloc0(256 * sizeof(char));
	pthread_mutex_lock(&FD_DEVICE(self->device)->deviceMutex);
	deviceclass->search(FD_DEVICE(self->device), &out); //search for device, grab a usb handle and model number.
	pthread_mutex_unlock(&FD_DEVICE(self->device)->deviceMutex);
	g_message("%s\n",out); //output of search function.
	g_free(out);
	switch (FD_DEVICE(self->device)->model)
	{
	case MODEL_DSO2090:
	case MODEL_DSO2100:
	case MODEL_DSO2150:
	case MODEL_DSO2250:
		self->gaincount = 9;
		double tempgains1[9] = {0.010, 0.020, 0.050, 0.100, 0.200, 0.500, 1.0, 2.0, 5.0};
		self->gains = g_malloc(sizeof(double)*self->gaincount);
		memcpy(self->gains, tempgains1, sizeof(double)*self->gaincount);
		self->sampleratecount = 16;
		unsigned long int tempsr1[16] = {100e6, 50e6, 25e6, 10e6, 5e6, 25e5, 1e6, 500e3, 250e3, 100e3, 50e3, 25e3, 10e3, 5e3, 25e2, 1e3};
		self->samplerates = g_malloc(sizeof(unsigned long int)*self->sampleratecount);
		memcpy(self->samplerates, tempsr1, sizeof(unsigned long int)*self->sampleratecount);
		break;

	case MODEL_DSO5200:
	case MODEL_DSO5200A:
		self->gaincount = 10;
		double tempgains2[10] = {0.010, 0.020, 0.050, 0.100, 0.200, 0.500, 1.0, 2.0, 5.0, 10.0};
		self->gains = g_malloc(sizeof(double)*self->gaincount);
		memcpy(self->gains, tempgains2, sizeof(double)*self->gaincount);
		self->sampleratecount = 17;
		unsigned long int tempsr2[17] = {250e6, 100e6, 50e6, 25e6, 10e6, 5e6, 25e5, 1e6, 500e3, 250e3, 100e3, 50e3, 25e3, 10e3, 5e3, 25e2, 1e3};
		self->samplerates = g_malloc(sizeof(unsigned long int)*self->sampleratecount);
		memcpy(self->samplerates, tempsr2, sizeof(unsigned long int)*self->sampleratecount);
		unsigned short int tempRanges[10] = {186, 370, 458, 916, 366, 450, 900, 368, 458, 908};
		self->ranges = g_malloc(sizeof(unsigned short int)*self->gaincount);
		memcpy(self->ranges, tempRanges, sizeof(unsigned short int)*self->gaincount);
		self->cal5200Data = g_malloc(sizeof(unsigned char)*6);
		break;

	case MODEL_UNKNOWN:
	default:
		self->gaincount = 6;
		double tempgains3[6] = {0.100, 0.200, 0.500, 1.0, 2.0, 5.0};
		self->gains = g_malloc(sizeof(double)*self->gaincount);
		memcpy(self->gains, tempgains3, sizeof(double)*self->gaincount);
		self->sampleratecount = 13;
		unsigned long int tempsr3[13] = {10e6, 5e6, 25e5, 1e6, 500e3, 250e3, 100e3, 50e3, 25e3, 10e3, 5e3, 25e2, 1e3};
		self->samplerates = g_malloc(sizeof(unsigned long int)*self->sampleratecount);
		memcpy(self->samplerates, tempsr3, sizeof(unsigned long int)*self->sampleratecount);
		break;
	}
	populateSamplerateComboBox(FD_UI(self->ui), self->samplerates, self->sampleratecount);
	populateGainComboBoxs(FD_UI(self->ui), self->gains, self->gaincount);
	self->samplerateFastMax = self->samplerates[0];
	self->samplerateChannelMax = self->samplerates[1];
	self->calibrationData = g_malloc(((sizeof(unsigned short int)*self->gaincount)*HANTEK_CHANNELS)*OFFSET_COUNT);
	getCalibrationData(self); //gets the channel level calibration data.
	printCalibrationData(self);
	self->calibration2Data = g_malloc(sizeof(unsigned char)*4);
	getCalibration2Data(self); //gets another calibration
	if (self->cal5200Data)
		getCal5200Data(self);
	self->currentAveraging[0] = 0;
	self->currentAveraging[1] = 0;
	fd_runtime_setdeviceisconnected(self, TRUE);
	fd_runtime_settriggersource(self, FALSE, 0);
	fd_runtime_settriggerposition(self, 0.5);
	fd_runtime_settriggerlevel(self, 0, 0.0);
	fd_runtime_settriggerslope(self, SLOPE_POSITIVE);
	fd_runtime_setbuffersize(self, 10240);
	fd_runtime_setchannelused(self, 1, FALSE);
	fd_runtime_setchannelused(self, 0, TRUE);
	fd_runtime_setoffset(self, 0, 0.5);
	fd_runtime_setoffset(self, 1, 0.5);
	setDefaultParameters(self);
	return 0;
}
コード例 #10
0
void MLPluginProcessor::setStateFromXML(const XmlElement& xmlState, bool setViewAttributes)
{
	if (!(xmlState.hasTagName (JucePlugin_Name))) return;
	if (!(mEngine.getCompileStatus() == MLProc::OK)) return; // TODO revisit need to compile first

	// getCallbackLock() is in juce_AudioProcessor
	// process lock is a quick fix.  it is here to prevent doParams() from getting called in 
	// process() methods and thereby setting mParamsChanged to false before the real changes take place.
	// A better alternative would be a lock-free queue of parameter changes.
	const ScopedLock sl (getCallbackLock()); 
		
	// only the differences between default parameters and the program state are saved in a program,
	// so the first step is to set the default parameters.
	setDefaultParameters();
	
	// get program version of saved state
	unsigned blobVersion = xmlState.getIntAttribute ("pluginVersion");
	unsigned pluginVersion = JucePlugin_VersionCode;
	
	if (blobVersion > pluginVersion)
	{
		// TODO show error to user
		MLError() << "MLPluginProcessor::setStateFromXML: saved program version is newer than plugin version!\n";
		return;
	}
    
	// try to load scale if a scale attribute exists
    // TODO auto save all state including this
 	const String scaleDir = xmlState.getStringAttribute ("scaleDir"); // look for old-style dir attribute   
	const String scaleName = xmlState.getStringAttribute ("scaleName");
    String fullName;
    if(scaleName != String::empty)
    {
        fullName = scaleName;
        if(scaleDir != String::empty)
        {
            fullName = scaleDir + String("/") + fullName + ".scl";
        }
    }
    else
    {
        fullName = "12-equal";
    }
    std::string fullScaleName(fullName.toUTF8());
	setProperty("key_scale", fullScaleName);
    bool loaded = false;
    // look for scale under full name with path
    if(fullScaleName != std::string())
    {
        const MLFilePtr f = mScaleFiles->getFileByName(fullScaleName);
        if(f != MLFilePtr())
        {
            loadScale(f->mFile);
            loaded = true;
        }
    }
    if(!loaded)
    {
        loadDefaultScale();
    }
    
	// get preset name saved in blob.  when saving from AU host, name will also be set from RestoreState().
	const String presetName = xmlState.getStringAttribute ("presetName");
	setProperty("preset", std::string(presetName.toUTF8()));
    
	/*
     debug() << "MLPluginProcessor: setStateFromXML: loading program " << presetName << ", version " << std::hex << blobVersion << std::dec << "\n";
     MemoryOutputStream myStream;
     xmlState->writeToStream (myStream, "");
     debug() << myStream.toString();
     */
	
    /*
     setCurrentPresetName(presetName.toUTF8());
     setCurrentPresetDir(presetDir.toUTF8());
     */
    
	// get plugin-specific translation table for updating older versions of data
	std::map<MLSymbol, MLSymbol> translationTable;

	// TODO move this into Aalto! 
	// make translation tables based on program version. 
	//
	if (blobVersion <= 0x00010120)
	{
		// translate seq parameters
		for(unsigned n=0; n<16; ++n)
		{
			std::stringstream pName;
			std::stringstream pName2;
			pName << "seq_value" << n;
			pName2 << "seq_pulse" << n;
			MLSymbol oldSym(pName.str());
			MLSymbol newSym = MLSymbol("seq_value#").withFinalNumber(n);
			MLSymbol oldSym2(pName2.str());
			MLSymbol newSym2 = MLSymbol("seq_pulse#").withFinalNumber(n);
			translationTable[oldSym] = newSym;
			translationTable[oldSym2] = newSym2;	
		}
	}

	if (blobVersion <= 0x00010200)
	{
		MLSymbol oldSym = MLSymbol("seq_value");
		MLSymbol newSym = MLSymbol("seq_value").withFinalNumber(0);
		MLSymbol oldSym2 = MLSymbol("seq_pulse");
		MLSymbol newSym2 = MLSymbol("seq_pulse").withFinalNumber(0);
		translationTable[oldSym] = newSym;
		translationTable[oldSym2] = newSym2;
		
		// translate seq parameters
		for(unsigned n=1; n<16; ++n)
		{
			oldSym = MLSymbol("seq_value#").withFinalNumber(n);
			newSym = MLSymbol("seq_value").withFinalNumber(n);
			oldSym2 = MLSymbol("seq_pulse#").withFinalNumber(n);
			newSym2 = MLSymbol("seq_pulse").withFinalNumber(n);
			translationTable[oldSym] = newSym;
			translationTable[oldSym2] = newSym2;	
		}		
	}
	
	// get params from xml
	const unsigned numAttrs = xmlState.getNumAttributes();
	String patcherInputStr ("patcher_input_");

	for(unsigned i=0; i<numAttrs; ++i)
	{
		// get name / value pair.
		const String& attrName = xmlState.getAttributeName(i);
		const MLParamValue paramVal = xmlState.getDoubleAttribute(attrName);
		
		// if not a patcher input setting,
		if (!attrName.contains(patcherInputStr))
		{					
			// see if we have this named parameter in our engine. 
			MLSymbol paramSym = XMLAttrToSymbol(attrName);
			const int pIdx = getParameterIndex(paramSym);
			
			if (pIdx >= 0)
			{
				// debug() << "setStateFromXML: <" << paramSym << " = " << paramVal << ">\n";
				setPropertyImmediate(paramSym, paramVal);
			}
			else // try finding a match through translation table. 
			{
				//debug() << "Looking for parameter " << paramSym << " in table...\n";
				std::map<MLSymbol, MLSymbol>::iterator it;
				it = translationTable.find(paramSym);
				if (it != translationTable.end())
				{
					const MLSymbol newSym = translationTable[paramSym];
					const int pNewIdx = getParameterIndex(newSym);
					if (pNewIdx >= 0)
					{
						//debug() << "translated parameter to " << newSym << " .\n";
						setPropertyImmediate(newSym, paramVal);
					}
					else
					{
						MLError() << "MLPluginProcessor::setStateFromXML: no such parameter! \n";
					}
				}
				else
				{
					// fail silently on unfound params, because we have deprecated some but they may still 
					// be around in old presets. 
					//debug() << "MLPluginProcessor::setStateFromXML: parameter " << paramSym << " not found!\n";
				}
			}
		}
	}
	
	// get editor state from XML
    if(setViewAttributes)
	{
		int x = xmlState.getIntAttribute("editor_x");
		int y = xmlState.getIntAttribute("editor_y");
		int width = xmlState.getIntAttribute("editor_width");
		int height = xmlState.getIntAttribute("editor_height");
		mEditorRect = MLRect(x, y, width, height);
		mEditorNumbersOn = xmlState.getIntAttribute("editor_num", 1);
		mEditorAnimationsOn = xmlState.getIntAttribute("editor_anim", 1);
	}
}
コード例 #11
0
TrajectoryGraphicsItem::TrajectoryGraphicsItem(QGraphicsItem *parent) :
    QGraphicsItemGroup(parent)
{
    setDefaultParameters();
}
コード例 #12
0
ファイル: SPEA2.cpp プロジェクト: SemiSQ/OpenModelica
SPEA2::SPEA2():EABase()
{
    setDefaultParameters();
}
コード例 #13
0
ファイル: FogInfo.cpp プロジェクト: ldematte/beppe
FogInfo::FogInfo()
{
	color[3] = 1.0f;
	setDefaultParameters();
}
コード例 #14
0
ファイル: PulsePal.cpp プロジェクト: PulsePal/PulsePal
PulsePal::PulsePal()
{
    setDefaultParameters();
        
}
コード例 #15
0
ファイル: SPEA2Adapt.cpp プロジェクト: SemiSQ/OpenModelica
SPEA2Adapt::SPEA2Adapt():EABase()
{
    setDefaultParameters();
}
コード例 #16
0
ファイル: SPEA2Adapt.cpp プロジェクト: SemiSQ/OpenModelica
SPEA2Adapt::SPEA2Adapt(Project* project,Problem* problem)
    :EABase(project,problem)
{
    setDefaultParameters();
};
コード例 #17
0
ファイル: GrnnTrainer.cpp プロジェクト: Re-bort/NNDK
Grnn::Trainer::Trainer(const MATRIX& X, const VECTOR& y)
    : X_(&X), y_(&y), z_(VECTOR(y.size(), 0.0))
{
    setDefaultParameters();
}