use of electric.xml.Elements in project blue by kunstmusik.
the class NoteProcessorChain method loadFromXML.
public static NoteProcessorChain loadFromXML(Element data) throws Exception {
NoteProcessorChain npc = new NoteProcessorChain();
Elements nProcNodes = data.getElements("noteProcessor");
while (nProcNodes.hasMoreElements()) {
Element elem = nProcNodes.next();
Object obj = ObjectUtilities.loadFromXML(elem);
npc.add((NoteProcessor) obj);
}
return npc;
}
use of electric.xml.Elements in project blue by kunstmusik.
the class TuningProcessor method loadFromXML.
public static NoteProcessor loadFromXML(Element data) {
TuningProcessor tp = new TuningProcessor();
Elements nodes = data.getElements();
double baseFreq = -1;
while (nodes.hasMoreElements()) {
Element node = nodes.next();
switch(node.getName()) {
case "baseFrequency":
baseFreq = Double.parseDouble(node.getTextString());
break;
case "pfield":
tp.setPfield(node.getTextString());
break;
case "scale":
Scale scale;
if (node.getElements().size() == 0) {
String scaleDir = BlueSystem.getUserConfigurationDirectory() + File.separator + "scl";
String scalePath = scaleDir + File.separator + node.getTextString();
File scaleFile = new File(scalePath);
scale = Scale.loadScale(scaleFile);
} else {
scale = Scale.loadFromXML(node);
}
tp.setScale(scale);
break;
}
}
if (baseFreq > 0) {
tp.getScale().setBaseFrequency(baseFreq);
}
// tp.setFileName(data.getElement("fileName").getTextString());
return tp;
}
use of electric.xml.Elements in project blue by kunstmusik.
the class BlueX7 method loadFromXML.
public static Instrument loadFromXML(Element data) throws Exception {
BlueX7 instr = new BlueX7();
InstrumentUtilities.initBasicFromXML(data, instr);
instr.algorithmCommon = AlgorithmCommonData.loadFromXML(data.getElement("algorithmCommonData"));
instr.lfo = LFOData.loadFromXML(data.getElement("lfoData"));
Elements ops = data.getElements("operator");
int counter = 0;
while (ops.hasMoreElements()) {
instr.operators[counter] = Operator.loadFromXML(ops.next());
counter++;
}
Elements pegPoints = data.getElements("envelopePoint");
counter = 0;
while (pegPoints.hasMoreElements()) {
instr.peg[counter] = EnvelopePoint.loadFromXML(pegPoints.next());
counter++;
}
try {
instr.csoundPostCode = data.getTextString("csoundPostCode");
} catch (Exception e) {
}
return instr;
}
use of electric.xml.Elements in project blue by kunstmusik.
the class EffectsChain method loadFromXML.
public static EffectsChain loadFromXML(Element data) throws Exception {
EffectsChain chain = new EffectsChain();
Elements nodes = data.getElements();
while (nodes.hasMoreElements()) {
Element node = nodes.next();
String nodeName = node.getName();
switch(nodeName) {
case "effect":
chain.addEffect(Effect.loadFromXML(node));
break;
case "send":
chain.addSend(Send.loadFromXML(node));
break;
}
}
return chain;
}
use of electric.xml.Elements in project blue by kunstmusik.
the class Send method loadFromXML.
public static Send loadFromXML(Element data) {
Send send = new Send(false);
Elements nodes = data.getElements();
while (nodes.hasMoreElements()) {
Element node = nodes.next();
String nodeName = node.getName();
switch(nodeName) {
case "sendChannel":
send.sendChannel = node.getTextString();
break;
case "level":
send.level = Double.parseDouble(node.getTextString());
break;
case "enabled":
send.enabled = Boolean.valueOf(node.getTextString()).booleanValue();
break;
case "parameter":
send.levelParameter = Parameter.loadFromXML(node);
send.levelParameter.addParameterListener(send);
send.params.add(send.levelParameter);
break;
}
}
if (send.params.size() == 0) {
send.levelParameter = new Parameter();
send.levelParameter.setName("Send Amount");
send.levelParameter.setMin(0.0f, false);
send.levelParameter.setMax(1.0f, false);
send.levelParameter.setValue(1.0f);
send.levelParameter.setResolution(new BigDecimal(-1.0f));
send.levelParameter.addParameterListener(send);
send.params.add(send.levelParameter);
}
return send;
}
Aggregations