Search in sources :

Example 86 with Element

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

the class Instance method saveAsXML.

/*
     * (non-Javadoc)
     *
     * @see blue.soundObject.SoundObject#saveAsXML()
     */
@Override
public Element saveAsXML(Map<Object, String> objRefMap) {
    Element retVal = SoundObjectUtilities.getBasicXML(this);
    retVal.addElement("soundObjectReference").setAttribute("soundObjectLibraryID", objRefMap.get(this.getSoundObject()));
    return retVal;
}
Also used : Element(electric.xml.Element)

Example 87 with Element

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

the class ObjectBuilder method loadFromXML.

/*
     * (non-Javadoc)
     * 
     * @see blue.soundObject.SoundObject#loadFromXML(electric.xml.Element)
     */
public static SoundObject loadFromXML(Element data, Map<String, Object> objRefMap) throws Exception {
    ObjectBuilder bsb = new ObjectBuilder();
    SoundObjectUtilities.initBasicFromXML(data, bsb);
    String editEnabledStr = data.getAttributeValue("editEnabled");
    if (editEnabledStr != null) {
        bsb.setEditEnabled(Boolean.valueOf(editEnabledStr).booleanValue());
    }
    Elements nodes = data.getElements();
    while (nodes.hasMoreElements()) {
        Element node = nodes.next();
        String nodeName = node.getName();
        switch(nodeName) {
            case "code":
                bsb.setCode(node.getTextString());
                break;
            case "commandLine":
                bsb.setCommandLine(node.getTextString());
                break;
            case "isExternal":
                // For Blue version < 2.7.2
                if (XMLUtilities.readBoolean(node)) {
                    bsb.setLanguageType(LanguageType.EXTERNAL);
                } else {
                    bsb.setLanguageType(LanguageType.PYTHON);
                }
                ;
                break;
            case "graphicInterface":
                bsb.setGraphicInterface(BSBGraphicInterface.loadFromXML(node));
                break;
            case "presetGroup":
                bsb.setPresetGroup(PresetGroup.loadFromXML(node));
                break;
            case "comment":
                bsb.setComment(node.getTextString());
                break;
            case "languageType":
                bsb.setLanguageType(LanguageType.valueOf(node.getTextString()));
                break;
        }
    }
    return bsb;
}
Also used : Element(electric.xml.Element) Elements(electric.xml.Elements)

Example 88 with Element

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

the class FrozenSoundObject method saveAsXML.

/*
     * (non-Javadoc)
     *
     * @see blue.soundObject.SoundObject#saveAsXML()
     */
@Override
public Element saveAsXML(Map<Object, String> objRefMap) {
    Element retVal = SoundObjectUtilities.getBasicXML(this);
    retVal.addElement("numChannels").setText(Integer.toString(this.getNumChannels()));
    retVal.addElement("frozenWaveFileName").setText(this.getFrozenWaveFileName());
    retVal.addElement(this.getFrozenSoundObject().saveAsXML(objRefMap));
    return retVal;
}
Also used : Element(electric.xml.Element)

Example 89 with Element

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

the class Accumulator method saveAsXML.

public Element saveAsXML() {
    Element retVal = new Element("accumulator");
    Element hTableNode = highTable.saveAsXML();
    hTableNode.setAttribute("tableId", "highTable");
    retVal.addElement(hTableNode);
    Element lTableNode = lowTable.saveAsXML();
    lTableNode.setAttribute("tableId", "lowTable");
    retVal.addElement(lTableNode);
    retVal.addElement(XMLUtilities.writeBoolean("highTableEnabled", highTableEnabled));
    retVal.addElement(XMLUtilities.writeBoolean("lowTableEnabled", lowTableEnabled));
    retVal.addElement(XMLUtilities.writeInt("mode", mode));
    retVal.addElement(XMLUtilities.writeDouble("low", low));
    retVal.addElement(XMLUtilities.writeDouble("high", high));
    retVal.addElement(XMLUtilities.writeDouble("initialValue", initialValue));
    retVal.addElement(XMLUtilities.writeBoolean("enabled", enabled));
    return retVal;
}
Also used : Element(electric.xml.Element)

Example 90 with Element

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

the class PianoRoll method saveAsXML.

@Override
public Element saveAsXML(Map<Object, String> objRefMap) {
    Element retVal = SoundObjectUtilities.getBasicXML(this);
    retVal.addElement("noteTemplate").setText(getNoteTemplate());
    retVal.addElement("instrumentId").setText(getInstrumentId());
    retVal.addElement(scale.saveAsXML());
    retVal.addElement("pixelSecond").setText(Integer.toString(this.getPixelSecond()));
    retVal.addElement("noteHeight").setText(Integer.toString(this.getNoteHeight()));
    retVal.addElement("snapEnabled").setText(Boolean.toString(this.isSnapEnabled()));
    retVal.addElement("snapValue").setText(Double.toString(this.getSnapValue()));
    retVal.addElement("timeDisplay").setText(Integer.toString(this.getTimeDisplay()));
    retVal.addElement("timeUnit").setText(Integer.toString(this.getTimeUnit()));
    retVal.addElement("pchGenerationMethod").setText(Integer.toString(this.getPchGenerationMethod()));
    retVal.addElement("transposition").setText(Integer.toString(this.getTransposition()));
    for (Iterator<PianoNote> iter = notes.iterator(); iter.hasNext(); ) {
        PianoNote note = iter.next();
        retVal.addElement(note.saveAsXML());
    }
    return retVal;
}
Also used : Element(electric.xml.Element) PianoNote(blue.soundObject.pianoRoll.PianoNote)

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