本文整理汇总了C++中var::getDynamicObject方法的典型用法代码示例。如果您正苦于以下问题:C++ var::getDynamicObject方法的具体用法?C++ var::getDynamicObject怎么用?C++ var::getDynamicObject使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类var
的用法示例。
在下文中一共展示了var::getDynamicObject方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: loadJSONDataInternal
void Parameter::loadJSONDataInternal(var data)
{
Controllable::loadJSONDataInternal(data);
if (!saveValueOnly) setRange(data.getProperty("minValue", minimumValue), data.getProperty("maxValue", maximumValue));
if (data.getDynamicObject()->hasProperty("value")) setValue(data.getProperty("value", 0));
if (data.getDynamicObject()->hasProperty("controlMode")) setControlMode((ControlMode)(int)data.getProperty("controlMode", MANUAL));
if (data.getDynamicObject()->hasProperty("expression")) setControlExpression(data.getProperty("expression", ""));
if (data.getDynamicObject()->hasProperty("editable")) isEditable = data.getProperty("editable", true);
}
示例2: nativeFunction
var HiseJavascriptEngine::RootObject::FunctionCall::invokeFunction(const Scope& s, const var& function, const var& thisObject) const
{
s.checkTimeOut(location);
var argVars[16];
const int thisNumArgs = jmin<int>(16, arguments.size());
for (int i = 0; i < thisNumArgs; i++)
{
argVars[i] = arguments.getUnchecked(i)->getResult(s);
}
const var::NativeFunctionArgs args(thisObject, argVars, thisNumArgs);
if (var::NativeFunction nativeFunction = function.getNativeFunction())
return nativeFunction(args);
if (FunctionObject* fo = dynamic_cast<FunctionObject*> (function.getObject()))
return fo->invoke(s, args);
if (DotOperator* dot = dynamic_cast<DotOperator*> (object.get()))
if (DynamicObject* o = thisObject.getDynamicObject())
if (o->hasMethod(dot->child)) // allow an overridden DynamicObject::invokeMethod to accept a method call.
return o->invokeMethod(dot->child, args);
location.throwError("This expression is not a function!"); return var();
}
示例3: 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);
}
}
示例4: loadJSONDataInternal
void ModuleRouter::loadJSONDataInternal(var data)
{
BaseItem::loadJSONDataInternal(data);
setSourceModule(ModuleManager::getInstance()->getItemWithName(data.getProperty("sourceModule", "")));
setDestModule(ModuleManager::getInstance()->getItemWithName(data.getProperty("destModule", "")));
if (data.getDynamicObject()->hasProperty("sourceValues")) sourceValues.loadItemsData(data.getProperty("sourceValues", var()));
}
示例5: doInvoke
HRESULT doInvoke (const var& v,
DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS* pDispParams,
VARIANT* pVarResult, EXCEPINFO* pExcepInfo, UINT* puArgErr)
{
const Identifier memberId (getStringFromDISPID (dispIdMember));
DynamicObject* const object = v.getDynamicObject();
if (memberId.toString().isEmpty() || object == nullptr)
return DISP_E_MEMBERNOTFOUND;
if ((wFlags & DISPATCH_METHOD) != 0)
{
if (! object->hasMethod (memberId))
return DISP_E_MEMBERNOTFOUND;
const int numArgs = pDispParams == nullptr ? 0 : pDispParams->cArgs;
var result;
if (numArgs == 0)
{
result = v.call (memberId);
}
else
{
Array<var> args;
for (int j = numArgs; --j >= 0;)
args.add (variantTojuceVar (pDispParams->rgvarg[j]));
result = v.invoke (memberId, numArgs == 0 ? 0 : args.getRawDataPointer(), numArgs);
}
if (pVarResult != nullptr)
juceVarToVariant (result, *pVarResult);
return S_OK;
}
else if ((wFlags & DISPATCH_PROPERTYGET) != 0)
{
if (! object->hasProperty (memberId))
return DISP_E_MEMBERNOTFOUND;
if (pVarResult != nullptr)
{
juceVarToVariant (object->getProperty (memberId), *pVarResult);
return S_OK;
}
}
else if ((wFlags & DISPATCH_PROPERTYPUT) != 0)
{
if (pDispParams != nullptr && pDispParams->cArgs > 0)
{
object->setProperty (memberId, variantTojuceVar (pDispParams->rgvarg[0]));
return S_OK;
}
}
return DISP_E_MEMBERNOTFOUND;
}
示例6: clone
var clone (const var& original) const override
{
if (auto* d = original.getDynamicObject())
return d->clone().get();
jassertfalse; // can only clone DynamicObjects!
return {};
}
示例7: 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);
}
示例8: getLicense
String LoadSave::getLicense(var state) {
if (!state.isObject())
return "";
DynamicObject* object_state = state.getDynamicObject();
NamedValueSet properties = object_state->getProperties();
if (properties.contains("license"))
return properties["license"];
return "";
}
示例9: loadJSONDataInternal
void AudioModule::loadJSONDataInternal(var data)
{
Module::loadJSONDataInternal(data);
if (data.getDynamicObject()->hasProperty("audioSettings"))
{
ScopedPointer<XmlElement> elem = XmlDocument::parse(data.getProperty("audioSettings", ""));
am.initialise(2, 2, elem, true);
}
}
示例10: var
void PresetManager::Preset::loadJSONData(var data)
{
Array<var> * pvDatas = data.getDynamicObject()->getProperty("values").getArray();
for (auto &pvData : *pvDatas)
{
addPresetValue(pvData.getProperty("controlAddress", var()),pvData.getProperty("value",var()));
}
}
示例11: loadJSONData
void PresetManager::loadJSONData(var data)
{
clear();
Array<var> * presetDatas = data.getDynamicObject()->getProperty("presets").getArray();
if(presetDatas==nullptr){
//DBG("no preset Loaded");
return;
}
for (auto &presetData : *presetDatas)
{
Preset * pre = new Preset(presetData.getDynamicObject()->getProperty("name"), presetData.getDynamicObject()->getProperty("filter"));
pre->loadJSONData(presetData);
presets.add(pre);
}
}
示例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);
}