use of electric.xml.Elements in project blue by kunstmusik.
the class AudioLayer method loadFromXML.
public static AudioLayer loadFromXML(Element data) {
AudioLayer layer = new AudioLayer();
layer.setName(data.getAttributeValue("name"));
layer.setMuted(Boolean.valueOf(data.getAttributeValue("muted")).booleanValue());
layer.setSolo(Boolean.valueOf(data.getAttributeValue("solo")).booleanValue());
if (data.getAttribute("uniqueId") != null) {
layer.uniqueId = data.getAttributeValue("uniqueId");
}
String heightIndexStr = data.getAttributeValue("heightIndex");
if (heightIndexStr != null) {
layer.setHeightIndex(Integer.parseInt(heightIndexStr));
}
Elements nodes = data.getElements();
while (nodes.hasMoreElements()) {
Element node = nodes.next();
switch(node.getName()) {
case "audioClip":
layer.add(AudioClip.loadFromXML(node));
break;
case "parameterId":
String id = node.getTextString();
layer.automationParameters.addParameterId(id);
break;
}
}
return layer;
}
use of electric.xml.Elements in project blue by kunstmusik.
the class CeciliaModule method loadFromXML.
/*
* (non-Javadoc)
*
* @see blue.soundObject.SoundObject#loadFromXML(electric.xml.Element)
*/
public static SoundObject loadFromXML(Element data, Map<String, Object> objRefMap) throws Exception {
CeciliaModule ceciliaModule = new CeciliaModule();
SoundObjectUtilities.initBasicFromXML(data, ceciliaModule);
ceciliaModule.setOrchestraVersion(Integer.parseInt(data.getTextString("orchestraVersion")));
ceciliaModule.setGenSize(data.getTextString("genSize"));
ceciliaModule.setModuleDefinition(ModuleDefinition.loadFromXML(data.getElement("moduleDefinition")));
Elements stateNodes = data.getElements("ceciliaObject");
while (stateNodes.hasMoreElements()) {
Element elem = stateNodes.next();
String key = elem.getAttributeValue("nameKey");
CeciliaObject cObj = (CeciliaObject) ObjectUtilities.loadFromXML(elem);
ceciliaModule.stateData.put(key, cObj);
}
return ceciliaModule;
}
use of electric.xml.Elements in project blue by kunstmusik.
the class CGraph method loadFromXML.
public static CeciliaObject loadFromXML(Element data) {
CGraph cgraph = new CGraph();
CeciliaObject.initBasicFromXML(data, cgraph);
cgraph.setMin(Double.parseDouble(data.getTextString("min")));
cgraph.setMax(Double.parseDouble(data.getTextString("max")));
cgraph.setUnit(data.getTextString("unit"));
cgraph.setRel(Integer.parseInt(data.getTextString("rel")));
cgraph.setGen(Integer.parseInt(data.getTextString("gen")));
cgraph.setSize(Integer.parseInt(data.getTextString("size")));
String color = data.getTextString("color");
cgraph.setColor(color == null ? "" : color);
Elements pointNodes = data.getElements("cgraphPoint");
while (pointNodes.hasMoreElements()) {
CGraphPoint cgp = CGraphPoint.loadFromXML(pointNodes.next());
cgraph.points.add(cgp);
}
return cgraph;
}
use of electric.xml.Elements in project blue by kunstmusik.
the class AudioClip method loadFromXML.
public static AudioClip loadFromXML(Element data) {
AudioClip clip = new AudioClip();
Elements nodes = data.getElements();
while (nodes.hasMoreElements()) {
final Element node = nodes.next();
final String nodeText = node.getTextString();
switch(node.getName()) {
case "name":
clip.setName(nodeText);
break;
case "audioFile":
clip.setAudioFile(new File(nodeText));
break;
case "numChannels":
clip.numChannels = XMLUtilities.readInt(node);
break;
case "audioDuration":
clip.setAudioDuration(XMLUtilities.readDouble(node));
break;
case "fileStart":
clip.setFileStartTime(XMLUtilities.readDouble(node));
break;
case "start":
clip.setStart(XMLUtilities.readDouble(node));
break;
case "duration":
clip.setDuration(XMLUtilities.readDouble(node));
break;
case "backgroundColor":
String colorStr = data.getTextString("backgroundColor");
clip.setBackgroundColor(new Color(Integer.parseInt(colorStr)));
break;
case "fadeIn":
clip.setFadeIn(XMLUtilities.readDouble(node));
break;
case "fadeInType":
clip.setFadeInType(FadeType.fromString(nodeText));
break;
case "fadeOut":
clip.setFadeOut(XMLUtilities.readDouble(node));
break;
case "fadeOutType":
clip.setFadeOutType(FadeType.fromString(nodeText));
break;
}
}
return clip;
}
use of electric.xml.Elements in project blue by kunstmusik.
the class BlueShare method selectServer.
private static String selectServer() {
String retVal = null;
// get server list from disk
try {
Document doc = new Document(new File(BlueSystem.getConfDir() + File.separator + "blueShare.xml"));
Element root = doc.getRoot();
Elements servers = root.getElements("server");
Object[] serverOptions = new Object[servers.size()];
int i = 0;
while (servers.hasMoreElements()) {
serverOptions[i] = servers.next().getTextString();
i++;
}
Object serverObj = JOptionPane.showInputDialog(null, BlueSystem.getString("blueShare.selectServer.message"), BlueSystem.getString("blueShare.selectServer.title"), JOptionPane.PLAIN_MESSAGE, null, serverOptions, serverOptions[0]);
if (serverObj != null) {
retVal = serverObj.toString();
}
} catch (ParseException | HeadlessException e) {
e.printStackTrace();
}
return retVal;
}
Aggregations