public Settings() { EnamlData data = EnamlData.loadFromFile("Audimat.cfg"); string version = data.getStringValue("version", VERSION); rackHeight = data.getIntValue("global-settings.rack-window-height", VSTPanel.PANELHEIGHT); rackPosX = data.getIntValue("global-settings.rack-window-pos.x", 100); rackPosY = data.getIntValue("global-settings.rack-window-pos.y", 100); keyWndPosX = data.getIntValue("global-settings.keyboard-window-pos.x", 200); keyWndPosY = data.getIntValue("global-settings.keyboard-window-pos.y", 200); }
//--------------------------------------------------------------------- public static VSTRig loadFromFile(String path, ControlPanel controlPanel) { VSTRig rig = null; EnamlData rigData = EnamlData.loadFromFile(path); //load data from file if (rigData != null) { rig = new VSTRig(controlPanel); //load plugins List <String> plugs = rigData.getPathKeys("plugin-list"); Dictionary <String, VSTPanel> plugList = new Dictionary <string, VSTPanel>(); //temp dict for matching plugins to patches foreach (String plug in plugs) { String plugPath = rigData.getStringValue("plugin-list." + plug + ".path", ""); String plugAudioOut = rigData.getStringValue("plugin-list." + plug + ".audio-out", ""); String plugMidiIn = rigData.getStringValue("plugin-list." + plug + ".midi-in", ""); VSTPanel panel = rig.addPanel(plugPath); //panel.plugin.setAudioOut(plugAudioOut); panel.setMidiIn(plugMidiIn); plugList[plug] = panel; } //load patches List <String> pats = rigData.getPathKeys("patch-list"); foreach (String pat in pats) { String patchName = rigData.getStringValue("patch-list." + pat + ".name", ""); Patch patch = new Patch(patchName); foreach (String plug in plugs) { int patnum = rigData.getIntValue("patch-list." + pat + "." + plug, 0); patch.addPanel(plugList[plug], patnum); } rig.patches.Add(patch); } rig.setCurrentPatch(0); } return(rig); }
//- reading expressions ------------------------------------- public ExprNode loadExpression(string path) { ExprNode enode = null; string exprtype = oilcan.getStringValue(path + ".type", ""); switch (exprtype) { case "ident-expr": OILNode idsym = loadSymbolRef(path + ".ref"); enode = new IdentExprNode(idsym); break; case "int-const": int intval = oilcan.getIntValue(path + ".val", 0); enode = new IntConstant(intval); break; case "float-const": double dblval = oilcan.getFloatValue(path + ".val", 0.0); enode = new FloatConstant(dblval); break; case "arith-expr": enode = loadArithmeticExpression(path); break; case "comp-expr": enode = loadComparisionExpression(path); break; case "assign-expr": enode = loadAssignmentExpression(path); break; default: break; } return(enode); }