当前位置: 首页>>代码示例>>C++>>正文


C++ DynamicObject::getProperty方法代码示例

本文整理汇总了C++中DynamicObject::getProperty方法的典型用法代码示例。如果您正苦于以下问题:C++ DynamicObject::getProperty方法的具体用法?C++ DynamicObject::getProperty怎么用?C++ DynamicObject::getProperty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DynamicObject的用法示例。


在下文中一共展示了DynamicObject::getProperty方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: varToState

void LoadSave::varToState(mopo::HelmEngine* synth,
                          const CriticalSection& critical_section,
                          var state) {
  if (!state.isObject())
    return;

  mopo::control_map controls = synth->getControls();
  DynamicObject* object_state = state.getDynamicObject();

  ScopedLock lock(critical_section);
  NamedValueSet properties = object_state->getProperties();
  int size = properties.size();
  for (int i = 0; i < size; ++i) {
    Identifier id = properties.getName(i);
    if (id.isValid()) {
      std::string name = id.toString().toStdString();
      if (controls.count(name)) {
        mopo::mopo_float value = properties.getValueAt(i);
        controls[name]->set(value);
      }
    }
  }

  synth->clearModulations();
  Array<var>* modulations = object_state->getProperty("modulations").getArray();
  var* modulation = modulations->begin();
  for (; modulation != modulations->end(); ++modulation) {
    DynamicObject* mod = modulation->getDynamicObject();
    std::string source = mod->getProperty("source").toString().toStdString();
    std::string destination = mod->getProperty("destination").toString().toStdString();
    mopo::ModulationConnection* connection = new mopo::ModulationConnection(source, destination);
    connection->amount.set(mod->getProperty("amount"));
    synth->connectModulation(connection);
  }
}
开发者ID:hztirf,项目名称:helm,代码行数:35,代码来源:load_save.cpp

示例2: loadModulations

void LoadSave::loadModulations(SynthBase* synth,
                               const Array<var>* modulations) {
  synth->clearModulations();
  var* modulation = modulations->begin();

  for (; modulation != modulations->end(); ++modulation) {
    DynamicObject* mod = modulation->getDynamicObject();
    std::string source = mod->getProperty("source").toString().toStdString();
    std::string destination = mod->getProperty("destination").toString().toStdString();
    mopo::ModulationConnection* connection = synth->getModulationBank().get(source, destination);
    synth->setModulationAmount(connection, mod->getProperty("amount"));
  }
}
开发者ID:and3k5,项目名称:helm,代码行数:13,代码来源:load_save.cpp

示例3: updateComponents

void PMixInterpolationSpaceLayout::updateComponents()
{
//  for (int i = getNumChildComponents(); --i >= 0;)
//  {
//    if (InterpolationSpacePreset* const pc = dynamic_cast <InterpolationSpacePreset*> (getChildComponent (i)))
//      pc->update();
//  }
  
  for (int i = audioEngine.getDoc().getNumNodes(); --i >= 0;)
  {
    const AudioProcessorGraph::Node::Ptr f (audioEngine.getDoc().getNode (i));
    
    if (!InternalPluginFormat::isInternalFormat(f->getProcessor()->getName()))
    {
      Array<InterpolationSpacePreset*> comps;
      getComponentsForNode(f->nodeID, comps);
      Array<var>* presets = f->properties.getVarPointer("presets")->getArray();
      
      // if the number of presets for this node has changed then delete the components and re-create
      if (comps.size() != presets->size())
      {
        for (int componentIdx = 0; componentIdx<comps.size(); componentIdx++)
        {
          removeChildComponent(comps[componentIdx]);
          delete comps[componentIdx];
        }
        
        for (int presetIdx = 0; presetIdx < presets->size(); presetIdx++)
        {
          DynamicObject* obj = presets->getReference(presetIdx).getDynamicObject();
          
          String label = obj->getProperty("name");
          InterpolationSpacePreset* const comp = new InterpolationSpacePreset(audioEngine, label, f->nodeID, obj->getProperty("uid"), audioEngine.getDoc().getNodeColour(f->nodeID)  );
          String componentID;
          componentID << "p." << (int) f->nodeID << "." << presetIdx;
          comp->setComponentID(componentID);
          float r = MIN_RADIUS + (RADIUS_RANGE * (float) obj->getProperty("radius"));
          float x = getWidth() * (float) obj->getProperty("x");
          float y = getHeight() * (float) obj->getProperty("y");
          
          comp->setSize(r, r);
          comp->setCentrePosition(x, y);
          comp->update();
          
          addAndMakeVisible (comp);
        }
      }
    }
    
  }
}
开发者ID:olilarkin,项目名称:pMix2,代码行数:51,代码来源:pMixInterpolationSpaceLayout.cpp

