Search in sources :

Example 1 with Layer

use of blue.score.layers.Layer in project blue by kunstmusik.

the class PolyObject method newLayerAt.

/* LAYER GROUP INTERFACE */
@Override
public SoundLayer newLayerAt(int index) {
    SoundLayer sLayer = new SoundLayer();
    sLayer.setHeightIndex(getDefaultHeightIndex());
    int insertIndex = index;
    if (index < 0 || index >= this.size()) {
        insertIndex = this.size();
        this.add(sLayer);
    } else {
        this.add(index, sLayer);
    }
    ArrayList<Layer> layers = new ArrayList<>();
    layers.add(sLayer);
    LayerGroupDataEvent lde = new LayerGroupDataEvent(this, LayerGroupDataEvent.DATA_ADDED, insertIndex, insertIndex, layers);
    fireLayerGroupDataEvent(lde);
    return sLayer;
}
Also used : ArrayList(java.util.ArrayList) Layer(blue.score.layers.Layer) LayerGroupDataEvent(blue.score.layers.LayerGroupDataEvent)

Example 2 with Layer

use of blue.score.layers.Layer in project blue by kunstmusik.

the class Score method getGlobalLayerIndexForY.

public int getGlobalLayerIndexForY(int y) {
    int runningY = 0;
    int runningIndex = 0;
    for (LayerGroup<? extends Layer> layerGroup : this) {
        for (Layer layer : layerGroup) {
            if (y <= runningY + layer.getLayerHeight()) {
                return runningIndex;
            }
            runningY += layer.getLayerHeight();
            runningIndex += 1;
        }
        if (y <= runningY + SPACER) {
            return runningIndex;
        }
        runningY += SPACER;
    }
    return runningIndex - 1;
}
Also used : Layer(blue.score.layers.Layer) ScoreObjectLayer(blue.score.layers.ScoreObjectLayer)

Example 3 with Layer

use of blue.score.layers.Layer in project blue by kunstmusik.

the class Score method getLayerGroupsForScoreObjects.

public List<LayerGroup> getLayerGroupsForScoreObjects(Collection<? extends ScoreObject> scoreObjects) {
    List<LayerGroup> retVal = new ArrayList<>();
    for (LayerGroup<? extends Layer> layerGroup : this) {
        for (Layer layer : layerGroup) {
            boolean found = false;
            if (layer instanceof ScoreObjectLayer) {
                ScoreObjectLayer scoreLayer = (ScoreObjectLayer) layer;
                if (!Collections.disjoint(scoreLayer, scoreObjects)) {
                    retVal.add(layerGroup);
                    found = true;
                }
            }
            if (found) {
                break;
            }
        }
    }
    return retVal;
}
Also used : ScoreObjectLayer(blue.score.layers.ScoreObjectLayer) ObservableArrayList(blue.util.ObservableArrayList) ArrayList(java.util.ArrayList) LayerGroup(blue.score.layers.LayerGroup) Layer(blue.score.layers.Layer) ScoreObjectLayer(blue.score.layers.ScoreObjectLayer)

Example 4 with Layer

use of blue.score.layers.Layer in project blue by kunstmusik.

the class AudioLayersPanel method layerGroupChanged.

@Override
public void layerGroupChanged(final LayerGroupDataEvent event) {
    final ArrayList<Layer> layers = event.getLayers();
    SwingUtilities.invokeLater(new Runnable() {

        @Override
        public void run() {
            if (event.getType() == LayerGroupDataEvent.DATA_ADDED) {
                for (Layer layer : layers) {
                    ((AudioLayer) layer).addPropertyChangeListener(heightListener);
                    ((AudioLayer) layer).addAudioLayerListener(AudioLayersPanel.this);
                    for (AudioClip clip : (AudioLayer) layer) {
                        addClipPanel(clip, timeState, 0, 0);
                    }
                }
            } else if (event.getType() == LayerGroupDataEvent.DATA_REMOVED) {
                for (Layer layer : layers) {
                    ((AudioLayer) layer).removePropertyChangeListener(heightListener);
                    ((AudioLayer) layer).removeAudioLayerListener(AudioLayersPanel.this);
                    for (AudioClip clip : (AudioLayer) layer) {
                        removeClipPanel(clip);
                    }
                }
            }
            updateAudioClipYandHeight();
            checkSize();
            repaint();
        }
    });
}
Also used : AudioClip(blue.score.layers.audio.core.AudioClip) AudioLayer(blue.score.layers.audio.core.AudioLayer) AudioLayer(blue.score.layers.audio.core.AudioLayer) Layer(blue.score.layers.Layer)

Example 5 with Layer

use of blue.score.layers.Layer in project blue by kunstmusik.

the class AudioLayerGroup method removeLayers.

@Override
public void removeLayers(int startIndex, int endIndex) {
    ArrayList<Layer> layers = new ArrayList<>();
    for (int i = endIndex; i >= startIndex; i--) {
        AudioLayer audioLayer = this.get(i);
        audioLayer.clearListeners();
        this.remove(i);
        layers.add(audioLayer);
    }
    LayerGroupDataEvent lde = new LayerGroupDataEvent(this, LayerGroupDataEvent.DATA_REMOVED, startIndex, endIndex, layers);
    fireLayerGroupDataEvent(lde);
}
Also used : ArrayList(java.util.ArrayList) Layer(blue.score.layers.Layer) LayerGroupDataEvent(blue.score.layers.LayerGroupDataEvent)

Aggregations

Layer (blue.score.layers.Layer)33 ScoreObjectLayer (blue.score.layers.ScoreObjectLayer)18 ArrayList (java.util.ArrayList)17 ScoreObject (blue.score.ScoreObject)13 Point (java.awt.Point)10 SoundLayer (blue.SoundLayer)9 LayerGroupDataEvent (blue.score.layers.LayerGroupDataEvent)6 ScorePath (blue.ui.core.score.ScorePath)6 SoundObject (blue.soundObject.SoundObject)4 BlueData (blue.BlueData)3 ScoreController (blue.ui.core.score.ScoreController)3 AddScoreObjectEdit (blue.ui.core.score.undo.AddScoreObjectEdit)3 MoveScoreObjectsEdit (blue.ui.core.score.undo.MoveScoreObjectsEdit)3 SoundObjectLibrary (blue.SoundObjectLibrary)2 AlphaMarquee (blue.components.AlphaMarquee)2 Score (blue.score.Score)2 LayerGroup (blue.score.layers.LayerGroup)2 GenericScore (blue.soundObject.GenericScore)2 Instance (blue.soundObject.Instance)2 PolyObject (blue.soundObject.PolyObject)2