use of electric.xml.Elements in project blue by kunstmusik.
the class TimeState method loadFromXML.
/*
* SERIALIZATION CODE
*/
public static TimeState loadFromXML(Element data) {
TimeState timeState = new TimeState();
Elements nodes = data.getElements();
while (nodes.hasMoreElements()) {
Element e = nodes.next();
String nodeName = e.getName();
final String nodeText = e.getTextString();
switch(nodeName) {
case "pixelSecond":
timeState.pixelSecond = Integer.parseInt(nodeText);
break;
case "snapEnabled":
timeState.snapEnabled = Boolean.valueOf(nodeText).booleanValue();
break;
case "snapValue":
timeState.snapValue = Double.parseDouble(nodeText);
break;
case "timeDisplay":
timeState.timeDisplay = Integer.parseInt(nodeText);
break;
case "timeUnit":
timeState.timeUnit = Integer.parseInt(nodeText);
break;
}
}
return timeState;
}
use of electric.xml.Elements in project blue by kunstmusik.
the class Tempo method loadFromXML.
public static Tempo loadFromXML(Element data) {
Tempo retVal = new Tempo();
Elements nodes = data.getElements();
while (nodes.hasMoreElements()) {
Element node = nodes.next();
String nodeName = node.getName();
switch(nodeName) {
case "enabled":
retVal.enabled = Boolean.valueOf(node.getTextString()).booleanValue();
break;
case "visible":
retVal.visible = Boolean.valueOf(node.getTextString()).booleanValue();
break;
case "line":
retVal.line = Line.loadFromXML(node);
break;
}
}
return retVal;
}
use of electric.xml.Elements in project blue by kunstmusik.
the class SoundLayer method loadFromXML.
public static SoundLayer loadFromXML(Element data, Map<String, Object> objRefMap) throws Exception {
SoundLayer sLayer = new SoundLayer();
sLayer.setName(data.getAttributeValue("name"));
sLayer.setMuted(Boolean.valueOf(data.getAttributeValue("muted")).booleanValue());
sLayer.setSolo(Boolean.valueOf(data.getAttributeValue("solo")).booleanValue());
String heightIndexStr = data.getAttributeValue("heightIndex");
if (heightIndexStr != null) {
sLayer.setHeightIndex(Integer.parseInt(heightIndexStr));
}
Element npcNode = data.getElement("noteProcessorChain");
if (npcNode != null) {
sLayer.setNoteProcessorChain(NoteProcessorChain.loadFromXML(npcNode));
}
Elements sObjects = data.getElements("soundObject");
while (sObjects.hasMoreElements()) {
Object obj = ObjectUtilities.loadFromXML(sObjects.next(), objRefMap);
sLayer.add((SoundObject) obj);
}
Elements parameters = data.getElements("parameterId");
while (parameters.hasMoreElements()) {
String id = parameters.next().getTextString();
sLayer.automationParameters.addParameterId(id);
}
return sLayer;
}
use of electric.xml.Elements in project blue by kunstmusik.
the class LiveData method loadFromXML.
public static LiveData loadFromXML(Element data, Map<String, Object> objRefMap) throws Exception {
LiveData liveData = new LiveData();
Elements nodes = data.getElements();
boolean doCommandLineUpgrade = true;
ArrayList<LiveObject> oldFormat = new ArrayList<>();
Element liveObjectSetsNode = null;
while (nodes.hasMoreElements()) {
Element node = nodes.next();
String name = node.getName();
switch(name) {
case "commandLine":
liveData.setCommandLine(node.getTextString());
break;
case "commandLineEnabled":
liveData.setCommandLineEnabled(XMLUtilities.readBoolean(node));
doCommandLineUpgrade = false;
break;
case "commandLineOverride":
liveData.setCommandLineOverride(XMLUtilities.readBoolean(node));
doCommandLineUpgrade = false;
break;
case "soundObject":
SoundObject sObj = (SoundObject) ObjectUtilities.loadFromXML(node, objRefMap);
LiveObject lObj = new LiveObject();
lObj.setSObj(sObj);
oldFormat.add(lObj);
break;
case "liveObject":
oldFormat.add(LiveObject.loadFromXML(node, objRefMap));
break;
case "liveObjectBins":
liveData.liveObjectBins = LiveObjectBins.loadFromXML(node, objRefMap);
break;
case "repeat":
liveData.repeat = XMLUtilities.readInt(node);
break;
case "tempo":
liveData.tempo = XMLUtilities.readInt(node);
break;
case "liveObjectSetList":
liveObjectSetsNode = node;
break;
case "repeatEnabled":
liveData.setRepeatEnabled(XMLUtilities.readBoolean(node));
break;
case "liveCodeText":
liveData.setLiveCodeText(node.getTextString());
break;
}
}
if (oldFormat.size() > 0) {
LiveObject[][] liveObjectBins = new LiveObject[1][oldFormat.size()];
for (int i = 0; i < oldFormat.size(); i++) {
liveObjectBins[0][i] = oldFormat.get(i);
}
liveData.liveObjectBins = new LiveObjectBins(liveObjectBins);
}
if (doCommandLineUpgrade) {
liveData.setCommandLineEnabled(true);
liveData.setCommandLineOverride(true);
}
if (liveObjectSetsNode != null) {
liveData.liveObjectSets = LiveObjectSetList.loadFromXML(liveObjectSetsNode, liveData.liveObjectBins);
}
return liveData;
}
use of electric.xml.Elements in project blue by kunstmusik.
the class Arrangement method loadFromXML.
// NEW SAVING AND LOADING METHODS
public static Arrangement loadFromXML(Element data) throws Exception {
Arrangement arr = new Arrangement();
Elements items = data.getElements("instrumentAssignment");
while (items.hasMoreElements()) {
Element elem = items.next();
InstrumentAssignment ia = InstrumentAssignment.loadFromXML(elem);
arr.getArrangement().add(ia);
}
return arr;
}
Aggregations