Search in sources :

Example 1 with LayerGroup

use of blue.score.layers.LayerGroup 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 2 with LayerGroup

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

the class ScoreTopComponent method scoreBarScoreSelected.

/* SCORE BAR LISTENER METHODS */
// @Override
public void scoreBarScoreSelected(Score score, int scrollX, int scrollY) {
    if (this.currentTimeState != null) {
        this.currentTimeState.removePropertyChangeListener(this);
    }
    ScoreController.getInstance().setSelectedScoreObjects(null);
    this.clearAll();
    if (score != null) {
        layerPanel.removeAll();
        layerHeaderPanel.removeAll();
        for (LayerGroup layerGroup : score) {
            addPanelsForLayerGroup(-1, layerGroup, score.getTimeState());
        }
        checkSize();
        layerPanel.revalidate();
        layerHeaderPanel.revalidate();
        TimeState timeState = score.getTimeState();
        tempoEditor.setTimeState(timeState);
        tempoEditor.setVisible(true);
        tempoControlPanel.setVisible(true);
        timeBar.setRootTimeline(true);
        timeBar.setTimeState(timeState);
        timeProperties.setTimeState(timeState);
        mouseWheelListener.setTimeState(timeState);
        this.currentTimeState = timeState;
        timeState.addPropertyChangeListener(this);
        scrollPane.repaint();
        ModeManager.getInstance().setMode(ModeManager.getInstance().getMode());
        int startTime = (int) (data.getRenderStartTime() * timeState.getPixelSecond());
        int endTime = (int) (data.getRenderEndTime() * timeState.getPixelSecond());
        renderStartPointer.setVisible(true);
        renderLoopPointer.setVisible(true);
        renderTimePointer.setVisible(true);
        scorePanel.add(marquee, new Integer(500));
        marquee.setVisible(false);
        updateRenderStartPointerX(startTime, false);
        updateRenderLoopPointerX(endTime);
        renderTimePointer.setLocation(-1, 0);
        updateRenderTimePointer();
        layerHeaderPanel.repaint();
        setHorizontalScrollValue(scrollX);
        setVerticalScrollValue(scrollY);
    }
}
Also used : LayerGroup(blue.score.layers.LayerGroup) TimeState(blue.score.TimeState)

Example 3 with LayerGroup

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

the class Score method generateForCSD.

public NoteList generateForCSD(CompileData compileData, double startTime, double endTime) throws ScoreGenerationException {
    NoteList noteList = new NoteList();
    boolean soloFound = false;
    for (LayerGroup layerGroup : this) {
        soloFound = layerGroup.hasSoloLayers();
        if (soloFound) {
            break;
        }
    }
    for (LayerGroup layerGroup : this) {
        NoteList nl = layerGroup.generateForCSD(compileData, startTime, endTime, soloFound);
        noteList.merge(nl);
    }
    try {
        ScoreUtilities.applyNoteProcessorChain(noteList, this.npc);
    } catch (NoteProcessorException e) {
        throw new ScoreGenerationException(e);
    }
    return noteList;
}
Also used : NoteProcessorException(blue.noteProcessor.NoteProcessorException) NoteList(blue.soundObject.NoteList) LayerGroup(blue.score.layers.LayerGroup)

Example 4 with LayerGroup

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

the class Score method loadFromXML.

public static Score loadFromXML(Element data, Map<String, Object> objRefMap) throws Exception {
    Score score = new Score(false);
    Elements nodes = data.getElements();
    LayerGroupProviderManager manager = LayerGroupProviderManager.getInstance();
    while (nodes.hasMoreElements()) {
        Element node = nodes.next();
        switch(node.getName()) {
            case "tempo":
                score.tempo = Tempo.loadFromXML(node);
                break;
            case "timeState":
                score.timeState = TimeState.loadFromXML(node);
                break;
            case "noteProcessorChain":
                score.npc = NoteProcessorChain.loadFromXML(node);
                break;
            default:
                LayerGroup layerGroup = manager.loadFromXML(node, objRefMap);
                if (layerGroup == null) {
                    throw new RuntimeException("Unable to load Score LayerGroup of type: " + node.getName());
                }
                score.add(layerGroup);
                if (layerGroup instanceof PolyObject) {
                    ((PolyObject) layerGroup).setTimeBehavior(SoundObject.TIME_BEHAVIOR_NONE);
                }
                break;
        }
    }
    if (score.size() == 0) {
        PolyObject pObj = new PolyObject(true);
        score.add(pObj);
    }
    return score;
}
Also used : Element(electric.xml.Element) LayerGroup(blue.score.layers.LayerGroup) Elements(electric.xml.Elements) PolyObject(blue.soundObject.PolyObject) LayerGroupProviderManager(blue.score.layers.LayerGroupProviderManager)

Example 5 with LayerGroup

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

the class Score method saveAsXML.

public Element saveAsXML(Map<Object, String> objRefMap) {
    Element retVal = new Element("score");
    retVal.addElement(tempo.saveAsXML());
    retVal.addElement(timeState.saveAsXML());
    retVal.addElement(npc.saveAsXML());
    for (LayerGroup layerGroup : this) {
        retVal.addElement(layerGroup.saveAsXML(objRefMap));
    }
    return retVal;
}
Also used : Element(electric.xml.Element) LayerGroup(blue.score.layers.LayerGroup)

Aggregations

LayerGroup (blue.score.layers.LayerGroup)10 Score (blue.score.Score)2 Layer (blue.score.layers.Layer)2 LayerGroupProviderManager (blue.score.layers.LayerGroupProviderManager)2 PolyObject (blue.soundObject.PolyObject)2 Element (electric.xml.Element)2 SoundObjectLibrary (blue.SoundObjectLibrary)1 NoteProcessorException (blue.noteProcessor.NoteProcessorException)1 TimeState (blue.score.TimeState)1 LayerGroupProvider (blue.score.layers.LayerGroupProvider)1 ScoreObjectLayer (blue.score.layers.ScoreObjectLayer)1 NoteList (blue.soundObject.NoteList)1 SoundObject (blue.soundObject.SoundObject)1 LayerGroupUIProviderManager (blue.ui.core.score.layers.LayerGroupUIProviderManager)1 ObservableArrayList (blue.util.ObservableArrayList)1 Elements (electric.xml.Elements)1 Point (java.awt.Point)1 ActionEvent (java.awt.event.ActionEvent)1 ActionListener (java.awt.event.ActionListener)1 ArrayList (java.util.ArrayList)1