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;
}
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);
}
}
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;
}
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;
}
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;
}
Aggregations