示例4: isValid

Result EnviJSONRPC::isValid(const String &jsonEncodedData)
{
	var temp;
	Result res = JSON::parse (jsonEncodedData, temp);

	if (res.wasOk())
	{
		if (temp.getDynamicObject())
		{
			DynamicObject *dso = temp.getDynamicObject();

			if (dso->hasProperty("jsonrpc"))
			{
				if (dso->getProperty("jsonrpc") != "2.0")
				{
					return (Result::fail("JSON-RPC request version is not 2.0 ["+dso->getProperty("jsonrpc").toString()+"]"));
				}

				if (dso->hasProperty("method") && dso->hasProperty("params"))
				{
					return (Result::ok());
				}

				if (!dso->hasProperty("method"))
				{
					return (Result::fail("JSON-RPC missing required method request parameter"));
				}

				if (!dso->hasProperty("params"))
				{
					return (Result::fail("JSON-RPC missing required params request parameter"));
				}
			}
			else
			{
				return (Result::fail("JSON-RPC missing jsonrpc property"));
			}
		}
		else
		{
			return (Result::fail("JSON-RPC json data is not an object"));
		}
	}
	else
	{
		return (Result::fail("JSON-RPC json parser failed ["+res.getErrorMessage()+"]"));
	}

	return (Result::fail("JSON-RPC Undefined parser state"));
}
开发者ID:RomanKubiak,项目名称:envi,代码行数:50,代码来源:EnviJSONRPC.cpp

示例5: loadModulations

void LoadSave::loadModulations(mopo::HelmEngine* synth,
                               const CriticalSection& critical_section,
                               const Array<var>* modulations) {
    ScopedLock lock(critical_section);

    synth->clearModulations();
    var* modulation = modulations->begin();

    for (; modulation != modulations->end(); ++modulation) {
        DynamicObject* mod = modulation->getDynamicObject();
        std::string source = mod->getProperty("source").toString().toStdString();
        std::string destination = mod->getProperty("destination").toString().toStdString();
        mopo::ModulationConnection* connection = new mopo::ModulationConnection(source, destination);
        connection->amount.set(mod->getProperty("amount"));
        synth->connectModulation(connection);
    }
}
开发者ID:rpazyaquian,项目名称:helm,代码行数:17,代码来源:load_save.cpp

示例6: getConfigVar

std::pair<wchar_t, wchar_t> LoadSave::getComputerKeyboardOctaveControls() {
  std::pair<wchar_t, wchar_t> octave_controls(mopo::DEFAULT_KEYBOARD_OCTAVE_DOWN,
                                              mopo::DEFAULT_KEYBOARD_OCTAVE_UP);
  var config_state = getConfigVar();
  if (config_state.isVoid())
    return octave_controls;

  DynamicObject* config_object = config_state.getDynamicObject();
  NamedValueSet config_properties = config_object->getProperties();

  if (config_properties.contains("keyboard_layout")) {
    DynamicObject* layout = config_properties["keyboard_layout"].getDynamicObject();
    octave_controls.first = layout->getProperty("octave_down").toString()[0];
    octave_controls.second = layout->getProperty("octave_up").toString()[0];
  }

  return octave_controls;
}
开发者ID:and3k5,项目名称:helm,代码行数:18,代码来源:load_save.cpp

示例7: getDefaultString

String IniFile::getDefaultString(const String& section, const String& key) const
{
    const GenericScopedLock<CriticalSection> scopedlock(lock);
    String realSection(section);
    if (realSection.isEmpty()) {
        realSection = "__empty";
    }

    if (!defaults.contains(realSection)) {
        return String();
    }

    DynamicObject *sectionObject = defaults[realSection].getDynamicObject();
    if (sectionObject->getProperty(key) == var::null) {
        return String();
    }
    return sectionObject->getProperty(key);
}
开发者ID:GrangerHub,项目名称:tremulous-launcher,代码行数:18,代码来源:IniFile.cpp

