Search in sources :

Example 1 with ScoreObject

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();
    }
}
Also used : ScoreController(blue.ui.core.score.ScoreController) SoundObject(blue.soundObject.SoundObject) ScoreObject(blue.score.ScoreObject)

Example 2 with ScoreObject

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;
}
Also used : ScorePath(blue.ui.core.score.ScorePath) ScoreObject(blue.score.ScoreObject) Layer(blue.score.layers.Layer) ScoreObjectLayer(blue.score.layers.ScoreObjectLayer) Point(java.awt.Point)

Example 3 with ScoreObject

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();
}
Also used : ScoreObject(blue.score.ScoreObject) Point(java.awt.Point) AlphaMarquee(blue.components.AlphaMarquee) Point(java.awt.Point)

Example 4 with ScoreObject

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);
}
Also used : ScoreObject(blue.score.ScoreObject) AlphaMarquee(blue.components.AlphaMarquee) Point(java.awt.Point)

Example 5 with ScoreObject

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));
    }
}
Also used : SoundObject(blue.soundObject.SoundObject) ScoreObject(blue.score.ScoreObject)

Aggregations

ScoreObject (blue.score.ScoreObject)39 ScoreObjectLayer (blue.score.layers.ScoreObjectLayer)13 Layer (blue.score.layers.Layer)12 ArrayList (java.util.ArrayList)9 Point (java.awt.Point)8 BlueData (blue.BlueData)6 SoundObject (blue.soundObject.SoundObject)6 ScorePath (blue.ui.core.score.ScorePath)6 SoundLayer (blue.SoundLayer)5 AlignEdit (blue.ui.core.score.undo.AlignEdit)5 Instance (blue.soundObject.Instance)4 PolyObject (blue.soundObject.PolyObject)4 ScoreController (blue.ui.core.score.ScoreController)4 AddScoreObjectEdit (blue.ui.core.score.undo.AddScoreObjectEdit)4 MoveScoreObjectsEdit (blue.ui.core.score.undo.MoveScoreObjectsEdit)4 SoundObjectLibrary (blue.SoundObjectLibrary)2 AlphaMarquee (blue.components.AlphaMarquee)2 Score (blue.score.Score)2 GenericScore (blue.soundObject.GenericScore)2 Test (org.junit.Test)2