Search in sources :

Example 56 with Element

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

the class Mask method loadFromXML.

public static Mask loadFromXML(Element data) {
    Mask retVal = new Mask();
    Elements nodes = data.getElements();
    while (nodes.hasMoreElements()) {
        Element node = nodes.next();
        String nodeName = node.getName();
        switch(nodeName) {
            case "table":
                Table t = Table.loadFromXML(node);
                String tabInstance = node.getAttributeValue("tableId");
                switch(tabInstance) {
                    case "highTable":
                        retVal.highTable = t;
                        break;
                    case "lowTable":
                        retVal.lowTable = t;
                        break;
                }
                break;
            case "highTableEnabled":
                retVal.highTableEnabled = Boolean.valueOf(node.getTextString()).booleanValue();
                break;
            case "lowTableEnabled":
                retVal.lowTableEnabled = Boolean.valueOf(node.getTextString()).booleanValue();
                break;
            case "low":
                retVal.low = Double.parseDouble(node.getTextString());
                break;
            case "high":
                retVal.high = Double.parseDouble(node.getTextString());
                break;
            case "mapValue":
                retVal.mapValue = Double.parseDouble(node.getTextString());
                break;
            case "enabled":
                retVal.enabled = Boolean.valueOf(node.getTextString()).booleanValue();
                break;
        }
    }
    return retVal;
}
Also used : Element(electric.xml.Element) Elements(electric.xml.Elements)

Example 57 with Element

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

the class Oscillator method saveAsXML.

@Override
public Element saveAsXML() {
    Element retVal = new Element("generator");
    retVal.setAttribute("type", getClass().getName());
    retVal.addElement(XMLUtilities.writeInt("oscillatorType", oscillatorType));
    retVal.addElement(XMLUtilities.writeDouble("phaseInit", phaseInit));
    retVal.addElement(XMLUtilities.writeDouble("frequency", getFrequency()));
    retVal.addElement(XMLUtilities.writeBoolean("freqTableEnabled", isFreqTableEnabled()));
    retVal.addElement(getFreqTable().saveAsXML());
    retVal.addElement(XMLUtilities.writeDouble("exponent", exponent));
    return retVal;
}
Also used : Element(electric.xml.Element)

Example 58 with Element

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

the class Quantizer method loadFromXML.

public static Quantizer loadFromXML(Element data) {
    Quantizer retVal = new Quantizer();
    Elements nodes = data.getElements();
    while (nodes.hasMoreElements()) {
        Element node = nodes.next();
        String nodeName = node.getName();
        String nodeVal = node.getTextString();
        switch(nodeName) {
            case "gridSize":
                retVal.gridSize = Double.parseDouble(nodeVal);
                break;
            case "strength":
                retVal.strength = Double.parseDouble(nodeVal);
                break;
            case "offset":
                retVal.offset = Double.parseDouble(nodeVal);
                break;
            case "gridSizeTableEnabled":
                retVal.gridSizeTableEnabled = Boolean.valueOf(node.getTextString()).booleanValue();
                break;
            case "strengthTableEnabled":
                retVal.strengthTableEnabled = Boolean.valueOf(node.getTextString()).booleanValue();
                break;
            case "offsetTableEnabled":
                retVal.offsetTableEnabled = Boolean.valueOf(node.getTextString()).booleanValue();
                break;
            case "enabled":
                retVal.enabled = Boolean.valueOf(node.getTextString()).booleanValue();
                break;
            case "table":
                Table t = Table.loadFromXML(node);
                String tabInstance = node.getAttributeValue("tableId");
                switch(tabInstance) {
                    case "gridSizeTable":
                        retVal.gridSizeTable = t;
                        break;
                    case "strengthTable":
                        retVal.strengthTable = t;
                        break;
                    case "offsetTable":
                        retVal.offsetTable = t;
                        break;
                }
                break;
        }
    }
    return retVal;
}
Also used : Element(electric.xml.Element) Elements(electric.xml.Elements)

Example 59 with Element

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

the class Segment method saveAsXML.

@Override
public Element saveAsXML() {
    Element retVal = new Element("generator");
    retVal.setAttribute("type", getClass().getName());
    retVal.addElement(table.saveAsXML());
    return retVal;
}
Also used : Element(electric.xml.Element)

Example 60 with Element

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

the class Beta method saveAsXML.

@Override
public Element saveAsXML() {
    Element retVal = new Element("probabilityGenerator");
    retVal.setAttribute("type", getClass().getName());
    retVal.addElement(XMLUtilities.writeDouble("a", a));
    retVal.addElement(XMLUtilities.writeDouble("b", b));
    retVal.addElement(XMLUtilities.writeBoolean("aTableEnabled", aTableEnabled));
    retVal.addElement(XMLUtilities.writeBoolean("bTableEnabled", bTableEnabled));
    Element aTableNode = aTable.saveAsXML();
    aTableNode.setAttribute("tableId", "aTable");
    Element bTableNode = bTable.saveAsXML();
    bTableNode.setAttribute("tableId", "bTable");
    retVal.addElement(aTableNode);
    retVal.addElement(bTableNode);
    return retVal;
}
Also used : Element(electric.xml.Element)

Aggregations

Element (electric.xml.Element)310 Elements (electric.xml.Elements)120 Document (electric.xml.Document)22 Vector (java.util.Vector)14 Iterator (java.util.Iterator)12 File (java.io.File)10 BigDecimal (java.math.BigDecimal)10 IOException (java.io.IOException)8 SoundObject (blue.soundObject.SoundObject)7 ParseException (electric.xml.ParseException)7 DefaultMutableTreeNode (javax.swing.tree.DefaultMutableTreeNode)4 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 Test (org.junit.Test)3 ParameterList (blue.automation.ParameterList)2 LiveObject (blue.blueLive.LiveObject)2 LiveObjectBins (blue.blueLive.LiveObjectBins)2 Line (blue.components.lines.Line)2