示例8: loadJSONData

void Engine::loadJSONData (var data,ProgressTask * loadingTask) 
{
	DynamicObject * dObject = data.getDynamicObject();
	if (dObject == nullptr)
	{
		DBG("SHIIIIT");
		return;
	}

	DynamicObject * md = data.getDynamicObject()->getProperty("metaData").getDynamicObject();
	bool versionChecked = checkFileVersion(md);

	if (!versionChecked)
	{
		String versionString = md->hasProperty("version") ? md->getProperty("version").toString() : "?";
		AlertWindow::showMessageBox(AlertWindow::AlertIconType::WarningIcon, "You're old, bitch !", "File version (" + versionString + ") is not supported anymore.\n(Minimum supported version : " + getMinimumRequiredFileVersion() + ")");
		return;
	}


	clear();

	if (InspectableSelectionManager::getInstanceWithoutCreating() != nullptr) InspectableSelectionManager::getInstance()->setEnabled(false); //avoid creation of inspector editor while recreating all nodes, controllers, rules,etc. from file
	if (Outliner::getInstanceWithoutCreating() != nullptr) Outliner::getInstance()->setEnabled(false);

	DynamicObject * d = data.getDynamicObject();
	
	ProgressTask * presetTask = loadingTask->addTask("Presets");
	ProgressTask * dashboardTask = loadingTask->addTask("Dashboard");

	loadJSONDataInternalEngine(data, loadingTask);

	presetTask->start();
	if (d->hasProperty("presetManager")) PresetManager::getInstance()->loadJSONData(d->getProperty("presetManager"));
	presetTask->end();
	
	dashboardTask->start();
	if (d->hasProperty("dashboardManager")) DashboardManager::getInstance()->loadJSONData(d->getProperty("dashboardManager"));
	dashboardTask->end();


	if (InspectableSelectionManager::getInstanceWithoutCreating() != nullptr) InspectableSelectionManager::getInstance()->setEnabled(true); //Re enable editor
	if (Outliner::getInstanceWithoutCreating() != nullptr) Outliner::getInstance()->setEnabled(true);
}
开发者ID:haskellstudio,项目名称:juce_organicui,代码行数:44,代码来源:EngineFileDocument.cpp

示例9: getComputerKeyboardLayout

std::wstring LoadSave::getComputerKeyboardLayout() {
  var config_state = getConfigVar();

  if (config_state.isVoid())
    return mopo::DEFAULT_KEYBOARD;

  DynamicObject* config_object = config_state.getDynamicObject();
  NamedValueSet config_properties = config_object->getProperties();

  if (config_properties.contains("keyboard_layout")) {
    DynamicObject* layout = config_properties["keyboard_layout"].getDynamicObject();

    if (layout->hasProperty("chromatic_layout"))
      return layout->getProperty("chromatic_layout").toString().toWideCharPointer();
  }

  return mopo::DEFAULT_KEYBOARD;
}
开发者ID:and3k5,项目名称:helm,代码行数:18,代码来源:load_save.cpp

示例10: isset

bool IniFile::isset(const String& section, const String& key) const
{
    const GenericScopedLock<CriticalSection> scopedlock(lock);
    String realSection(section);
    if (realSection.isEmpty()) {
        realSection = "__empty";
    }

    if (!data.contains(realSection)) {
        return false;
    }

    DynamicObject *sectionObject = data[realSection].getDynamicObject();
    if (sectionObject->getProperty(key) == var::null) {
        return false;
    }

    return true;
}
开发者ID:GrangerHub,项目名称:tremulous-launcher,代码行数:19,代码来源:IniFile.cpp

示例11: Load

