Exemple #1
0
void CtrlrPanel::setProgram(ValueTree programTree, const bool sendSnapshotNow)
{
	ValueTree program;

	if (programTree.hasType(Ids::panelState))
	{
		program = programTree;
	}
	else
	{
		if (programTree.getChildWithName(Ids::panelState).isValid())
		{
			program = programTree.getChildWithName(Ids::panelState);
		}
	}

	setProgramState (true);
	if (program.isValid())
	{
		for (int i=0; i<program.getNumChildren(); i++)
		{
			if (program.getChild(i).hasType(Ids::value))
			{
				CtrlrModulator *m = getModulator (program.getChild(i).getProperty(Ids::name));
				if (m)
				{
					m->setRestoreState (true);
					m->getProcessor().setValueFromGUI (program.getChild(i).getProperty(Ids::value), true);
					if (m->getComponent())
					{
						m->getComponent()->setComponentValue (program.getChild(i).getProperty(Ids::value), false);
					}
					m->getProcessor().handleUpdateNowIfNeeded();
					m->setRestoreState (false);
				}
			}
		}

		if ((bool)getProperty (Ids::panelMidiSnapshotAfterProgramChange) == true)
		{
			snapshot.sendSnapshot();
		}

		if (luaPanelProgramChangedCbk && !luaPanelProgramChangedCbk.wasObjectDeleted())
		{
			if (luaPanelProgramChangedCbk->isValid())
			{
				getCtrlrLuaManager().getMethodManager().call (luaPanelProgramChangedCbk);
			}
		}
	}

	setProgramState (false);

	if (sendSnapshotNow)
	{
		_DBG("CtrlrPanel::setProgram sendSnapshotNow");
		sendSnapshot();
	}
}
Exemple #2
0
float CtrlrProcessor::getParameter (int index)
{
	CtrlrModulator *m = ctrlrManager->getModulatorByVstIndex (index);
	if (m)
	{
		return (m->getProcessor().getValueForHost());
	}
	else
	{
		return 0.0f;
	}
}
Exemple #3
0
void CtrlrProcessor::setParameter (int index, float newValue)
{
	CtrlrModulator *m = ctrlrManager->getModulatorByVstIndex (index);
	if (m == nullptr)
	{
		return;
	}
	else if (newValue > 1.0f || newValue < 0.000000f)
	{
		return;
	}
	else
	{
		return (m->getProcessor().setValueFromHost(newValue));
	}
}