Search in sources :

Example 61 with Elements

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

the class AudioLayer method loadFromXML.

public static AudioLayer loadFromXML(Element data) {
    AudioLayer layer = new AudioLayer();
    layer.setName(data.getAttributeValue("name"));
    layer.setMuted(Boolean.valueOf(data.getAttributeValue("muted")).booleanValue());
    layer.setSolo(Boolean.valueOf(data.getAttributeValue("solo")).booleanValue());
    if (data.getAttribute("uniqueId") != null) {
        layer.uniqueId = data.getAttributeValue("uniqueId");
    }
    String heightIndexStr = data.getAttributeValue("heightIndex");
    if (heightIndexStr != null) {
        layer.setHeightIndex(Integer.parseInt(heightIndexStr));
    }
    Elements nodes = data.getElements();
    while (nodes.hasMoreElements()) {
        Element node = nodes.next();
        switch(node.getName()) {
            case "audioClip":
                layer.add(AudioClip.loadFromXML(node));
                break;
            case "parameterId":
                String id = node.getTextString();
                layer.automationParameters.addParameterId(id);
                break;
        }
    }
    return layer;
}
Also used : Element(electric.xml.Element) Elements(electric.xml.Elements)

Example 62 with Elements

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

the class CeciliaModule method loadFromXML.

/*
     * (non-Javadoc)
     * 
     * @see blue.soundObject.SoundObject#loadFromXML(electric.xml.Element)
     */
public static SoundObject loadFromXML(Element data, Map<String, Object> objRefMap) throws Exception {
    CeciliaModule ceciliaModule = new CeciliaModule();
    SoundObjectUtilities.initBasicFromXML(data, ceciliaModule);
    ceciliaModule.setOrchestraVersion(Integer.parseInt(data.getTextString("orchestraVersion")));
    ceciliaModule.setGenSize(data.getTextString("genSize"));
    ceciliaModule.setModuleDefinition(ModuleDefinition.loadFromXML(data.getElement("moduleDefinition")));
    Elements stateNodes = data.getElements("ceciliaObject");
    while (stateNodes.hasMoreElements()) {
        Element elem = stateNodes.next();
        String key = elem.getAttributeValue("nameKey");
        CeciliaObject cObj = (CeciliaObject) ObjectUtilities.loadFromXML(elem);
        ceciliaModule.stateData.put(key, cObj);
    }
    return ceciliaModule;
}
Also used : CeciliaObject(blue.soundObject.ceciliaModule.CeciliaObject) Element(electric.xml.Element) Elements(electric.xml.Elements)

Example 63 with Elements

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

the class CGraph method loadFromXML.

public static CeciliaObject loadFromXML(Element data) {
    CGraph cgraph = new CGraph();
    CeciliaObject.initBasicFromXML(data, cgraph);
    cgraph.setMin(Double.parseDouble(data.getTextString("min")));
    cgraph.setMax(Double.parseDouble(data.getTextString("max")));
    cgraph.setUnit(data.getTextString("unit"));
    cgraph.setRel(Integer.parseInt(data.getTextString("rel")));
    cgraph.setGen(Integer.parseInt(data.getTextString("gen")));
    cgraph.setSize(Integer.parseInt(data.getTextString("size")));
    String color = data.getTextString("color");
    cgraph.setColor(color == null ? "" : color);
    Elements pointNodes = data.getElements("cgraphPoint");
    while (pointNodes.hasMoreElements()) {
        CGraphPoint cgp = CGraphPoint.loadFromXML(pointNodes.next());
        cgraph.points.add(cgp);
    }
    return cgraph;
}
Also used : Elements(electric.xml.Elements)

Example 64 with Elements

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

the class AudioClip method loadFromXML.

public static AudioClip loadFromXML(Element data) {
    AudioClip clip = new AudioClip();
    Elements nodes = data.getElements();
    while (nodes.hasMoreElements()) {
        final Element node = nodes.next();
        final String nodeText = node.getTextString();
        switch(node.getName()) {
            case "name":
                clip.setName(nodeText);
                break;
            case "audioFile":
                clip.setAudioFile(new File(nodeText));
                break;
            case "numChannels":
                clip.numChannels = XMLUtilities.readInt(node);
                break;
            case "audioDuration":
                clip.setAudioDuration(XMLUtilities.readDouble(node));
                break;
            case "fileStart":
                clip.setFileStartTime(XMLUtilities.readDouble(node));
                break;
            case "start":
                clip.setStart(XMLUtilities.readDouble(node));
                break;
            case "duration":
                clip.setDuration(XMLUtilities.readDouble(node));
                break;
            case "backgroundColor":
                String colorStr = data.getTextString("backgroundColor");
                clip.setBackgroundColor(new Color(Integer.parseInt(colorStr)));
                break;
            case "fadeIn":
                clip.setFadeIn(XMLUtilities.readDouble(node));
                break;
            case "fadeInType":
                clip.setFadeInType(FadeType.fromString(nodeText));
                break;
            case "fadeOut":
                clip.setFadeOut(XMLUtilities.readDouble(node));
                break;
            case "fadeOutType":
                clip.setFadeOutType(FadeType.fromString(nodeText));
                break;
        }
    }
    return clip;
}
Also used : Element(electric.xml.Element) Color(java.awt.Color) Elements(electric.xml.Elements) File(java.io.File)

Example 65 with Elements

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

the class BlueShare method selectServer.

private static String selectServer() {
    String retVal = null;
    // get server list from disk
    try {
        Document doc = new Document(new File(BlueSystem.getConfDir() + File.separator + "blueShare.xml"));
        Element root = doc.getRoot();
        Elements servers = root.getElements("server");
        Object[] serverOptions = new Object[servers.size()];
        int i = 0;
        while (servers.hasMoreElements()) {
            serverOptions[i] = servers.next().getTextString();
            i++;
        }
        Object serverObj = JOptionPane.showInputDialog(null, BlueSystem.getString("blueShare.selectServer.message"), BlueSystem.getString("blueShare.selectServer.title"), JOptionPane.PLAIN_MESSAGE, null, serverOptions, serverOptions[0]);
        if (serverObj != null) {
            retVal = serverObj.toString();
        }
    } catch (ParseException | HeadlessException e) {
        e.printStackTrace();
    }
    return retVal;
}
Also used : HeadlessException(java.awt.HeadlessException) Element(electric.xml.Element) ParseException(electric.xml.ParseException) Document(electric.xml.Document) Elements(electric.xml.Elements) File(java.io.File)

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