From: Christian S. <ch...@us...> - 2007-05-28 23:00:43
|
Update of /cvsroot/nmedit/nmedit/libs/nordmodular/src/net/sf/nmedit/jpatch/clavia/nordmodular/parser In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv27387/nordmodular/src/net/sf/nmedit/jpatch/clavia/nordmodular/parser Modified Files: PatchBuilder.java PatchExporter.java Added Files: Helper.java Log Message: - adaption of changes in patch library - simplifications --- NEW FILE: Helper.java --- /* Copyright (C) 2006 Christian Schneider * * This file is part of Nomad. * * Nomad is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * Nomad is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Nomad; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ package net.sf.nmedit.jpatch.clavia.nordmodular.parser; import java.util.HashMap; import java.util.Map; import net.sf.nmedit.jpatch.PComponent; import net.sf.nmedit.jpatch.PDescriptor; import net.sf.nmedit.jpatch.PModule; import net.sf.nmedit.jpatch.PParameter; import net.sf.nmedit.jpatch.PParameterDescriptor; import net.sf.nmedit.jpatch.PRuntimeException; public class Helper { public static String pclass(PParameter parameter) { return pclass(parameter.getDescriptor()); } public static String pclass(PParameterDescriptor parameter) { String clazz = parameter.getStringAttribute("class"); if (clazz == null) throw new PRuntimeException("parameter has no attribute 'class':"+parameter); return clazz; } public static int index(PComponent component) { return index(component.getDescriptor()); } public static int index(PDescriptor component) { int index = component.getIntAttribute("index", -1); if (index<0) throw new PRuntimeException("attribute index missing: "+index); return index; } public static PParameter getParameter(PModule module, String paramClass, int index) { Object o = getParameterClassMap(module, paramClass).get(index); if (o == null || (! (o instanceof PParameter))) throw new PRuntimeException("parameter[class="+paramClass+",index="+index+"] not found in "+module); return (PParameter) o; } public static int getParameterClassCount(PModule module, String name) { return getParameterClassMap(module, name).size(); } public static Map getParameterClassMap(PModule module, String name) { String key = PDescriptor.CACHE_KEY_PREFIX+"parameter-map="+name; Object value = module.getAttribute(key); if (value instanceof Map) return (Map) value; Map map = new HashMap<Object, Object>(module.getParameterCount()/2); for (int i=module.getParameterCount()-1;i>=0;i--) { PParameter p = module.getParameter(i); if (name.equals(p.getAttribute("class"))) map.put(index(p), p); } module.setAttribute(key, map); return map; } public static int[] paramValues(PModule module, String name) { Map<Object, Object> map = getParameterClassMap(module, name); int[] data = new int[map.size()]; for (int i=data.length-1;i>=0;i--) { data[i]=((PParameter)map.get(i)).getValue(); } return data; } } Index: PatchBuilder.java =================================================================== RCS file: /cvsroot/nmedit/nmedit/libs/nordmodular/src/net/sf/nmedit/jpatch/clavia/nordmodular/parser/PatchBuilder.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** PatchBuilder.java 24 Apr 2007 19:46:00 -0000 1.2 --- PatchBuilder.java 28 May 2007 23:00:22 -0000 1.3 *************** *** 23,45 **** package net.sf.nmedit.jpatch.clavia.nordmodular.parser; import java.util.NoSuchElementException; - import net.sf.nmedit.jpatch.ConnectorDescriptor; import net.sf.nmedit.jpatch.InvalidDescriptorException; ! import net.sf.nmedit.jpatch.Parameter; import net.sf.nmedit.jpatch.clavia.nordmodular.Header; import net.sf.nmedit.jpatch.clavia.nordmodular.Knob; import net.sf.nmedit.jpatch.clavia.nordmodular.MidiController; import net.sf.nmedit.jpatch.clavia.nordmodular.MidiControllerSet; - import net.sf.nmedit.jpatch.clavia.nordmodular.Morph; - import net.sf.nmedit.jpatch.clavia.nordmodular.MorphSection; - import net.sf.nmedit.jpatch.clavia.nordmodular.NMConnector; - import net.sf.nmedit.jpatch.clavia.nordmodular.NMModule; - import net.sf.nmedit.jpatch.clavia.nordmodular.NMParameter; import net.sf.nmedit.jpatch.clavia.nordmodular.NMPatch; import net.sf.nmedit.jpatch.clavia.nordmodular.Note; import net.sf.nmedit.jpatch.clavia.nordmodular.Signal; import net.sf.nmedit.jpatch.clavia.nordmodular.VoiceArea; - import net.sf.nmedit.jpatch.spec.ModuleDescriptions; public class PatchBuilder implements PContentHandler --- 23,43 ---- package net.sf.nmedit.jpatch.clavia.nordmodular.parser; + import java.util.Map; import java.util.NoSuchElementException; import net.sf.nmedit.jpatch.InvalidDescriptorException; ! import net.sf.nmedit.jpatch.ModuleDescriptions; ! import net.sf.nmedit.jpatch.PConnector; ! import net.sf.nmedit.jpatch.PModule; ! import net.sf.nmedit.jpatch.PParameter; import net.sf.nmedit.jpatch.clavia.nordmodular.Header; import net.sf.nmedit.jpatch.clavia.nordmodular.Knob; import net.sf.nmedit.jpatch.clavia.nordmodular.MidiController; import net.sf.nmedit.jpatch.clavia.nordmodular.MidiControllerSet; import net.sf.nmedit.jpatch.clavia.nordmodular.NMPatch; import net.sf.nmedit.jpatch.clavia.nordmodular.Note; + import net.sf.nmedit.jpatch.clavia.nordmodular.PNMMorphSection; import net.sf.nmedit.jpatch.clavia.nordmodular.Signal; import net.sf.nmedit.jpatch.clavia.nordmodular.VoiceArea; public class PatchBuilder implements PContentHandler *************** *** 145,153 **** public void moduleDump( int[] record ) throws ParseException { ! NMModule module; int mindex = record[1]; try { ! module = voiceArea.createModule( mindex ); } catch (InvalidDescriptorException e) --- 143,151 ---- public void moduleDump( int[] record ) throws ParseException { ! PModule module; int mindex = record[1]; try { ! module = voiceArea.createModule(modules.getModuleById("m"+mindex)); } catch (InvalidDescriptorException e) *************** *** 155,166 **** throw new ParseException(e); } ! module.setIndex(record[0]); ! module.setLocation(record[2], record[3]); ! if (!voiceArea.add(module)) { String e = module+" rejected in "+voiceArea; ! NMModule prev = voiceArea.getModule(mindex); if (prev != null) e+=" index reserved by "+prev; --- 153,163 ---- throw new ParseException(e); } ! module.setInternalLocation(record[2], record[3]); ! if (!voiceArea.add(record[0], module)) { String e = module+" rejected in "+voiceArea; ! PModule prev = voiceArea.getModule(mindex); if (prev != null) e+=" index reserved by "+prev; *************** *** 186,192 **** } ! private NMConnector getConnector(int mod, int cindex, int ctype) throws ParseException { ! NMModule module = voiceArea.getModule(mod); if (module == null) { --- 183,189 ---- } ! private PConnector getConnector(int mod, int cindex, int ctype) throws ParseException { ! PModule module = voiceArea.getModule(mod); if (module == null) { *************** *** 195,221 **** } boolean output = intToOutput(ctype); ! ConnectorDescriptor cd = module.getDescriptor().getConnector(cindex, output); ! if (cd == null) { ! for (int i=module.getDescriptor().getConnectorCount()-1;i>=0;i--) { ! System.out.println(module.getDescriptor().getConnector(i)); } - - emiterror("Connector[index="+cindex - +",output="+output+"("+ctype+")] does not exist in "+module); - return null; - } - - NMConnector c = null; - try - { - c = module.getConnector(cd); - } - catch (InvalidDescriptorException e) - { - emiterror(e.getMessage()); } ! return c; } --- 192,207 ---- } boolean output = intToOutput(ctype); ! ! for (int i=module.getConnectorCount()-1;i>=0;i--) { ! PConnector tmp = module.getConnector(i); ! if (cindex==tmp.getIntAttribute("index",-1) && tmp.isOutput()==output) { ! return tmp; } } ! emiterror("Connector[index="+cindex ! +",output="+output+"("+ctype+")] does not exist in "+module); ! return null; } *************** *** 223,228 **** { Signal signal = Signal.bySignalID(record[0]); ! NMConnector cdst = getConnector(record[1], record[2], record[3]); ! NMConnector csrc = getConnector(record[4], record[5], record[6]); if (cdst == null || csrc == null) --- 209,214 ---- { Signal signal = Signal.bySignalID(record[0]); ! PConnector cdst = getConnector(record[1], record[2], record[3]); ! PConnector csrc = getConnector(record[4], record[5], record[6]); if (cdst == null || csrc == null) *************** *** 231,239 **** } ! if (cdst.isConnectedWith(csrc)) emitwarning("Already connected: "+csrc+", "+cdst); else { ! if (csrc.connectWith(cdst/*, signal*/)==null) // TODO signal emiterror("Could not connect: "+csrc+", "+cdst); } --- 217,225 ---- } ! if (cdst.isConnected(csrc)) emitwarning("Already connected: "+csrc+", "+cdst); else { ! if (!csrc.connect(cdst/*, signal*/)) // TODO signal emiterror("Could not connect: "+csrc+", "+cdst); } *************** *** 242,271 **** public void parameterDump( int[] record ) throws ParseException { ! NMModule module = voiceArea.getModule(record[0]); ! if (module.getModuleId()!=record[1]) emiterror(module+" has different id than "+record[1]+" in ParameterDump"); ! if (record[2]!=module.getParamCount()) ! emiterror("invalid number of parameters "+record[2]+" expected "+module.getParamCount()); ! for (int i=0;i<module.getParamCount();i++) ! module.getParameter(i).setValue(record[3+i]); } public void customDump( int[] record ) throws ParseException { ! NMModule module = voiceArea.getModule(record[0]); ! if (record[1]!=module.getCustomCount()) ! emiterror("invalid number of custom-parameters "+record[2]+" expected "+module.getParamCount()); ! for (int i=0;i<module.getCustomCount();i++) ! module.getCustom(i).setValue(record[2+i]); } public void keyboardAssignment( int[] record ) throws ParseException { ! MorphSection morphs = patch.getMorphSection(); for (int i=0;i<4;i++) --- 228,267 ---- public void parameterDump( int[] record ) throws ParseException { ! PModule module = voiceArea.getModule(record[0]); ! if (module.getIntAttribute("index", -1)!=record[1]) emiterror(module+" has different id than "+record[1]+" in ParameterDump"); + + Map map = Helper.getParameterClassMap(module, "parameter"); + int paramClassCount = map.size(); ! if (record[2]!=paramClassCount) ! emiterror("invalid number of parameters[class='parameter'] "+record[2]+" expected "+paramClassCount); ! for (int i=0;i<paramClassCount;i++) ! { ! ((PParameter)map.get(i)).setValue(record[3+i]); ! } } public void customDump( int[] record ) throws ParseException { ! PModule module = voiceArea.getModule(record[0]); ! ! Map map = Helper.getParameterClassMap(module, "custom"); ! int customCount = map.size(); ! if (record[1]!=customCount) ! emiterror("invalid number of parameters[class=custom] "+record[2]+" expected "+customCount); ! for (int i=0;i<customCount;i++) ! { ! ((PParameter)map.get(i)).setValue(record[2+i]); ! } } public void keyboardAssignment( int[] record ) throws ParseException { ! PNMMorphSection morphs = patch.getMorphSection(); for (int i=0;i<4;i++) *************** *** 273,277 **** int value = record[i]; ! Parameter m = morphs.getMorph(i); if (value>=0 && value<=2) m.setValue(value); --- 269,273 ---- int value = record[i]; ! PParameter m = morphs.getMorph(i); if (value>=0 && value<=2) m.setValue(value); *************** *** 288,292 **** int modIndex = record[1]; int paramIndex = record[2]; ! Parameter p; if (va == null) { --- 284,288 ---- int modIndex = record[1]; int paramIndex = record[2]; ! PParameter p; if (va == null) { *************** *** 295,299 **** else { ! NMModule module = va.getModule(modIndex); p = module.getParameter(paramIndex); } --- 291,295 ---- else { ! PModule module = va.getModule(modIndex); p = module.getParameter(paramIndex); } *************** *** 304,308 **** public void morphMapDumpProlog( int[] record ) throws ParseException { ! MorphSection morphs = patch.getMorphSection(); for (int i=0;i<4;i++) --- 300,304 ---- public void morphMapDumpProlog( int[] record ) throws ParseException { ! PNMMorphSection morphs = patch.getMorphSection(); for (int i=0;i<4;i++) *************** *** 310,314 **** int value = record[i]; ! Parameter m = morphs.getMorph(i); if (value>=m.getMinValue() && value<=m.getMaxValue()) --- 306,310 ---- int value = record[i]; ! PParameter m = morphs.getMorph(i); if (value>=m.getMinValue() && value<=m.getMaxValue()) *************** *** 323,331 **** { VoiceArea voiceArea = getVoiceArea(record[0]); ! NMModule module = voiceArea.getModule(record[1]); ! NMParameter p = module.getParameter(record[2]); ! Parameter morphRange = module.getParameter(record[2]); ! Morph morph = patch.getMorphSection().getMorph(record[3]); ! morph.add(p); morphRange.setValue(record[4]); } --- 319,326 ---- { VoiceArea voiceArea = getVoiceArea(record[0]); ! PModule module = voiceArea.getModule(record[1]); ! PParameter p = module.getParameter(record[2]); ! PParameter morphRange = module.getParameter(record[2]); ! patch.getMorphSection().assign(record[3], p); morphRange.setValue(record[4]); } *************** *** 341,345 **** MidiController cc = mcset.getByMC(record[3]); ! Parameter p = null; int section = record[0]; --- 336,340 ---- MidiController cc = mcset.getByMC(record[3]); ! PParameter p = null; int section = record[0]; *************** *** 349,355 **** try { ! NMModule module = patch.getCommonVoiceArea().getModule(record[1]); ! if (pindex<0 || pindex>=module.getParamCount()) emiterror(module+" has no parameter[index="+pindex+"]"); else --- 344,350 ---- try { ! PModule module = patch.getCommonVoiceArea().getModule(record[1]); ! if (pindex<0 || pindex>=Helper.getParameterClassCount(module, "parameter")) emiterror(module+" has no parameter[index="+pindex+"]"); else *************** *** 365,370 **** try { ! NMModule module = patch.getPolyVoiceArea().getModule(record[1]); ! if (pindex<0 || pindex>=module.getParamCount()) emiterror(module+" has no parameter[index="+pindex+"]"); else --- 360,365 ---- try { ! PModule module = patch.getPolyVoiceArea().getModule(record[1]); ! if (pindex<0 || pindex>=Helper.getParameterClassCount(module, "parameter")) emiterror(module+" has no parameter[index="+pindex+"]"); else *************** *** 388,392 **** throws ParseException { ! NMModule module = null; try --- 383,387 ---- throws ParseException { ! PModule module = null; try Index: PatchExporter.java =================================================================== RCS file: /cvsroot/nmedit/nmedit/libs/nordmodular/src/net/sf/nmedit/jpatch/clavia/nordmodular/parser/PatchExporter.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** PatchExporter.java 24 Apr 2007 19:46:00 -0000 1.2 --- PatchExporter.java 28 May 2007 23:00:22 -0000 1.3 *************** *** 29,48 **** import java.util.List; ! import net.sf.nmedit.jpatch.Connection; ! import net.sf.nmedit.jpatch.Connector; import net.sf.nmedit.jpatch.InvalidDescriptorException; ! import net.sf.nmedit.jpatch.Module; ! import net.sf.nmedit.jpatch.Parameter; import net.sf.nmedit.jpatch.clavia.nordmodular.Knob; import net.sf.nmedit.jpatch.clavia.nordmodular.MidiController; - import net.sf.nmedit.jpatch.clavia.nordmodular.Morph; - import net.sf.nmedit.jpatch.clavia.nordmodular.MorphSection; - import net.sf.nmedit.jpatch.clavia.nordmodular.NMConnector; - import net.sf.nmedit.jpatch.clavia.nordmodular.NMModule; - import net.sf.nmedit.jpatch.clavia.nordmodular.NMParameter; import net.sf.nmedit.jpatch.clavia.nordmodular.NMPatch; import net.sf.nmedit.jpatch.clavia.nordmodular.Note; import net.sf.nmedit.jpatch.clavia.nordmodular.NoteSet; import net.sf.nmedit.jpatch.clavia.nordmodular.VoiceArea; public class PatchExporter --- 29,45 ---- import java.util.List; ! import net.sf.nmedit.jpatch.PConnection; ! import net.sf.nmedit.jpatch.PConnector; import net.sf.nmedit.jpatch.InvalidDescriptorException; ! import net.sf.nmedit.jpatch.PModule; import net.sf.nmedit.jpatch.clavia.nordmodular.Knob; import net.sf.nmedit.jpatch.clavia.nordmodular.MidiController; import net.sf.nmedit.jpatch.clavia.nordmodular.NMPatch; import net.sf.nmedit.jpatch.clavia.nordmodular.Note; import net.sf.nmedit.jpatch.clavia.nordmodular.NoteSet; + import net.sf.nmedit.jpatch.clavia.nordmodular.PNMMorphSection; import net.sf.nmedit.jpatch.clavia.nordmodular.VoiceArea; + import net.sf.nmedit.jpatch.clavia.nordmodular.PNMMorphSection.Assignments; + import net.sf.nmedit.jpatch.PParameter; public class PatchExporter *************** *** 98,102 **** // first : morph group ! MorphSection morphs = p.getMorphSection(); int size = 0; --- 95,99 ---- // first : morph group ! PNMMorphSection morphs = p.getMorphSection(); int size = 0; *************** *** 105,109 **** for (int i=0;i<morphs.getMorphCount();i++) { ! size+= morphs.getMorph(i).getAssignmentsCount(); } } --- 102,106 ---- for (int i=0;i<morphs.getMorphCount();i++) { ! size+= morphs.getAssignments(i).size(); } } *************** *** 132,147 **** for (int i=0;i<morphs.getMorphCount();i++) { ! Morph morph = morphs.getMorph(i); ! if (morph.getAssignmentsCount()>0) { ! for (NMParameter pp : morph.getAssignments()) { ! int pindex = pp.getDescriptor().getIndex(); ! NMModule m = pp.getOwner(); ! Parameter morphRange; try { ! morphRange = m.getParameter(m.getDescriptor().getParameter( pindex, "morph" )); } catch (InvalidDescriptorException e) --- 129,146 ---- for (int i=0;i<morphs.getMorphCount();i++) { ! Assignments assignments = morphs.getAssignments(i); ! PParameter morph = morphs.getMorph(i); ! if (assignments.size()>0) { ! for (PParameter pp : assignments) { ! int pindex = Helper.index(pp); ! ! PModule m = pp.getParentComponent(); ! PParameter morphRange; try { ! morphRange = Helper.getParameter(m, "morph", pindex); } catch (InvalidDescriptorException e) *************** *** 150,157 **** } ! record[0] = vaId(m.getParent()); ! record[1] = m.getIndex(); record[2] = pindex; ! record[3] = morph.getDescriptor().getMorphId(); record[4] = morphRange.getValue(); } --- 149,156 ---- } ! record[0] = m.getParentComponent().getComponentIndex(); ! record[1] = Helper.index(m); record[2] = pindex; ! record[3] = i; record[4] = morphRange.getValue(); } *************** *** 163,167 **** { // KeyboardAssignment ! MorphSection morphs = p.getMorphSection(); int [] record = getRecord(morphs.getMorphCount()); boolean writeKA = false; --- 162,166 ---- { // KeyboardAssignment ! PNMMorphSection morphs = p.getMorphSection(); int [] record = getRecord(morphs.getMorphCount()); boolean writeKA = false; *************** *** 201,213 **** } ! String pclass = k.getParameter().getDescriptor().getParameterClass(); if ("parameter".equals(pclass)) { ! NMParameter pp = (NMParameter) k.getParameter(); ! NMModule m = pp.getOwner(); ! record[0] = vaId(m.getParent()); ! record[1] = m.getIndex(); ! record[2] = pp.getDescriptor().getIndex(); record[3] = k.getID(); handler.knobMapDump(record); --- 200,212 ---- } ! String pclass = Helper.pclass(k.getParameter()); if ("parameter".equals(pclass)) { ! PParameter pp = k.getParameter(); ! PModule m = pp.getParentComponent(); ! record[0] = m.getParentComponent().getComponentIndex(); ! record[1] = Helper.index(m); ! record[2] = Helper.index(pp); record[3] = k.getID(); handler.knobMapDump(record); *************** *** 215,222 **** else if ("morph".equals(pclass)) { ! Morph morph = (Morph) k.getParameter(); record[0] = 2; record[1] = 1; // module index = const(1) ! record[2] = morph.getDescriptor().getMorphId(); record[3] = k.getID(); handler.knobMapDump(record); --- 214,221 ---- else if ("morph".equals(pclass)) { ! PParameter morph = k.getParameter(); record[0] = 2; record[1] = 1; // module index = const(1) ! record[2] = Helper.index(morph); record[3] = k.getID(); handler.knobMapDump(record); *************** *** 249,262 **** } ! String pclass = mc.getParameter().getDescriptor().getParameterClass(); if ("parameter".equals(pclass)) { ! NMParameter pp = (NMParameter) mc.getParameter(); ! NMModule m = pp.getOwner(); ! record[0] = vaId(m.getParent()); ! record[1] = m.getIndex(); ! record[2] = pp.getDescriptor().getIndex(); record[3] = mc.getControlId(); --- 248,261 ---- } ! String pclass = Helper.pclass(mc.getParameter()); if ("parameter".equals(pclass)) { ! PParameter pp = mc.getParameter(); ! PModule m = pp.getParentComponent(); ! record[0] = m.getParentComponent().getComponentIndex(); ! record[1] = Helper.index(m); ! record[2] = Helper.index(pp); record[3] = mc.getControlId(); *************** *** 265,273 **** else if ("morph".equals(pclass)) { ! Morph morph = (Morph) mc.getParameter(); record[0] = 2; record[1] = 1; // module index = const(1) ! record[2] = morph.getDescriptor().getMorphId(); // morph index [0..3] record[3] = mc.getControlId(); --- 264,272 ---- else if ("morph".equals(pclass)) { ! PParameter morph = mc.getParameter(); record[0] = 2; record[1] = 1; // module index = const(1) ! record[2] = Helper.index(morph); // morph index [0..3] record[3] = mc.getControlId(); *************** *** 313,328 **** { handler.beginSection(PParser.IPARAMETERDUMP, vaId(voiceArea)); ! for (Module m : voiceArea) { ! NMModule nm = (NMModule) m; if (m.getParameterCount()>0) { ! int[] record = getRecord(3+nm.getParamCount()); ! record[0] = nm.getIndex(); ! record[1] = nm.getModuleId(); ! record[2] = nm.getParamCount(); ! for (int i=0;i<nm.getParamCount();i++) ! record[3+i]=nm.getParameter(i).getValue(); handler.parameterDump(record); } --- 312,328 ---- { handler.beginSection(PParser.IPARAMETERDUMP, vaId(voiceArea)); ! for (PModule m : voiceArea) { ! PModule nm = (PModule) m; if (m.getParameterCount()>0) { ! int pcount = Helper.getParameterClassCount(nm, "parameter"); ! int[] record = getRecord(3+pcount); ! record[0] = nm.getComponentIndex(); // index in module container ! record[1] = Helper.index(nm); // module id ! record[2] = pcount; ! for (int i=0;i<pcount;i++) ! record[3+i]=Helper.getParameter(nm, "parameter", i).getValue(); handler.parameterDump(record); } *************** *** 334,348 **** { handler.beginSection(PParser.ICUSTOMDUMP, vaId(voiceArea)); ! for (Module m : voiceArea) { ! NMModule nm = (NMModule) m; ! if (nm.getCustomCount()>0) { ! int[] record = getRecord(2+nm.getCustomCount()); ! record[0] = nm.getIndex(); ! record[1] = nm.getCustomCount(); ! for (int i=0;i<nm.getCustomCount();i++) ! record[2+i]=nm.getCustom(i).getValue(); handler.customDump(record); } --- 334,349 ---- { handler.beginSection(PParser.ICUSTOMDUMP, vaId(voiceArea)); ! for (PModule m : voiceArea) { ! PModule nm = (PModule) m; ! int ccount = Helper.getParameterClassCount(nm, "custom"); ! if (ccount>0) { ! int[] record = getRecord(2+ccount); ! record[0] = nm.getComponentIndex(); // index in module container ! record[1] = ccount; ! for (int i=0;i<ccount;i++) ! record[2+i]=Helper.getParameter(nm, "custom", i).getValue(); handler.customDump(record); } *************** *** 355,365 **** handler.beginSection(PParser.IMODULEDUMP, vaId(voiceArea)); int[] record = getRecord(4); ! for (Module mm : voiceArea) { ! NMModule m = (NMModule)mm; ! record[0] = m.getIndex(); ! record[1] = m.getID(); ! record[2] = m.getX(); ! record[3] = m.getY(); handler.moduleDump(record); } --- 356,366 ---- handler.beginSection(PParser.IMODULEDUMP, vaId(voiceArea)); int[] record = getRecord(4); ! for (PModule mm : voiceArea) { ! PModule m = (PModule)mm; ! record[0] = m.getComponentIndex(); ! record[1] = Helper.index(m); ! record[2] = m.getInternalX(); ! record[3] = m.getInternalY(); handler.moduleDump(record); } *************** *** 370,400 **** { handler.beginSection(PParser.INAMEDUMP, vaId(voiceArea)); ! for (Module mm : voiceArea) { ! NMModule m = (NMModule)mm; ! handler.moduleNameDump(m.getIndex(), m.getTitle()); } handler.endSection(PParser.INAMEDUMP); } ! private void getConnectionRecord(int[] record, Connection c) { ! Connector dst = c.getDestination(); ! Connector src = c.getSource(); // check order if (dst.isOutput()) { ! Connector tmp = dst; dst = src; src = tmp; } ! record[0] = ((NMConnector)src).getConnectionColor().getSignalID(); ! record[1] = ((NMModule)dst.getOwner()).getIndex(); ! record[2] = dst.getDescriptor().getIndex(); record[3] = 0; ! record[4] = ((NMModule)src.getOwner()).getIndex(); ! record[5] = src.getDescriptor().getIndex(); record[6] = src.isOutput()?1:0; } --- 371,401 ---- { handler.beginSection(PParser.INAMEDUMP, vaId(voiceArea)); ! for (PModule mm : voiceArea) { ! PModule m = (PModule)mm; ! handler.moduleNameDump(m.getComponentIndex(), m.getTitle()); } handler.endSection(PParser.INAMEDUMP); } ! private void getConnectionRecord(int[] record, PConnection c) { ! PConnector dst = c.getA(); ! PConnector src = c.getB(); // check order if (dst.isOutput()) { ! PConnector tmp = dst; dst = src; src = tmp; } ! record[0] = src.getSignalType().getId(); ! record[1] = dst.getParentComponent().getComponentIndex(); ! record[2] = Helper.index(dst); record[3] = 0; ! record[4] = src.getParentComponent().getComponentIndex(); ! record[5] = Helper.index(src); record[6] = src.isOutput()?1:0; } *************** *** 410,414 **** int[] record = getRecord(rsize); ! for(Connection c: voiceArea.getConnectionManager()) { getConnectionRecord(record, c); --- 411,415 ---- int[] record = getRecord(rsize); ! for(PConnection c: voiceArea.getConnectionManager()) { getConnectionRecord(record, c); *************** *** 421,425 **** { ! for (Connection c: voiceArea.getConnectionManager()) { int[] r = new int[rsize]; --- 422,426 ---- { ! for (PConnection c: voiceArea.getConnectionManager()) { int[] r = new int[rsize]; |