Search in sources :

Example 26 with SoundLayer

use of blue.SoundLayer in project blue by kunstmusik.

the class ScoreTimeCanvas method setPolyObject.

public void setPolyObject(PolyObject pObj, TimeState timeState) {
    Component[] components = sObjPanel.getComponents();
    for (int i = 0; i < components.length; i++) {
        Component c = components[i];
        if (c instanceof SoundObjectView) {
            SoundObjectView sObjView = (SoundObjectView) c;
            sObjView.cleanup();
        }
    }
    sObjPanel.removeAll();
    this.soundObjectToViewMap.clear();
    marquee.setVisible(false);
    if (this.getPolyObject() != null) {
        this.timeState.removePropertyChangeListener(this);
        this.getPolyObject().removeLayerGroupListener(this);
        SoundLayer tempLayer;
        for (int i = 0; i < pObj.size(); i++) {
            tempLayer = pObj.get(i);
            tempLayer.removePropertyChangeListener(heightListener);
            tempLayer.removeSoundLayerListener(this);
        }
    }
    this.pObj = pObj;
    this.timeState = timeState;
    dropTargetListener.setTimeState(timeState);
    if (this.getPolyObject() != null) {
        timeState.addPropertyChangeListener(this);
        pObj.addLayerGroupListener(this);
    }
    this.automationPanel.setLayerGroup(pObj, timeState);
    // content.set(Collections.emptyList(), null);
    // TODO - REFACTOR THIS OUT TO POLY OBJECT CONTROLLER
    SoundLayer tempLayer;
    List<SoundObject> sObjects;
    int size = pObj.size();
    if (size != 0) {
        for (int i = 0; i < size; i++) {
            tempLayer = pObj.get(i);
            tempLayer.addPropertyChangeListener(heightListener);
            tempLayer.addSoundLayerListener(this);
            for (SoundObject tempSObj : tempLayer) {
                addSoundObjectView(i, tempSObj);
            }
        }
    } else {
        JOptionPane.showMessageDialog(null, "ScoreTimeCanvas: setPObj found size == 0");
    }
    this.checkSize(true);
    this.revalidate();
    this.repaint();
}
Also used : SoundObject(blue.soundObject.SoundObject) SoundLayer(blue.SoundLayer) Component(java.awt.Component) Point(java.awt.Point)

Example 27 with SoundLayer

use of blue.SoundLayer in project blue by kunstmusik.

the class SoundObjectLibraryUtils method removeSoundObjectInstances.

protected static void removeSoundObjectInstances(PolyObject polyObject, SoundObject sObj) {
    for (int i = 0; i < polyObject.size(); i++) {
        SoundLayer layer = polyObject.get(i);
        ArrayList<SoundObject> instances = new ArrayList<>();
        for (SoundObject tempObject : layer) {
            if (tempObject instanceof Instance) {
                Instance instance = (Instance) tempObject;
                if (instance.getSoundObject() == sObj) {
                    instances.add(instance);
                }
            } else if (tempObject instanceof PolyObject) {
                removeSoundObjectInstances((PolyObject) tempObject, sObj);
            }
        }
        for (SoundObject tempObject : instances) {
            layer.remove(tempObject);
        }
    }
}
Also used : SoundObject(blue.soundObject.SoundObject) Instance(blue.soundObject.Instance) SoundLayer(blue.SoundLayer) ArrayList(java.util.ArrayList) PolyObject(blue.soundObject.PolyObject)

Aggregations

SoundLayer (blue.SoundLayer)27 SoundObject (blue.soundObject.SoundObject)10 PolyObject (blue.soundObject.PolyObject)9 Point (java.awt.Point)8 Layer (blue.score.layers.Layer)6 Instance (blue.soundObject.Instance)6 BlueData (blue.BlueData)5 ScoreObject (blue.score.ScoreObject)5 GenericScore (blue.soundObject.GenericScore)5 ArrayList (java.util.ArrayList)5 Score (blue.score.Score)3 AddScoreObjectEdit (blue.ui.core.score.undo.AddScoreObjectEdit)3 Test (org.junit.Test)3 SoundObjectLibrary (blue.SoundObjectLibrary)2 ScoreObjectLayer (blue.score.layers.ScoreObjectLayer)2 Parameter (blue.automation.Parameter)1 LinePoint (blue.components.lines.LinePoint)1 BlueSynthBuilder (blue.orchestra.BlueSynthBuilder)1 External (blue.soundObject.External)1 NoteList (blue.soundObject.NoteList)1