Search in sources :

Example 1 with Line

use of blue.components.lines.Line in project blue by kunstmusik.

the class BSBLineObject method setupForCompilation.

@Override
public void setupForCompilation(BSBCompilationUnit compilationUnit) {
    for (Iterator iter = lines.iterator(); iter.hasNext(); ) {
        Line line = (Line) iter.next();
        String key = getObjectName() + "_" + line.getVarName();
        String val = getLineString(line);
        compilationUnit.addReplacementValue(key, val);
    }
}
Also used : Line(blue.components.lines.Line) Iterator(java.util.Iterator)

Example 2 with Line

use of blue.components.lines.Line in project blue by kunstmusik.

the class BSBLineObject method setPresetValue.

@Override
public void setPresetValue(String val) {
    String[] parts = val.split("@_@");
    int version = 1;
    int startIndex = 0;
    if (parts[0].startsWith("version=")) {
        version = Integer.parseInt(parts[0].substring(8));
        startIndex = 1;
    }
    for (int i = startIndex; i < parts.length; i++) {
        String lineStr = parts[i];
        // System.out.println(lineStr);
        String[] vals = lineStr.split(":");
        String name = vals[0];
        Line line = getLineByName(name);
        if (line != null) {
            line.clear();
            double min = line.getMin();
            double max = line.getMax();
            double range = max - min;
            for (int j = 1; j < vals.length; j += 2) {
                LinePoint p = new LinePoint();
                double x = (Double.parseDouble(vals[j]));
                double y = (Double.parseDouble(vals[j + 1]));
                if (version == 1) {
                    y = (y * range) + min;
                }
                p.setLocation(x, y);
                line.addLinePoint(p);
            }
        }
    }
    if (propListeners != null) {
        propListeners.firePropertyChange("presetValue", null, "preset");
    }
}
Also used : Line(blue.components.lines.Line) LinePoint(blue.components.lines.LinePoint) LinePoint(blue.components.lines.LinePoint)

Example 3 with Line

use of blue.components.lines.Line in project blue by kunstmusik.

the class BSBLineObject method getPresetValue.

@Override
public String getPresetValue() {
    StringBuilder buffer = new StringBuilder();
    buffer.append("version=2");
    for (Iterator iter = lines.iterator(); iter.hasNext(); ) {
        buffer.append("@_@");
        Line line = (Line) iter.next();
        StringBuilder temp = new StringBuilder();
        temp.append(line.getVarName());
        for (int i = 0; i < line.size(); i++) {
            LinePoint pt = line.getLinePoint(i);
            temp.append(":").append(pt.getX());
            temp.append(":").append(pt.getY());
        }
        buffer.append(temp.toString());
    }
    // System.out.println(buffer.toString());
    return buffer.toString();
}
Also used : Line(blue.components.lines.Line) LinePoint(blue.components.lines.LinePoint) Iterator(java.util.Iterator) LinePoint(blue.components.lines.LinePoint)

Example 4 with Line

use of blue.components.lines.Line 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 5 with Line

use of blue.components.lines.Line in project blue by kunstmusik.

the class Sound method adjustLineType.

protected void adjustLineType(Parameter param) {
    final Line line = param.getLine();
    if (!(line instanceof SoundObjectParameterLine)) {
        final SoundObjectParameterLine soundObjectParameterLine = new SoundObjectParameterLine(Sound.this, line);
        param.setLine(soundObjectParameterLine);
    }
}
Also used : SoundObjectParameterLine(blue.components.lines.SoundObjectParameterLine) Line(blue.components.lines.Line) SoundObjectParameterLine(blue.components.lines.SoundObjectParameterLine)

Aggregations

Line (blue.components.lines.Line)35 LinePoint (blue.components.lines.LinePoint)22 Point (java.awt.Point)11 SoundObjectParameterLine (blue.components.lines.SoundObjectParameterLine)4 Color (java.awt.Color)4 Iterator (java.util.Iterator)4 Graphics2D (java.awt.Graphics2D)3 RenderingHints (java.awt.RenderingHints)3 ModeManager (blue.ui.core.score.ModeManager)2 Element (electric.xml.Element)2 Elements (electric.xml.Elements)2 Rectangle (java.awt.Rectangle)2 BigDecimal (java.math.BigDecimal)2 GraphicsContext (javafx.scene.canvas.GraphicsContext)2 Color (javafx.scene.paint.Color)2 StrBuilder (org.apache.commons.lang3.text.StrBuilder)2 GenericInstrument (blue.orchestra.GenericInstrument)1 LineSelector (blue.orchestra.editor.blueSynthBuilder.jfx.LineSelector)1 ParameterLineView (blue.soundObject.editor.sound.ParameterLineView)1 TimeBar (blue.soundObject.editor.sound.TimeBar)1