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