bool ApplicationSettingsFile::Load(File file)
{
	if (!file.exists())
		return false;

	configFile = file.getFullPathName();
	String jsonString = file.loadFileAsString();
	var json;
	Result result = JSON::parse(jsonString, json);
	if (result.ok())
	{
		DynamicObject* obj = json.getDynamicObject();
		if (obj == nullptr)
			return false;

		if(obj->hasProperty("PlayType"))
			setPlayType((SoundPlayType)(int)obj->getProperty("PlayType"));
		if (obj->hasProperty("UseGlobalHooks"))
			setUseGlobalHooks((bool)obj->getProperty("UseGlobalHooks"));

		if (obj->hasProperty("StopAllSoundKeyPresses"))
		{
			var keyPresses = obj->getProperty("StopAllSoundKeyPresses");
			if (keyPresses.isArray())
			{
				for (int i = 0; i < keyPresses.size(); ++i)
				{
					var jsonKeyPress(keyPresses[i]);
					if (jsonKeyPress.isVoid())
						continue;

					DynamicObject* jsonKeyPressObj = jsonKeyPress.getDynamicObject();
					if (jsonKeyPressObj == nullptr)
						continue;

					int keyCode = (int)jsonKeyPressObj->getProperty("KeyCode");
					int modifierFlags = (int)jsonKeyPressObj->getProperty("ModifierFlags");
					juce::juce_wchar textCharacter = (juce_wchar)((int)jsonKeyPressObj->getProperty("TextCharacter"));
					ModifierKeys modifierKeys;
					modifierKeys = modifierKeys.withFlags(modifierFlags);
					KeyPress keyPress(keyCode, modifierKeys, textCharacter);
					stopAllSoundsKeys.add(keyPress);
				}
			}
		}
	}

	return true;
}
开发者ID:Nimgoble,项目名称:GlobalHooksTest,代码行数:49,代码来源:ApplicationSettingsFile.cpp

示例12: varToState

void LoadSave::varToState(SynthBase* synth,
                          std::map<std::string, String>& save_info,
                          var state) {
  if (!state.isObject())
    return;

  DynamicObject* object_state = state.getDynamicObject();
  NamedValueSet properties = object_state->getProperties();

  // Version 0.4.1 was the last build before we saved the version number.
  String version = "0.4.1";
  if (properties.contains("synth_version"))
    version = properties["synth_version"];

  // After 0.4.1 there was a patch file restructure.
  if (compareVersionStrings(version, "0.4.1") <= 0) {
    NamedValueSet new_properties;
    new_properties.set("settings", object_state);
    properties = new_properties;
  }

  var settings = properties["settings"];
  DynamicObject* settings_object = settings.getDynamicObject();
  NamedValueSet settings_properties = settings_object->getProperties();
  Array<var>* modulations = settings_properties["modulations"].getArray();

  // After 0.5.0 mixer was added and osc_mix was removed. And scaling of oscillators was changed.
  if (compareVersionStrings(version, "0.5.0") <= 0) {

    // Fix control control values.
    if (settings_properties.contains("osc_mix")) {
      mopo::mopo_float osc_mix = settings_properties["osc_mix"];
      settings_properties.set("osc_1_volume", sqrt(1.0f - osc_mix));
      settings_properties.set("osc_2_volume", sqrt(osc_mix));
      settings_properties.remove("osc_mix");
    }

    // Fix modulation routing.
    var* modulation = modulations->begin();
    Array<var> old_modulations;
    Array<DynamicObject*> new_modulations;
    for (; modulation != modulations->end(); ++modulation) {
      DynamicObject* mod = modulation->getDynamicObject();
      String destination = mod->getProperty("destination").toString();

      if (destination == "osc_mix") {
        String source = mod->getProperty("source").toString();
        mopo::mopo_float amount = mod->getProperty("amount");
        old_modulations.add(mod);

        DynamicObject* osc_1_mod = new DynamicObject();
        osc_1_mod->setProperty("source", source);
        osc_1_mod->setProperty("destination", "osc_1_volume");
        osc_1_mod->setProperty("amount", -amount);
        new_modulations.add(osc_1_mod);

        DynamicObject* osc_2_mod = new DynamicObject();
        osc_2_mod->setProperty("source", source);
        osc_2_mod->setProperty("destination", "osc_2_volume");
        osc_2_mod->setProperty("amount", amount);
        new_modulations.add(osc_2_mod);
      }
    }

    for (var old_modulation : old_modulations)
      modulations->removeFirstMatchingValue(old_modulation);

    for (DynamicObject* modulation : new_modulations)
      modulations->add(modulation);
  }

  if (compareVersionStrings(version, "0.7.2") <= 0) {
    bool stutter_on = settings_properties["stutter_on"];
    if (stutter_on) {
      settings_properties.set("stutter_resample_sync", 0);
      settings_properties.set("stutter_sync", 0);
    }
  }

  loadControls(synth, settings_properties);
  loadModulations(synth, modulations);
  loadSaveState(save_info, properties);
}
开发者ID:and3k5,项目名称:helm,代码行数:83,代码来源:load_save.cpp

