MCPcopy Create free account
hub / github.com/RomanKubiak/ctrlr / setProgram

Method setProgram

Source/Core/CtrlrPanel/CtrlrPanel.cpp:862–928  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

860}
861
862void CtrlrPanel::setProgram(ValueTree programTree, const bool sendSnapshotNow)
863{
864 _DBG("CtrlrPanel::setProgram");
865
866 ValueTree program;
867
868 if (programTree.hasType(Ids::panelState))
869 {
870 program = programTree;
871 }
872 else
873 {
874 if (programTree.getChildWithName(Ids::panelState).isValid())
875 {
876 program = programTree.getChildWithName(Ids::panelState);
877 }
878 }
879
880 setProgramState (true);
881
882 if (program.isValid())
883 {
884 for (int i=0; i<program.getNumChildren(); i++)
885 {
886 if (program.getChild(i).hasType(Ids::value))
887 {
888 CtrlrModulator *m = getModulator (program.getChild(i).getProperty(Ids::name));
889 if (m)
890 {
891 m->setRestoreState (true);
892 m->getProcessor().setValueGeneric (CtrlrModulatorValue(program.getChild(i).getProperty(Ids::value), CtrlrModulatorValue::changedByProgram), true);
893 if (m->getComponent())
894 {
895 m->getComponent()->setComponentValue (program.getChild(i).getProperty(Ids::value), false);
896 }
897 m->getProcessor().handleUpdateNowIfNeeded();
898 m->setRestoreState (false);
899 }
900 }
901
902 if (program.getChild(i).hasType(Ids::panelCustomData))
903 {
904 setCustomData(program.getChild(i));
905 }
906 }
907
908 if ((bool)getProperty (Ids::panelMidiSnapshotAfterProgramChange) == true)
909 {
910 snapshot.sendSnapshot();
911 }
912
913 if (luaPanelProgramChangedCbk && !luaPanelProgramChangedCbk.wasObjectDeleted())
914 {
915 if (luaPanelProgramChangedCbk->isValid())
916 {
917 getCtrlrLuaManager().getMethodManager().call (luaPanelProgramChangedCbk);
918 }
919 }

Callers 5

restoreInstanceStateMethod · 0.45
loadProgramOntoBlockMethod · 0.45
setLEDProgramFunction · 0.45
BlockComponentFunction · 0.45
setLEDProgramFunction · 0.45

Calls 13

CtrlrModulatorValueClass · 0.85
getNumChildrenMethod · 0.80
setValueGenericMethod · 0.80
isValidMethod · 0.45
getChildMethod · 0.45
getPropertyMethod · 0.45
setRestoreStateMethod · 0.45
getProcessorMethod · 0.45
getComponentMethod · 0.45
setComponentValueMethod · 0.45
sendSnapshotMethod · 0.45

Tested by

no test coverage detected