use of electric.xml.Element in project blue by kunstmusik.
the class JMask method saveAsXML.
/*
* (non-Javadoc)
*
* @see blue.soundObject.SoundObject#saveAsXML()
*/
@Override
public Element saveAsXML(Map<Object, String> objRefMap) {
Element retVal = SoundObjectUtilities.getBasicXML(this);
retVal.addElement("seedUsed").setText(Boolean.toString(seedUsed));
retVal.addElement("seed").setText(Long.toString(seed));
retVal.addElement(field.saveAsXML());
return retVal;
}
use of electric.xml.Element in project blue by kunstmusik.
the class LineObject method loadFromXML.
/* SERIALIZATION */
public static SoundObject loadFromXML(Element data, Map<String, Object> objRefMap) throws Exception {
LineObject lObj = new LineObject();
SoundObjectUtilities.initBasicFromXML(data, lObj);
Elements lines = data.getElements();
int counter = 0;
while (lines.hasMoreElements()) {
Element node = lines.next();
if (node.getName().equals("line")) {
Line l = Line.loadFromXML(node);
lObj.getLines().add(l);
if (l.getColor() == null) {
l.setColor(LineColors.getColor(counter));
}
counter++;
}
}
return lObj;
}
use of electric.xml.Element in project blue by kunstmusik.
the class PatternObject method saveAsXML.
@Override
public Element saveAsXML(Map<Object, String> objRefMap) {
Element retVal = SoundObjectUtilities.getBasicXML(this);
retVal.addElement("beats").setText(Integer.toString(beats));
retVal.addElement("subDivisions").setText(Integer.toString(subDivisions));
Element patternsNode = new Element("patterns");
retVal.addElement(patternsNode);
for (Iterator iter = patterns.iterator(); iter.hasNext(); ) {
Pattern element = (Pattern) iter.next();
patternsNode.addElement(element.saveAsXML());
}
return retVal;
}
use of electric.xml.Element in project blue by kunstmusik.
the class PatternObject method loadFromXML.
/* SERIALIZATION */
public static SoundObject loadFromXML(Element data, Map<String, Object> objRefMap) throws Exception {
PatternObject pattern = new PatternObject();
SoundObjectUtilities.initBasicFromXML(data, pattern);
Elements nodes = data.getElements();
while (nodes.hasMoreElements()) {
Element node = nodes.next();
String nodeName = node.getName();
switch(nodeName) {
case "beats":
pattern.setBeats(Integer.parseInt(node.getTextString()));
break;
case "subDivisions":
pattern.setSubDivisions(Integer.parseInt(node.getTextString()));
break;
case "patterns":
Elements patternNodes = node.getElements();
while (patternNodes.hasMoreElements()) {
Pattern p = Pattern.loadFromXML(patternNodes.next());
pattern.addPattern(p);
}
break;
}
}
return pattern;
}
use of electric.xml.Element in project blue by kunstmusik.
the class External method loadFromXML.
/*
* (non-Javadoc)
*
* @see blue.soundObject.SoundObject#loadFromXML(electric.xml.Element)
*/
public static SoundObject loadFromXML(Element data, Map<String, Object> objRefMap) throws Exception {
External external = new External();
SoundObjectUtilities.initBasicFromXML(data, external);
Elements nodes = data.getElements();
while (nodes.hasMoreElements()) {
Element node = nodes.next();
String nodeName = node.getName();
switch(nodeName) {
case "text":
external.setText(node.getTextString());
break;
case "commandLine":
external.setCommandLine(node.getTextString());
break;
case "syntaxType":
external.setSyntaxType(node.getTextString());
break;
}
}
return external;
}
Aggregations