use of blue.score.Score in project blue by kunstmusik.
the class BlueProjectPropertyChangeListener method detachListeners.
protected void detachListeners(BlueProject project) {
if (project == null) {
return;
}
Score score = project.getData().getScore();
for (LayerGroup<? extends Layer> lg : score) {
if (lg instanceof AudioLayerGroup) {
lg.removeLayerGroupListener(layerGroupListener);
}
}
score.removeListener(scoreListener);
}
use of blue.score.Score in project blue by kunstmusik.
the class BlueProjectManager method setCurrentProject.
public void setCurrentProject(BlueProject project) {
BlueProject previousProject = currentProject;
currentProject = project;
if (!projects.contains(project)) {
addProject(project);
}
if (currentProject != null) {
BlueUndoManager.setUndoGroup(project.getUndoManager());
File f = project.getDataFile();
BlueSystem.setCurrentBlueData(project.getData());
if (f != null) {
BlueSystem.setCurrentProjectDirectory(f.getParentFile());
} else {
BlueSystem.setCurrentProjectDirectory(null);
}
final Score score = project.getData().getScore();
Collection<? extends ProjectPlugin> plugins = Lookups.forPath("blue/project/plugins").lookupAll(ProjectPlugin.class);
for (ProjectPlugin plugin : plugins) {
plugin.preRender(project.getData());
}
new Thread(() -> {
try {
score.processOnLoad();
} catch (Exception ex) {
Exceptions.printStackTrace(ex);
}
}).start();
}
fireUpdatedCurrentProject(previousProject, currentProject);
}
use of blue.score.Score in project blue by kunstmusik.
the class OpenProjectAction method checkDependencies.
private static void checkDependencies(BlueData tempData) {
Score score = tempData.getScore();
ArrayList<String> filesList = new ArrayList<>();
for (LayerGroup<?> layerGroup : score) {
if (!(layerGroup instanceof PolyObject)) {
continue;
}
PolyObject pObj = (PolyObject) layerGroup;
checkAudioFiles(pObj, filesList);
}
if (filesList.size() > 0) {
if (dependencyDialog == null) {
dependencyDialog = new AudioFileDependencyDialog();
}
dependencyDialog.setFilesList(filesList);
if (dependencyDialog.ask()) {
Map<String, String> map = dependencyDialog.getFilesMap();
if (map == null || map.size() == 0) {
return;
}
for (Entry<String, String> entry : map.entrySet()) {
String key = entry.getKey();
String val = entry.getValue();
val = BlueSystem.getRelativePath(val);
entry.setValue(val);
}
System.out.println(map);
for (LayerGroup<?> layerGroup : score) {
if (!(layerGroup instanceof PolyObject)) {
continue;
}
PolyObject pObj = (PolyObject) layerGroup;
reconcileAudioFiles(pObj, map);
}
}
}
}
use of blue.score.Score in project blue by kunstmusik.
the class ScoreController method deleteScoreObjects.
public void deleteScoreObjects() {
if (lookup == null || content == null) {
return;
}
Collection<? extends ScoreObject> scoreObjects = ScoreController.getInstance().getSelectedScoreObjects();
Score score = lookup.lookup(Score.class);
if (score == null) {
throw new RuntimeException("Score object not set in ScoreController: internal error");
}
if (scoreObjects.isEmpty()) {
return;
}
List<Layer> layers = getScorePath().getAllLayers();
RemoveScoreObjectEdit top = null;
for (ScoreObject scoreObj : scoreObjects) {
RemoveScoreObjectEdit edit = null;
for (Layer layer : layers) {
if (layer.remove(scoreObj)) {
edit = new RemoveScoreObjectEdit((ScoreObjectLayer) layer, scoreObj);
break;
}
}
if (edit == null) {
throw new RuntimeException("Error: Unable to find Layer to remove ScoreObject: Internal Error");
}
if (top == null) {
top = edit;
} else {
top.appendNextEdit(edit);
}
content.remove(scoreObj);
}
BlueUndoManager.setUndoManager("score");
BlueUndoManager.addEdit(top);
}
use of blue.score.Score in project blue by kunstmusik.
the class SoundObjectLibraryUtilsTest method testRemoveLibrarySoundObject.
/**
* Test of removeLibrarySoundObject method, of class SoundObjectLibraryUtils.
*/
@Test
public void testRemoveLibrarySoundObject() {
BlueData data = new BlueData();
Score score = data.getScore();
PolyObject polyObj = new PolyObject(true);
score.add(polyObj);
SoundObjectLibrary library = data.getSoundObjectLibrary();
SoundLayer layer = polyObj.newLayerAt(0);
SoundObject sObj = new GenericScore();
SoundObject sObj2 = new GenericScore();
PolyObject pObjInner = new PolyObject(true);
SoundLayer layerInner = pObjInner.newLayerAt(0);
layerInner.add(new Instance(sObj));
layer.add(new Instance(sObj));
layer.add(new Instance(sObj));
layer.add(new Instance(sObj));
layer.add(sObj2);
layer.add(pObjInner);
library.add(sObj);
assertEquals(5, layer.size());
assertEquals(1, library.size());
assertEquals(1, layerInner.size());
SoundObjectLibraryUtils.removeLibrarySoundObject(data, sObj);
assertEquals(2, layer.size());
assertEquals(0, library.size());
assertEquals(0, layerInner.size());
}
Aggregations