Search in sources :

Example 81 with Element

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

the class JMask method saveAsXML.

/*
     * (non-Javadoc)
     * 
     * @see blue.soundObject.SoundObject#saveAsXML()
     */
@Override
public Element saveAsXML(Map<Object, String> objRefMap) {
    Element retVal = SoundObjectUtilities.getBasicXML(this);
    retVal.addElement("seedUsed").setText(Boolean.toString(seedUsed));
    retVal.addElement("seed").setText(Long.toString(seed));
    retVal.addElement(field.saveAsXML());
    return retVal;
}
Also used : Element(electric.xml.Element)

Example 82 with Element

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

the class LineObject method loadFromXML.

/* SERIALIZATION */
public static SoundObject loadFromXML(Element data, Map<String, Object> objRefMap) throws Exception {
    LineObject lObj = new LineObject();
    SoundObjectUtilities.initBasicFromXML(data, lObj);
    Elements lines = data.getElements();
    int counter = 0;
    while (lines.hasMoreElements()) {
        Element node = lines.next();
        if (node.getName().equals("line")) {
            Line l = Line.loadFromXML(node);
            lObj.getLines().add(l);
            if (l.getColor() == null) {
                l.setColor(LineColors.getColor(counter));
            }
            counter++;
        }
    }
    return lObj;
}
Also used : Line(blue.components.lines.Line) Element(electric.xml.Element) Elements(electric.xml.Elements)

Example 83 with Element

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

the class PatternObject method saveAsXML.

@Override
public Element saveAsXML(Map<Object, String> objRefMap) {
    Element retVal = SoundObjectUtilities.getBasicXML(this);
    retVal.addElement("beats").setText(Integer.toString(beats));
    retVal.addElement("subDivisions").setText(Integer.toString(subDivisions));
    Element patternsNode = new Element("patterns");
    retVal.addElement(patternsNode);
    for (Iterator iter = patterns.iterator(); iter.hasNext(); ) {
        Pattern element = (Pattern) iter.next();
        patternsNode.addElement(element.saveAsXML());
    }
    return retVal;
}
Also used : Pattern(blue.soundObject.pattern.Pattern) Element(electric.xml.Element) Iterator(java.util.Iterator)

Example 84 with Element

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

the class PatternObject method loadFromXML.

/* SERIALIZATION */
public static SoundObject loadFromXML(Element data, Map<String, Object> objRefMap) throws Exception {
    PatternObject pattern = new PatternObject();
    SoundObjectUtilities.initBasicFromXML(data, pattern);
    Elements nodes = data.getElements();
    while (nodes.hasMoreElements()) {
        Element node = nodes.next();
        String nodeName = node.getName();
        switch(nodeName) {
            case "beats":
                pattern.setBeats(Integer.parseInt(node.getTextString()));
                break;
            case "subDivisions":
                pattern.setSubDivisions(Integer.parseInt(node.getTextString()));
                break;
            case "patterns":
                Elements patternNodes = node.getElements();
                while (patternNodes.hasMoreElements()) {
                    Pattern p = Pattern.loadFromXML(patternNodes.next());
                    pattern.addPattern(p);
                }
                break;
        }
    }
    return pattern;
}
Also used : Pattern(blue.soundObject.pattern.Pattern) Element(electric.xml.Element) Elements(electric.xml.Elements)

Example 85 with Element

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

the class External method loadFromXML.

/*
     * (non-Javadoc)
     * 
     * @see blue.soundObject.SoundObject#loadFromXML(electric.xml.Element)
     */
public static SoundObject loadFromXML(Element data, Map<String, Object> objRefMap) throws Exception {
    External external = new External();
    SoundObjectUtilities.initBasicFromXML(data, external);
    Elements nodes = data.getElements();
    while (nodes.hasMoreElements()) {
        Element node = nodes.next();
        String nodeName = node.getName();
        switch(nodeName) {
            case "text":
                external.setText(node.getTextString());
                break;
            case "commandLine":
                external.setCommandLine(node.getTextString());
                break;
            case "syntaxType":
                external.setSyntaxType(node.getTextString());
                break;
        }
    }
    return external;
}
Also used : Element(electric.xml.Element) Elements(electric.xml.Elements)

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