Search in sources :

Example 1 with Elements

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;
}
Also used : Element(electric.xml.Element) Elements(electric.xml.Elements)

Example 2 with Elements

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;
}
Also used : Element(electric.xml.Element) Scale(blue.soundObject.pianoRoll.Scale) Elements(electric.xml.Elements) File(java.io.File)

Example 3 with Elements

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;
}
Also used : Elements(electric.xml.Elements) EnvelopePoint(blue.orchestra.blueX7.EnvelopePoint) IOException(java.io.IOException)

Example 4 with Elements

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;
}
Also used : Element(electric.xml.Element) Elements(electric.xml.Elements)

Example 5 with Elements

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;
}
Also used : Element(electric.xml.Element) Elements(electric.xml.Elements) BigDecimal(java.math.BigDecimal)

Aggregations

Elements (electric.xml.Elements)131 Element (electric.xml.Element)120 Document (electric.xml.Document)12 BigDecimal (java.math.BigDecimal)10 Vector (java.util.Vector)10 File (java.io.File)4 SoundObject (blue.soundObject.SoundObject)3 EffectOption (blue.tools.blueShare.effects.EffectOption)3 InstrumentOption (blue.tools.blueShare.instruments.InstrumentOption)3 SoundObjectOption (blue.tools.blueShare.soundObjects.SoundObjectOption)3 OpcodeList (blue.udo.OpcodeList)3 ParseException (electric.xml.ParseException)3 ArrayList (java.util.ArrayList)3 ParameterList (blue.automation.ParameterList)2 Line (blue.components.lines.Line)2 Color (java.awt.Color)2 IOException (java.io.IOException)2 Font (javafx.scene.text.Font)2 LiveObject (blue.blueLive.LiveObject)1 LiveObjectBins (blue.blueLive.LiveObjectBins)1