iqrcommon::moduleEPuck::moduleEPuck() { #ifdef IQRMODULE clsStringParameterSerialPort = addStringParameter("SerialPort", /* _strName */ "Serial Port", /* _strLabel */ "/dev/rfcomm0", /* _strValue */ true, /* _bEditable */ false, /* _bLong */ "Path to Serial Port", /* _strDescription */ "Device" /* _strCategory */); clsBoolParameterShowOutput = addBoolParameter("ShowOutput", /* _strName */ "Show output", /* _strLabel */ false, /* _bValue */ "Show Output", /* _strDescription */ "Output" /* _strCategory */); clsBoolParameterLEDFrontal = addBoolParameter("LEDFrontal", /* _strName */ "Frontal LED on", /* _strLabel */ false, /* _bValue */ "Turn Frontal LED on", /* _strDescription */ "Robot" /* _strCategory */); clsBoolParameterLEDLateral = addBoolParameter("LEDLateral", /* _strName */ "Lateral LED on", /* _strLabel */ false, /* _bValue */ "Turn Lateral LED on", /* _strDescription */ "Robot" /* _strCategory */); #endif clsEPuckDisp = NULL; }
ClsTopologyRect::ClsTopologyRect() {//: ClsBaseTopology(ClsTagLibrary::RectTopologyTag()) { strType = ClsTagLibrary::RectTopologyTag(); pclsWidth = addIntParameter(ClsTagLibrary::TopologyWidthTag(), "Width", 1, 1, 1000, "Width of group", "Properties"); pclsHeight = addIntParameter(ClsTagLibrary::TopologyHeightTag(), "Height", 1, 1, 1000, "Height of group", "Properties"); clsBoolParameterVerticalCylinder = addBoolParameter(ClsTagLibrary::TopologyCylinderVertical(), /* _strName */ "Treat as vertical cylinder", /* _strLabel */ false, /* _bValue */ "Treat group as vertical cylinder", /* _strDescription */ "Properties" /* _strCategory */); clsBoolParameterHorizontalCylinder = addBoolParameter(ClsTagLibrary::TopologyCylinderHorizontal(), /* _strName */ "Treat as horizontal cylinder", /* _strLabel */ false, /* _bValue */ "Treat group as horizontal cylinder", /* _strDescription */ "Properties" /* _strCategory */); }
void AudioModule::changeListenerCallback(ChangeBroadcaster *) { DBG("Change ! "); AudioDeviceManager::AudioDeviceSetup setup; am.getAudioDeviceSetup(setup); currentSampleRate = setup.sampleRate; currentBufferSize = setup.bufferSize; int numSelectedOutputChannelsInSetup = setup.outputChannels.countNumberOfSetBits(); graph.setPlayConfigDetails(0, numSelectedOutputChannelsInSetup, currentSampleRate, currentBufferSize); graph.prepareToPlay(currentSampleRate, currentBufferSize); DBG("total output : " << graph.getTotalNumOutputChannels()); for (auto &c : monitorOutChannels) removeControllable(c); monitorOutChannels.clear(); for (int i = 0; i < graph.getTotalNumOutputChannels(); i++) { BoolParameter * b = addBoolParameter("Monitor Out : "+graph.getOutputChannelName(i), "If enabled, sends audio from this layer to this channel", i < selectedMonitorOutChannels.size()); monitorOutChannels.add(b); } updateSelectedMonitorChannels(); audioModuleListeners.call(&AudioModuleListener::monitorSetupChanged); }
ClsFESystem::ClsFESystem() { strSystemID = ""; addStringParameter(ClsTagLibrary::NameTag(), "System Name", "", true, false, "Name", "Properties"); addStringParameter(ClsTagLibrary::NotesTag(), "Notes", "", true, true, "", "Notes"); addStringParameter(ClsTagLibrary::AuthorTag(), "Author", "", true, false, "Author", "Properties"); addStringParameter(ClsTagLibrary::DateTag(), "Date", "", true, false, "Date", "Properties"); addStringParameter(ClsTagLibrary::HostnameTag(), "Hostname", "", true, false, "Hostname", "Properties"); addBoolParameter(ClsTagLibrary::SyncPlotsTag(), "SyncPlots", false, "Sync plots to update", "Properties"); addIntParameter(ClsTagLibrary::PortTag() /* _strName */, "Port" /* _strLabel */, 54923 /* _iValue */, 52000 /* _iMinimum */, 60000 /* _iMaximum */, "Port" /* _strDescription */, "Properties" /* _strCategory */ ); addIntParameter(ClsTagLibrary::CyclesPerSecondTag(), /* _strName */ "Cycles Per Second", /* _strLabel */ 1000, /* _iValue */ 0, /* _iMinimum */ 10000, /* _iMaximum */ "Update Cycles Per Second (0 = unconstraint)", /* _strDescription */ "Properties" /* _strCategory */); };
// ------------------------------------------------------------ void EffectTextureExporter::add2DPlacement ( COLLADASW::Texture* colladaTexture, MObject texture ) { // Is there a texture placement applied to this texture? MObject placementNode = DagHelper::getSourceNodeConnectedTo ( texture, ATTR_UV_COORD ); if ( placementNode.hasFn ( MFn::kPlace2dTexture ) ) { MFnDependencyNode placement2d ( placementNode ); addBoolParameter ( colladaTexture, MAYA_TEXTURE_WRAPU_PARAMETER, placement2d ); addBoolParameter ( colladaTexture, MAYA_TEXTURE_WRAPV_PARAMETER, placement2d ); addBoolParameter ( colladaTexture, MAYA_TEXTURE_MIRRORU_PARAMETER, placement2d ); addBoolParameter ( colladaTexture, MAYA_TEXTURE_MIRRORV_PARAMETER, placement2d ); addFloatParameter ( colladaTexture, MAYA_TEXTURE_COVERAGEU_PARAMETER, placement2d ); addFloatParameter ( colladaTexture, MAYA_TEXTURE_COVERAGEV_PARAMETER, placement2d ); addFloatParameter ( colladaTexture, MAYA_TEXTURE_TRANSFRAMEU_PARAMETER, placement2d ); addFloatParameter ( colladaTexture, MAYA_TEXTURE_TRANSFRAMEV_PARAMETER, placement2d ); addAngleParameter ( colladaTexture, MAYA_TEXTURE_ROTFRAME_PARAMETER, placement2d ); addBoolParameter ( colladaTexture, MAYA_TEXTURE_STAGGER_PARAMETER, placement2d ); addBoolParameter ( colladaTexture, MAYA_TEXTURE_FAST_PARAMETER, placement2d ); addFloatParameter ( colladaTexture, MAYA_TEXTURE_REPEATU_PARAMETER, placement2d ); addFloatParameter ( colladaTexture, MAYA_TEXTURE_REPEATV_PARAMETER, placement2d ); addFloatParameter ( colladaTexture, MAYA_TEXTURE_OFFSETU_PARAMETER, placement2d ); addFloatParameter ( colladaTexture, MAYA_TEXTURE_OFFSETV_PARAMETER, placement2d ); addAngleParameter ( colladaTexture, MAYA_TEXTURE_ROTATEUV_PARAMETER, placement2d ); addFloatParameter ( colladaTexture, MAYA_TEXTURE_NOISEU_PARAMETER, placement2d ); addFloatParameter ( colladaTexture, MAYA_TEXTURE_NOISEV_PARAMETER, placement2d ); } }
AudioModule::AudioModule(const String & name) : Module(name), uidIncrement(100), numActiveMonitorOutputs(0), pitchDetector(nullptr) { inputGain = addFloatParameter("Input Gain", "Gain for the input volume", 1, 0, 10); activityThreshold = addFloatParameter("Activity Threshold", "Threshold to consider activity from the source.\nAnalysis will compute only if volume is greater than this parameter", .1f, 0, 1); keepLastDetectedValues = addBoolParameter("Keep Values", "Keep last detected values when no activity detected.", false); monitorVolume = addFloatParameter("Monitor Volume", "Volume multiplier for the monitor output. This will affect all the input channels and all the selected output channels", 1, 0, 10); //Values volume = valuesCC.addFloatParameter("Volume", "Volume of the audio input", 0, 0, 1); volume->isControllableFeedbackOnly = true; frequency = valuesCC.addFloatParameter("Freq", "Freq", 0, 0, 2000); frequency->isControllableFeedbackOnly = true; pitch = valuesCC.addIntParameter("Pitch", "Pitch", 0, 0, 300); pitch->isControllableFeedbackOnly = true; note = valuesCC.addEnumParameter("Note", "Detected note"); note->addOption("-", -1); for (int i = 0; i < 12; i++) note->addOption(MIDIManager::getNoteName(i, false), i); octave = valuesCC.addIntParameter("Octave", "Detected octave", 0, 0, 10); am.addAudioCallback(this); am.addChangeListener(this); am.initialiseWithDefaultDevices(2, 2); am.addAudioCallback(&player); graph.reset(); AudioDeviceManager::AudioDeviceSetup setup; am.getAudioDeviceSetup(setup); currentSampleRate = setup.sampleRate; currentBufferSize = setup.bufferSize; graph.setPlayConfigDetails(0, 2, currentSampleRate, currentBufferSize); graph.prepareToPlay(currentSampleRate, currentBufferSize); graph.addNode(new AudioProcessorGraph::AudioGraphIOProcessor(AudioProcessorGraph::AudioGraphIOProcessor::audioInputNode), 1); graph.addNode(new AudioProcessorGraph::AudioGraphIOProcessor(AudioProcessorGraph::AudioGraphIOProcessor::audioOutputNode), 2); player.setProcessor(&graph); }
Mapping::Mapping(bool canBeDisabled) : BaseItem("Mapping", canBeDisabled), forceDisabled(false), inputIsLocked(false) { continuousProcess = addBoolParameter("Continuous", "If enabled, the mapping will process continuously rather than only when parameter value has changed",false); addChildControllableContainer(&input); addChildControllableContainer(&cdm); addChildControllableContainer(&fm); addChildControllableContainer(&om); input.addMappingInputListener(this); }
ConditionManager::ConditionManager(bool _operatorOnSide) : BaseManager<Condition>("Conditions"), operatorOnSide(_operatorOnSide), validationProgress(nullptr) { selectItemWhenCreated = false; isValid = addBoolParameter("Is Valid","Indicates if all the conditions are valid. If so, the consequences are triggered one time, at the moment the action becomes valid.",false); isValid->isControllableFeedbackOnly = true; isValid->hideInEditor = true; conditionOperator = addEnumParameter("Operator", "Operator for this manager, will decides how the conditions are validated"); conditionOperator->addOption("AND", ConditionOperator::AND); conditionOperator->addOption("OR", ConditionOperator::OR); validationTime = addFloatParameter("Validation Time", "If greater than 0, the conditions will be validated only if they remain valid for this amount of time", 0, 0, 10); //conditionOperator->hideInEditor = items.size() <= 1; }
MStatus PRTAttrs::updateStartRules(MFnDependencyNode & node) { PRTNode* prtNode = (PRTNode*)node.userNode(); const prt::RuleFileInfo::Entry* startRule = 0; prt::Status infoStatus = prt::STATUS_UNSPECIFIED_ERROR; const prt::RuleFileInfo* info = prt::createRuleFileInfo(prtNode->mResolveMap->getString(prtNode->mRuleFile.c_str()), 0, &infoStatus); if (infoStatus == prt::STATUS_OK) { for(size_t r = 0; r < info->getNumRules(); r++) { if(info->getRule(r)->getNumParameters() > 0) continue; for(size_t a = 0; a < info->getRule(r)->getNumAnnotations(); a++) { if(!(wcscmp(info->getRule(r)->getAnnotation(a)->getName(), ANNOT_START_RULE))) { startRule = info->getRule(r); break; } } } } if(startRule) { prtNode->mStartRule = startRule->getName(); MCHECK(addBoolParameter(node, prtNode->mGenerate, NAME_GENERATE, true)); if(prtNode->mGenerateAttrs) { prtNode->mGenerateAttrs->destroy(); prtNode->mGenerateAttrs = 0; } prt::AttributeMapBuilder* aBuilder = prt::AttributeMapBuilder::create(); createAttributes(node, prtNode->mRuleFile, prtNode->mStartRule, aBuilder, info); prtNode->mGenerateAttrs = aBuilder->createAttributeMap(); aBuilder->destroy(); } if(info) info->destroy(); return MS::kSuccess; }
iqrcommon::ClsNeuronTest::ClsNeuronTest() : ClsNeuron(), pVmembrane(0), pActivity(0) { pExcGain = addDoubleParameter("excGain", "Excitatory gain", 1.0, 0.0, 1.0, 3, "Gain of excitatory inputs.\n" "The inputs are summed before\n" "being multiplied by this gain.", "Input"); pInhGain = addDoubleParameter("inhGain", "Inhibitory gain", 1.0, 0.0, 1.0, 3, "Gain of inhibitory inputs.\n" "The inputs are summed before\n" "being multiplied by this gain.", "Input"); // This neuron type doesn't use modulatory input, so don't include // ModGain. // Membrane persistence. pVmPrs = addDoubleParameter("vmPrs", "Membrane persistence", 0.0, 0.0, 1.0, 3, "Proportion of the membrane potential\n" "which remains after one time step\n" "if no input arrives.", "Membrane"); // Membrane clip parameters pClipVm = addBoolParameter("clipVm", "Clip potential", false, "Restrict the range of the membrane potential", "Clip"); pVmMin = addDoubleParameter("vmMin", "Minimum potential", 0.0, 0.0, 1.0, 3, "Minimum value of the membrane potential.", "Clip"); pVmMax = addDoubleParameter("vmMax", "Maximum potential", 1.0, 0.0, 1.0, 3, "Maximum value of the membrane potential.", "Clip"); pVmMin->setEnabler(pClipVm); pVmMax->setEnabler(pClipVm); pVmMin->setMaxSetter(pVmMax); pVmMax->setMinSetter(pVmMin); pMidpoint = addDoubleParameter("midpoint", "Midpoint", 0.0, 0.0, 1.0, 3, "Midpoint of the Test", "Test"); pSlope = addDoubleParameter("slope", "Slope", 1.0, 1.0, 1.0, 3, "Slope of the test", "Test"); pVmembrane = addStateVariable("vm", "Membrane potential", 2); pActivity = addOutputState("act", "Activity"); }
// TODO: make evalAttr finds more robust MStatus PRTAttrs::createAttributes(MFnDependencyNode & node, const std::wstring & ruleFile, const std::wstring & startRule, prt::AttributeMapBuilder* aBuilder, const prt::RuleFileInfo* info) { MStatus stat; MStatus stat2; MFnNumericData numericData; MFnTypedAttribute tAttr; MFnStringData attrDefaultStr; PRTNode* prtNode = (PRTNode*)node.userNode(); MString dummy; MayaCallbacks* outputHandler = prtNode->createOutputHandler(0, 0); const prt::AttributeMap* attrs = aBuilder->createAttributeMap(); prt::InitialShapeBuilder* isb = prt::InitialShapeBuilder::create(); isb->setGeometry( UnitQuad::vertices, UnitQuad::vertexCount, UnitQuad::indices, UnitQuad::indexCount, UnitQuad::faceCounts, UnitQuad::faceCountsCount ); isb->setAttributes( ruleFile.c_str(), startRule.c_str(), UnitQuad::seed, L"", attrs, prtNode->mResolveMap ); const prt::InitialShape* shape = isb->createInitialShapeAndReset(); prt::generate(&shape, 1, 0, &ENC_ATTR, 1, &prtNode->mAttrEncOpts, outputHandler, PRTNode::theCache, 0); const std::map<std::wstring, MayaCallbacks::AttributeHolder>& evalAttrs = outputHandler->getAttrs(); prtNode->mBriefName2prtAttr[NAME_GENERATE.asWChar()] = NAME_GENERATE.asWChar(); for(size_t i = 0; i < info->getNumAttributes(); i++) { PRTEnum* e = nullptr; const MString name = MString(info->getAttribute(i)->getName()); MObject attr; if(info->getAttribute(i)->getNumParameters() != 0) continue; prtNode->mBriefName2prtAttr[prtu::toCleanId(name).asWChar()] = name.asWChar(); switch(info->getAttribute(i)->getReturnType()) { case prt::AAT_BOOL: { for(size_t a = 0; a < info->getAttribute(i)->getNumAnnotations(); a++) { const prt::Annotation* an = info->getAttribute(i)->getAnnotation(a); if(!(wcscmp(an->getName(), ANNOT_RANGE))) e = new PRTEnum(prtNode, an); } bool value = evalAttrs.find(name.asWChar())->second.mBool; if(e) { MCHECK(addEnumParameter(node, attr, name, value, e)); } else { MCHECK(addBoolParameter(node, attr, name, value)); } break; } case prt::AAT_FLOAT: { double min = std::numeric_limits<double>::quiet_NaN(); double max = std::numeric_limits<double>::quiet_NaN(); for(size_t a = 0; a < info->getAttribute(i)->getNumAnnotations(); a++) { const prt::Annotation* an = info->getAttribute(i)->getAnnotation(a); if(!(wcscmp(an->getName(), ANNOT_RANGE))) { if(an->getNumArguments() == 2 && an->getArgument(0)->getType() == prt::AAT_FLOAT && an->getArgument(1)->getType() == prt::AAT_FLOAT) { min = an->getArgument(0)->getFloat(); max = an->getArgument(1)->getFloat(); } else e = new PRTEnum(prtNode, an); } } double value = evalAttrs.find(name.asWChar())->second.mFloat; if(e) { MCHECK(addEnumParameter(node, attr, name, value, e)); } else { MCHECK(addFloatParameter(node, attr, name, value, min, max)); } break; } case prt::AAT_STR: { MString exts; bool asFile = false; bool asColor = false; for(size_t a = 0; a < info->getAttribute(i)->getNumAnnotations(); a++) { const prt::Annotation* an = info->getAttribute(i)->getAnnotation(a); if(!(wcscmp(an->getName(), ANNOT_RANGE))) e = new PRTEnum(prtNode, an); else if(!(wcscmp(an->getName(), ANNOT_COLOR))) asColor = true; else if(!(wcscmp(an->getName(), ANNOT_DIR))) { exts = MString(an->getName()); asFile = true; } else if(!(wcscmp(an->getName(), ANNOT_FILE))) { asFile = true; for(size_t arg = 0; arg < an->getNumArguments(); arg++) { if(an->getArgument(arg)->getType() == prt::AAT_STR) { exts += MString(an->getArgument(arg)->getStr()); exts += " (*."; exts += MString(an->getArgument(arg)->getStr()); exts += ");;"; } } exts += "All Files (*.*)"; } } std::wstring value = evalAttrs.find(name.asWChar())->second.mString; MString mvalue(value.c_str()); if(!(asColor) && mvalue.length() == 7 && value[0] == L'#') asColor = true; if(e) { MCHECK(addEnumParameter(node, attr, name, mvalue, e)); } else if(asFile) { MCHECK(addFileParameter(node, attr, name, mvalue, exts)); } else if(asColor) { MCHECK(addColorParameter(node, attr, name, mvalue)); } else { MCHECK(addStrParameter(node, attr, name, mvalue)); } break; } default: break; } } shape->destroy(); attrs->destroy(); delete outputHandler; return MS::kSuccess; }
iqrcommon::ClsNeuronLinearThreshold::ClsNeuronLinearThreshold() : ClsNeuron(), pVmembrane(0), pActivity(0) { pExcGain = addDoubleParameter("excGain", "Excitatory gain", 1.0, 0.0, 10.0, 4, "Gain of excitatory inputs.\n" "The inputs are summed before\n" "being multiplied by this gain.", "Input"); pInhGain = addDoubleParameter("inhGain", "Inhibitory gain", 1.0, 0.0, 10.0, 4, "Gain of inhibitory inputs.\n" "The inputs are summed before\n" "being multiplied by this gain.", "Input"); // This neuron type doesn't use modulatory input, so don't include // ModGain. // Membrane persistence. pVmPrs = addDoubleParameter("vmPrs", "Membrane persistence", 0.0, 0.0, 1.0, 4, "Proportion of the membrane potential\n" "which remains after one time step\n" "if no input arrives.", "Membrane"); // Membrane clip parameters pClipVm = addBoolParameter("clipVm", "Clip potential", false, "Restrict the range of the membrane potential", "Clip"); pVmMin = addDoubleParameter("vmMin", "Minimum potential", 0.0, 0.0, 1.0, 4, "Minimum value of the membrane potential.", "Clip"); pVmMax = addDoubleParameter("vmMax", "Maximum potential", 1.0, 0.0, 1.0, 4, "Maximum value of the membrane potential.", "Clip"); pVmMin->setEnabler(pClipVm); pVmMax->setEnabler(pClipVm); pVmMin->setMaxSetter(pVmMax); pVmMax->setMinSetter(pVmMin); pProbability = addDoubleParameter("probability", "Probability", 1.0, 0.0, 1.0, 4, "Probability of output occuring during a single timestep.", "Membrane"); pThreshold = addDoubleParameter("threshold", "Threshold potential", 0.0, 0.0, 1.0, 4, "Membrane potential threshold for output activity.", "Membrane"); // Add state variables. pVmembrane = addStateVariable("vm", "Membrane potential"); pActivity = addOutputState("act", "Activity"); }