Search in sources :

Example 56 with Elements

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

the class Effect method loadFromXML.

public static Effect loadFromXML(Element data) throws Exception {
    Effect effect = new Effect(false);
    Elements nodes = data.getElements();
    while (nodes.hasMoreElements()) {
        Element node = nodes.next();
        String nodeName = node.getName();
        switch(nodeName) {
            case "name":
                effect.setName(node.getTextString());
                break;
            case "enabled":
                effect.setEnabled(XMLUtilities.readBoolean(node));
                break;
            case "numIns":
                effect.setNumIns(XMLUtilities.readInt(node));
                break;
            case "numOuts":
                effect.setNumOuts(XMLUtilities.readInt(node));
                break;
            case "code":
                effect.setCode(node.getTextString());
                break;
            case "comments":
                effect.setComments(node.getTextString());
                break;
            case "opcodeList":
                effect.opcodeList = OpcodeList.loadFromXML(node);
                break;
            case "graphicInterface":
                effect.setGraphicInterface(BSBGraphicInterface.loadFromXML(node));
                break;
            case "bsbParameterList":
            case "parameterList":
                effect.parameterList = (ParameterList) ParameterList.loadFromXML(node);
                break;
        }
    }
    if (effect.opcodeList == null) {
        effect.opcodeList = new OpcodeList();
    }
    if (effect.graphicInterface == null) {
        effect.graphicInterface = new BSBGraphicInterface();
    }
    if (effect.parameterList == null) {
        effect.parameterList = new ParameterList();
    }
    effect.graphicInterface.getRootGroup().setParameterList(effect.parameterList);
    return effect;
}
Also used : BSBGraphicInterface(blue.orchestra.blueSynthBuilder.BSBGraphicInterface) OpcodeList(blue.udo.OpcodeList) Element(electric.xml.Element) ParameterList(blue.automation.ParameterList) Elements(electric.xml.Elements)

Example 57 with Elements

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

the class ParameterList method loadFromXML.

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

Example 58 with Elements

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

the class ParameterIdList method loadFromXML.

public static ParameterIdList loadFromXML(Element data) {
    ParameterIdList retVal = new ParameterIdList();
    String indexStr = data.getAttributeValue("selectedIndex");
    if (indexStr != null && indexStr.length() > 0) {
        retVal.selectedIndex = Integer.parseInt(indexStr);
    }
    Elements nodes = data.getElements();
    while (nodes.hasMoreElements()) {
        Element node = nodes.next();
        String nodeName = node.getName();
        if (nodeName.equals("parameterId")) {
            retVal.parameters.add(node.getTextString());
        }
    }
    if (retVal.size() > 0 && retVal.getSelectedIndex() < 0) {
        retVal.setSelectedIndex(0);
    }
    return retVal;
}
Also used : Element(electric.xml.Element) Elements(electric.xml.Elements)

Example 59 with Elements

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

the class MarkersList method loadFromXML.

public static MarkersList loadFromXML(Element data) {
    MarkersList markers = new MarkersList();
    Elements nodes = data.getElements();
    while (nodes.hasMoreElements()) {
        Marker m = Marker.loadFromXML(nodes.next());
        markers.addMarker(m);
    }
    return markers;
}
Also used : Elements(electric.xml.Elements)

Example 60 with Elements

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

the class SoundObjectLibrary method loadFromXML.

/* SERIALIZATION CODE */
public static SoundObjectLibrary loadFromXML(Element data, Map<String, Object> objRefMap) throws Exception {
    SoundObjectLibrary sObjLib = new SoundObjectLibrary();
    sObjLib.setInitializing(true);
    Elements sObjects = data.getElements("soundObject");
    int index = 0;
    while (sObjects.hasMoreElements()) {
        Element node = sObjects.next();
        // skip adding of Instance but increment index
        if ("blue.soundObject.Instance".equals(node.getAttributeValue("type"))) {
            index++;
            continue;
        }
        SoundObject sObj = (SoundObject) ObjectUtilities.loadFromXML(node, objRefMap);
        sObjLib.add(sObj);
        if (node.getAttribute("objRefId") != null) {
            objRefMap.put(node.getAttributeValue("objRefId"), sObj);
        } else {
            objRefMap.put(Integer.toString(index++), sObj);
        }
    }
    sObjLib.setInitializing(false);
    return sObjLib;
}
Also used : SoundObject(blue.soundObject.SoundObject) 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