Search in sources :

Example 26 with Elements

use of electric.xml.Elements in project blue by kunstmusik.

the class Operator method loadFromXML.

public static Operator loadFromXML(Element data) {
    Operator op = new Operator();
    op.mode = XMLUtilities.readInt(data, "mode");
    op.sync = XMLUtilities.readInt(data, "sync");
    op.freqCoarse = XMLUtilities.readInt(data, "freqCoarse");
    op.freqFine = XMLUtilities.readInt(data, "freqFine");
    op.detune = XMLUtilities.readInt(data, "detune");
    op.breakpoint = XMLUtilities.readInt(data, "breakpoint");
    op.curveLeft = XMLUtilities.readInt(data, "curveLeft");
    op.curveRight = XMLUtilities.readInt(data, "curveRight");
    op.depthLeft = XMLUtilities.readInt(data, "depthLeft");
    op.depthRight = XMLUtilities.readInt(data, "depthRight");
    op.keyboardRateScaling = XMLUtilities.readInt(data, "keyboardRateScaling");
    op.outputLevel = XMLUtilities.readInt(data, "outputLevel");
    op.velocitySensitivity = XMLUtilities.readInt(data, "velocitySensitivity");
    op.modulationAmplitude = XMLUtilities.readInt(data, "modulationAmplitude");
    op.modulationPitch = XMLUtilities.readInt(data, "modulationPitch");
    Elements envPoints = data.getElements("envelopePoint");
    int counter = 0;
    while (envPoints.hasMoreElements()) {
        op.envelopePoints[counter] = EnvelopePoint.loadFromXML(envPoints.next());
        counter++;
    }
    return op;
}
Also used : Elements(electric.xml.Elements)

Example 27 with Elements

use of electric.xml.Elements in project blue by kunstmusik.

the class Scale method loadFromXML.

/* SERIALIZATION */
public static Scale loadFromXML(Element data) {
    Scale scale = new Scale();
    Elements nodes = data.getElements();
    while (nodes.hasMoreElements()) {
        Element node = nodes.next();
        String nodeName = node.getName();
        switch(nodeName) {
            case "scaleName":
                scale.scaleName = node.getTextString();
                break;
            case "baseFrequency":
                scale.baseFrequency = Double.parseDouble(node.getTextString());
                break;
            case "octave":
                scale.octave = Double.parseDouble(node.getTextString());
                break;
            case "ratios":
                Elements ratioNodes = node.getElements();
                scale.ratios = new double[ratioNodes.size()];
                int i = 0;
                while (ratioNodes.hasMoreElements()) {
                    Element ratioNode = ratioNodes.next();
                    scale.ratios[i] = Double.parseDouble(ratioNode.getTextString());
                    i++;
                }
                break;
        }
    }
    return scale;
}
Also used : Element(electric.xml.Element) Elements(electric.xml.Elements)

Example 28 with Elements

use of electric.xml.Elements in project blue by kunstmusik.

the class Track method loadFromXML.

public static Track loadFromXML(Element data) {
    Track retVal = new Track(false);
    Elements nodes = data.getElements();
    while (nodes.hasMoreElements()) {
        Element node = nodes.next();
        String nodeName = node.getName();
        switch(nodeName) {
            case "name":
                retVal.name = node.getTextString();
                if (retVal.name == null) {
                    retVal.name = "";
                }
                break;
            case "noteTemplate":
                retVal.noteTemplate = node.getTextString();
                if (retVal.noteTemplate == null) {
                    retVal.noteTemplate = "";
                }
                break;
            case "instrumentId":
                retVal.instrumentId = node.getTextString();
                if (retVal.instrumentId == null) {
                    retVal.instrumentId = "";
                }
                break;
            case "columns":
                {
                    Elements nodes2 = node.getElements();
                    while (nodes2.hasMoreElements()) {
                        retVal.addColumn(Column.loadFromXML(nodes2.next()));
                    }
                    break;
                }
            case "trackerNotes":
                {
                    Elements nodes2 = node.getElements();
                    while (nodes2.hasMoreElements()) {
                        retVal.trackerNotes.add(TrackerNote.loadFromXML(nodes2.next()));
                    }
                    break;
                }
        }
    }
    return retVal;
}
Also used : Element(electric.xml.Element) Elements(electric.xml.Elements)

Example 29 with Elements

use of electric.xml.Elements in project blue by kunstmusik.

the class OpcodeList method loadFromXML.

/* SAVE/LOAD METHODS */
public static OpcodeList loadFromXML(Element data) {
    OpcodeList retVal = new OpcodeList();
    Elements nodes = data.getElements();
    while (nodes.hasMoreElements()) {
        Element node = nodes.next();
        UserDefinedOpcode udo = UserDefinedOpcode.loadFromXML(node);
        retVal.addOpcode(udo);
    }
    return retVal;
}
Also used : Element(electric.xml.Element) Elements(electric.xml.Elements)

Example 30 with Elements

use of electric.xml.Elements in project blue by kunstmusik.

the class Field method loadFromXML.

public static Field loadFromXML(Element data) throws Exception {
    Field field = new Field(false);
    Elements nodes = data.getElements();
    while (nodes.hasMoreElements()) {
        Element node = nodes.next();
        String nodeName = node.getName();
        if (nodeName.equals("parameter")) {
            field.parameters.add(Parameter.loadFromXML(node));
        }
    }
    return field;
}
Also used : Element(electric.xml.Element) Elements(electric.xml.Elements)

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