use of blue.score.ScoreObject in project blue by kunstmusik.
the class PatternLayerPanel method setSObjFromBufferMenuItemActionPerformed.
// GEN-LAST:event_editSObjMenuItemActionPerformed
private void setSObjFromBufferMenuItemActionPerformed(java.awt.event.ActionEvent evt) {
// GEN-FIRST:event_setSObjFromBufferMenuItemActionPerformed
ScoreController controller = ScoreController.getInstance();
ScoreController.ScoreObjectBuffer buffer = controller.getScoreObjectBuffer();
if (buffer.scoreObjects.size() == 1) {
ScoreObject scoreObj = buffer.scoreObjects.get(0);
if (!(scoreObj instanceof SoundObject)) {
return;
}
SoundObject sObj = (SoundObject) scoreObj;
SoundObject copy = sObj.deepCopy();
copy.setStartTime(0.0f);
copy.setSubjectiveDuration(4);
copy.setTimeBehavior(SoundObject.TIME_BEHAVIOR_NONE);
patternLayer.setSoundObject(copy);
editSoundObject();
}
}
use of blue.score.ScoreObject in project blue by kunstmusik.
the class MoveScoreObjectsListener method mousePressed.
@Override
public void mousePressed(MouseEvent e) {
if (currentScoreObjectView == null || !SwingUtilities.isLeftMouseButton(e)) {
return;
}
ScoreObject scoreObj = currentScoreObjectView.getScoreObject();
Collection<? extends ScoreObject> temp = ScoreController.getInstance().getSelectedScoreObjects();
if (!temp.contains(scoreObj)) {
return;
}
e.consume();
ScorePath scorePath = ScoreController.getInstance().getScorePath();
startPoint = e.getPoint();
selectedScoreObjects = temp.toArray(new ScoreObject[0]);
startTimes = new double[selectedScoreObjects.length];
startLayerIndices = new int[selectedScoreObjects.length];
currentLayerIndices = new int[selectedScoreObjects.length];
minDiffTime = Double.MAX_VALUE;
startLayer = scorePath.getGlobalLayerIndexForY(e.getY());
lastLayerAdjust = 0;
minYAdjust = Integer.MIN_VALUE;
maxYAdjust = Integer.MAX_VALUE;
initialDrag = true;
List<Layer> allLayers = scorePath.getAllLayers();
for (int i = 0; i < selectedScoreObjects.length; i++) {
startTimes[i] = selectedScoreObjects[i].getStartTime();
if (startTimes[i] < minDiffTime) {
minDiffTime = startTimes[i];
}
startLayerIndices[i] = currentLayerIndices[i] = scorePath.getGlobalLayerIndexForScoreObject(selectedScoreObjects[i]);
int minY = getMinYAdjust(allLayers, scoreObj, startLayerIndices[i]);
int maxY = getMaxYAdjust(allLayers, scoreObj, startLayerIndices[i]);
minYAdjust = (minY > minYAdjust) ? minY : minYAdjust;
maxYAdjust = (maxY < maxYAdjust) ? maxY : maxYAdjust;
}
minDiffTime = -minDiffTime;
}
use of blue.score.ScoreObject in project blue by kunstmusik.
the class MultiLineMoveMouseListener method mousePressed.
@Override
public void mousePressed(MouseEvent e) {
if (!isMultiLineMode()) {
return;
}
AlphaMarquee marquee = scoreTC.getMarquee();
Point p = SwingUtilities.convertPoint(scoreTC.getScorePanel(), e.getPoint(), marquee);
if (!marquee.isVisible() || !marquee.contains(p)) {
return;
}
e.consume();
RealtimeRenderManager.getInstance().stopAuditioning();
timeState = scoreTC.getTimeState();
startX = e.getX();
minTranslation = -selection.getStartTime();
Collection<? extends ScoreObject> selectedObjects = ScoreController.getInstance().getSelectedScoreObjects();
selectedScoreObjects = selectedObjects.toArray(new ScoreObject[0]);
startTimes = new double[selectedScoreObjects.length];
for (int i = 0; i < selectedScoreObjects.length; i++) {
ScoreObject sObj = selectedScoreObjects[i];
startTimes[i] = sObj.getStartTime();
minTranslation = Math.max(minTranslation, -startTimes[i]);
}
selection.startTranslation();
}
use of blue.score.ScoreObject in project blue by kunstmusik.
the class MultiLineMoveMouseListener method mouseDragged.
@Override
public void mouseDragged(MouseEvent e) {
if (!isMultiLineMode()) {
return;
}
e.consume();
AlphaMarquee marquee = scoreTC.getMarquee();
if (SwingUtilities.isLeftMouseButton(e)) {
int x = e.getX();
int diffX = x - startX;
double translation = diffX / (double) timeState.getPixelSecond();
if (timeState.isSnapEnabled() && !e.isControlDown()) {
double newTime = ScoreUtilities.getSnapValueMove(-minTranslation + translation, timeState.getSnapValue());
translation = newTime + minTranslation;
}
translation = Math.max(translation, minTranslation);
selection.updateTranslation(translation);
int marqueeX = (int) ((marquee.startTime + translation) * timeState.getPixelSecond());
marquee.setLocation(marqueeX, marquee.getY());
for (int i = 0; i < selectedScoreObjects.length; i++) {
ScoreObject sObj = selectedScoreObjects[i];
sObj.setStartTime(startTimes[i] + translation);
}
}
checkScroll(e);
}
use of blue.score.ScoreObject in project blue by kunstmusik.
the class SoundObjectPropertiesTopComponent method updateRepeatPoint.
protected void updateRepeatPoint() {
if (!(sObj instanceof ScoreObject)) {
return;
}
SoundObject soundObj = (SoundObject) sObj;
double initialRepeatPoint = soundObj.getRepeatPoint();
double newValue;
try {
newValue = Double.parseDouble(repeatePointText.getText());
} catch (NumberFormatException nfe) {
repeatePointText.setText(Double.toString(initialRepeatPoint));
return;
}
if (newValue <= 0.0f) {
repeatePointText.setText(Double.toString(initialRepeatPoint));
return;
} else {
soundObj.setRepeatPoint(newValue);
repeatePointText.setText(Double.toString(newValue));
}
}
Aggregations