Search in sources :

Example 6 with BlueData

use of blue.BlueData in project blue by kunstmusik.

the class RevertAction method actionPerformed.

@Override
public void actionPerformed(ActionEvent actionEvent) {
    BlueProject project = BlueProjectManager.getInstance().getCurrentProject();
    if (project == null || project.getDataFile() == null) {
        return;
    }
    int retVal = JOptionPane.showConfirmDialog(WindowManager.getDefault().getMainWindow(), BlueSystem.getString("message.file.revert.text"), BlueSystem.getString("message.file.revert.title"), JOptionPane.YES_NO_CANCEL_OPTION);
    if (retVal == JOptionPane.YES_OPTION) {
        try {
            String text = TextUtilities.getTextFromFile(project.getDataFile());
            BlueData tempData;
            if (text.startsWith("<blueData")) {
                Document d = new Document(text);
                tempData = BlueData.loadFromXML(d.getElement("blueData"));
            } else {
                return;
            }
            project.setData(tempData);
            BlueProjectManager.getInstance().setCurrentProject(project);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
Also used : BlueData(blue.BlueData) BlueProject(blue.projects.BlueProject) Document(electric.xml.Document)

Example 7 with BlueData

use of blue.BlueData in project blue by kunstmusik.

the class SoundObjectLibraryTopComponent method reinitialize.

public void reinitialize() {
    BlueProject project = BlueProjectManager.getInstance().getCurrentProject();
    if (project != null) {
        BlueData currentData = project.getData();
        setSoundObjectLibrary(currentData.getSoundObjectLibrary());
    }
}
Also used : BlueData(blue.BlueData) BlueProject(blue.projects.BlueProject)

Example 8 with BlueData

use of blue.BlueData in project blue by kunstmusik.

the class ScoreObjectEditorTopComponent method editScoreObject.

public void editScoreObject(ScoreObject sObj) {
    if (currentSoundObject == sObj) {
        return;
    }
    currentSoundObject = sObj;
    cardLayout.show(editPanel, "none");
    if (sObj == null) {
        // JOptionPane.showMessageDialog(null, "yo");
        return;
    }
    ScoreObject sObjToEdit = sObj;
    BlueData data = BlueProjectManager.getInstance().getCurrentBlueData();
    if (sObj instanceof Instance) {
        sObjToEdit = ((Instance) sObj).getSoundObject();
        this.setEditingLibraryObject(SelectionEvent.SELECTION_LIBRARY);
    } else if (data.getSoundObjectLibrary().contains(sObjToEdit)) {
        this.setEditingLibraryObject(SelectionEvent.SELECTION_LIBRARY);
    } else {
        this.setEditingLibraryObject(null);
    }
    ScoreObjectEditor editor = editors.get(sObjToEdit.getClass());
    if (editor == null) {
        for (Class c : sObjEditorMap.keySet()) {
            if (c.isAssignableFrom(sObjToEdit.getClass())) {
                LazyPlugin<ScoreObjectEditor> plugin = sObjEditorMap.get(c);
                editor = plugin.getInstance();
                editors.put(sObjToEdit.getClass(), editor);
                editPanel.add(editor, editor.getClass().getName());
                break;
            }
        }
    }
    if (editor == null) {
        DialogDisplayer.getDefault().notify(new NotifyDescriptor("Could not find editor for SoundObject of type: " + sObjToEdit.getClass().getCanonicalName(), "Error", NotifyDescriptor.DEFAULT_OPTION, NotifyDescriptor.ERROR_MESSAGE, null, null));
        return;
    }
    editor.editScoreObject(sObjToEdit);
    cardLayout.show(editPanel, editor.getClass().getName());
// Logger.getLogger(ScoreObjectEditorTopComponent.class.getName()).fine("SoundObject Selected: " + className);;
}
Also used : NotifyDescriptor(org.openide.NotifyDescriptor) BlueData(blue.BlueData) Instance(blue.soundObject.Instance) ScoreObject(blue.score.ScoreObject) ScoreObjectEditor(blue.soundObject.editor.ScoreObjectEditor)

Example 9 with BlueData

use of blue.BlueData in project blue by kunstmusik.

the class ScoreTimeCanvas method reset.

public void reset() {
    SwingUtilities.invokeLater(() -> {
        Component[] components = sObjPanel.getComponents();
        for (int i = 0; i < components.length; i++) {
            Component c = components[i];
            if (c instanceof SoundObjectView) {
                SoundObjectView sObjView = (SoundObjectView) c;
                int index = getPolyObject().getSoundLayerIndex(sObjView.getSoundObject());
                if (index < 0) {
                    sObjView.cleanup();
                    sObjPanel.remove(c);
                    soundObjectToViewMap.remove(sObjView.getSoundObject());
                } else {
                    int newY = getPolyObject().getYForLayerNum(index);
                    int newHeight = getPolyObject().getSoundLayerHeight(index);
                    sObjView.updateView(newY, newHeight);
                }
            }
        }
        if (ScoreController.getInstance().getScorePath().getLastLayerGroup() == null) {
            BlueData data1 = BlueProjectManager.getInstance().getCurrentBlueData();
            if (data1 != null) {
                int startTime = (int) (data1.getRenderStartTime() * timeState.getPixelSecond());
                int endTime = (int) (data1.getRenderEndTime() * timeState.getPixelSecond());
            }
        }
        checkSize();
        automationPanel.revalidate();
        revalidate();
        repaint();
    });
}
Also used : BlueData(blue.BlueData) Component(java.awt.Component) Point(java.awt.Point)

Example 10 with BlueData

use of blue.BlueData in project blue by kunstmusik.

the class RealtimeRenderManager method auditionSoundObjects.

public void auditionSoundObjects(BlueData data, List<ScoreObject> scoreObjects) {
    if (scoreObjects == null || scoreObjects.isEmpty()) {
        return;
    }
    if (isRendering()) {
        stopRendering();
    }
    BlueData tempData = new BlueData(data);
    tempData.setLoopRendering(false);
    List<PolyObject> path = null;
    filterScore(tempData.getScore(), scoreObjects);
    if (data.getScore().isEmpty()) {
        throw new RuntimeException("Error: unable to find root LayerGroups for objects...");
    }
    double minTime = Double.MAX_VALUE;
    double maxTime = Double.MIN_VALUE;
    for (ScoreObject sObj : scoreObjects) {
        double startTime = sObj.getStartTime();
        double endTime = startTime + sObj.getSubjectiveDuration();
        if (startTime < minTime) {
            minTime = startTime;
        }
        if (endTime > maxTime) {
            maxTime = endTime;
        }
    }
    Mixer m = tempData.getMixer();
    if (m.isEnabled()) {
        maxTime += m.getExtraRenderTime();
    }
    tempData.setRenderStartTime(minTime);
    tempData.setRenderEndTime(maxTime);
    renderProject(tempData, true);
}
Also used : BlueData(blue.BlueData) Mixer(blue.mixer.Mixer) ScoreObject(blue.score.ScoreObject) PolyObject(blue.soundObject.PolyObject)

Aggregations

BlueData (blue.BlueData)46 BlueProject (blue.projects.BlueProject)18 PolyObject (blue.soundObject.PolyObject)9 File (java.io.File)9 SoundLayer (blue.SoundLayer)7 ScoreObject (blue.score.ScoreObject)7 Instance (blue.soundObject.Instance)6 CsdRenderResult (blue.services.render.CsdRenderResult)5 SoundObject (blue.soundObject.SoundObject)5 SoundObjectLibrary (blue.SoundObjectLibrary)4 Arrangement (blue.Arrangement)3 BlueSynthBuilder (blue.orchestra.BlueSynthBuilder)3 Layer (blue.score.layers.Layer)3 ScoreObjectLayer (blue.score.layers.ScoreObjectLayer)3 DiskRenderSettings (blue.settings.DiskRenderSettings)3 ScoreController (blue.ui.core.score.ScoreController)3 AddScoreObjectEdit (blue.ui.core.score.undo.AddScoreObjectEdit)3 Frame (java.awt.Frame)3 Point (java.awt.Point)3 IOException (java.io.IOException)3