use of electric.xml.Elements in project blue by kunstmusik.
the class Effect method loadFromXML.
public static Effect loadFromXML(Element data) throws Exception {
Effect effect = new Effect(false);
Elements nodes = data.getElements();
while (nodes.hasMoreElements()) {
Element node = nodes.next();
String nodeName = node.getName();
switch(nodeName) {
case "name":
effect.setName(node.getTextString());
break;
case "enabled":
effect.setEnabled(XMLUtilities.readBoolean(node));
break;
case "numIns":
effect.setNumIns(XMLUtilities.readInt(node));
break;
case "numOuts":
effect.setNumOuts(XMLUtilities.readInt(node));
break;
case "code":
effect.setCode(node.getTextString());
break;
case "comments":
effect.setComments(node.getTextString());
break;
case "opcodeList":
effect.opcodeList = OpcodeList.loadFromXML(node);
break;
case "graphicInterface":
effect.setGraphicInterface(BSBGraphicInterface.loadFromXML(node));
break;
case "bsbParameterList":
case "parameterList":
effect.parameterList = (ParameterList) ParameterList.loadFromXML(node);
break;
}
}
if (effect.opcodeList == null) {
effect.opcodeList = new OpcodeList();
}
if (effect.graphicInterface == null) {
effect.graphicInterface = new BSBGraphicInterface();
}
if (effect.parameterList == null) {
effect.parameterList = new ParameterList();
}
effect.graphicInterface.getRootGroup().setParameterList(effect.parameterList);
return effect;
}
use of electric.xml.Elements in project blue by kunstmusik.
the class ParameterList method loadFromXML.
public static ParameterList loadFromXML(Element data) {
ParameterList retVal = new ParameterList();
Elements nodes = data.getElements();
while (nodes.hasMoreElements()) {
Element node = nodes.next();
String nodeName = node.getName();
if (nodeName.equals("parameter")) {
retVal.add(Parameter.loadFromXML(node));
}
}
return retVal;
}
use of electric.xml.Elements in project blue by kunstmusik.
the class ParameterIdList method loadFromXML.
public static ParameterIdList loadFromXML(Element data) {
ParameterIdList retVal = new ParameterIdList();
String indexStr = data.getAttributeValue("selectedIndex");
if (indexStr != null && indexStr.length() > 0) {
retVal.selectedIndex = Integer.parseInt(indexStr);
}
Elements nodes = data.getElements();
while (nodes.hasMoreElements()) {
Element node = nodes.next();
String nodeName = node.getName();
if (nodeName.equals("parameterId")) {
retVal.parameters.add(node.getTextString());
}
}
if (retVal.size() > 0 && retVal.getSelectedIndex() < 0) {
retVal.setSelectedIndex(0);
}
return retVal;
}
use of electric.xml.Elements in project blue by kunstmusik.
the class MarkersList method loadFromXML.
public static MarkersList loadFromXML(Element data) {
MarkersList markers = new MarkersList();
Elements nodes = data.getElements();
while (nodes.hasMoreElements()) {
Marker m = Marker.loadFromXML(nodes.next());
markers.addMarker(m);
}
return markers;
}
use of electric.xml.Elements in project blue by kunstmusik.
the class SoundObjectLibrary method loadFromXML.
/* SERIALIZATION CODE */
public static SoundObjectLibrary loadFromXML(Element data, Map<String, Object> objRefMap) throws Exception {
SoundObjectLibrary sObjLib = new SoundObjectLibrary();
sObjLib.setInitializing(true);
Elements sObjects = data.getElements("soundObject");
int index = 0;
while (sObjects.hasMoreElements()) {
Element node = sObjects.next();
// skip adding of Instance but increment index
if ("blue.soundObject.Instance".equals(node.getAttributeValue("type"))) {
index++;
continue;
}
SoundObject sObj = (SoundObject) ObjectUtilities.loadFromXML(node, objRefMap);
sObjLib.add(sObj);
if (node.getAttribute("objRefId") != null) {
objRefMap.put(node.getAttributeValue("objRefId"), sObj);
} else {
objRefMap.put(Integer.toString(index++), sObj);
}
}
sObjLib.setInitializing(false);
return sObjLib;
}
Aggregations