示例13: createNodeXml

 XmlElement* PMixDocument::createNodeXml (AudioProcessorGraph::Node* const node) noexcept
{
  AudioPluginInstance* plugin = dynamic_cast <AudioPluginInstance*> (node->getProcessor());

  if (plugin == nullptr)
  {
    jassertfalse;
    return nullptr;
  }

  XmlElement* e = new XmlElement ("NODE");
  e->setAttribute ("uid", (int) node->nodeID);
  e->setAttribute ("x", node->properties ["x"].toString());
  e->setAttribute ("y", node->properties ["y"].toString());
  e->setAttribute ("uiLastX", node->properties ["uiLastX"].toString());
  e->setAttribute ("uiLastY", node->properties ["uiLastY"].toString());
  e->setAttribute ("uiStatus", node->properties ["uiStatus"].toString());
  
  PluginDescription pd;
  plugin->fillInPluginDescription (pd);
  
  if(!InternalPluginFormat::isInternalFormat(pd.name))
  {
    e->setAttribute("colour", node->properties ["colour"].toString());
    e->setAttribute ("iposx", node->properties ["iposx"].toString());
    e->setAttribute ("iposy", node->properties ["iposy"].toString());
  }
  
  e->addChildElement (pd.createXml());

  XmlElement* state = new XmlElement ("STATE");

  MemoryBlock m;
  node->getProcessor()->getStateInformation (m);
  state->addTextElement (m.toBase64Encoding());
  e->addChildElement (state);
  
  if(!InternalPluginFormat::isInternalFormat(pd.name))
  {
    XmlElement* params = new XmlElement ("PARAMS");
    Array<var>* paramsArray = node->properties.getVarPointer("params")->getArray();
    
    params->addTextElement("[");
    for(int i=0;i<paramsArray->size();i++)
    {
      var parameterIdx = paramsArray->getReference(i);
      
      params->addTextElement(parameterIdx.toString());
      
      if(i != paramsArray->size()-1)
        params->addTextElement(", ");
    }
    params->addTextElement("]");
    
    e->addChildElement(params);
        
    Array<var>* presetsArr = node->properties.getVarPointer("presets")->getArray();
    
    for(int i=0;i<presetsArr->size();i++)
    {
      XmlElement* presetXML = new XmlElement ("PRESET");
      DynamicObject* thePreset = presetsArr->getReference(i).getDynamicObject();
      presetXML->setAttribute("name", thePreset->getProperty("name").toString());
      presetXML->setAttribute("x", thePreset->getProperty("x").toString());
      presetXML->setAttribute("y", thePreset->getProperty("y").toString());
      presetXML->setAttribute("radius", thePreset->getProperty("radius").toString());
      presetXML->setAttribute("hidden", thePreset->getProperty("hidden").toString());
      //presetXML->setAttribute("distance", thePreset->getProperty("distance").toString());
      presetXML->setAttribute("coeff", thePreset->getProperty("coeff").toString());
      presetXML->setAttribute("uid", thePreset->getProperty("uid").toString());

      Array<var>* paramsArray = thePreset->getProperty("state").getArray();
      
      presetXML->addTextElement("[");
      for(int i=0;i<paramsArray->size();i++)
      {
        var parameterIdx = paramsArray->getReference(i);
        
        presetXML->addTextElement(parameterIdx.toString());
        
        if(i != paramsArray->size()-1)
          presetXML->addTextElement(", ");
      }
      
      presetXML->addTextElement("]");
      
      e->addChildElement(presetXML);
    }
  }
  
  return e;
}
开发者ID:olilarkin,项目名称:pMix2,代码行数:92,代码来源:pMixDocument.cpp


注:本文中的DynamicObject::getProperty方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。