use of blue.soundObject.PolyObject 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);
}
use of blue.soundObject.PolyObject 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());
}
use of blue.soundObject.PolyObject in project blue by kunstmusik.
the class ScoreControllerTest method setUp.
@Before
public void setUp() {
System.out.println("@Before setUp");
this.scoreController = ScoreController.getInstance();
scoreController.setScrollPane(new JScrollPane());
InstanceContent content = new InstanceContent();
Score score = new Score();
scoreController.setScore(score);
PolyObject pObj = (PolyObject) score.get(0);
SoundLayer layer1 = new SoundLayer();
SoundLayer layer2 = new SoundLayer();
pObj.add(layer1);
pObj.add(layer2);
GenericScore score1 = new GenericScore();
score1.setStartTime(2.0f);
GenericScore score2 = new GenericScore();
score2.setStartTime(4.0f);
layer2.add(score1);
layer2.add(score2);
content.add(score);
content.add(score1);
content.add(score2);
scoreController.setLookupAndContent(new AbstractLookup(content), content);
this.buffer = scoreController.getScoreObjectBuffer();
}
use of blue.soundObject.PolyObject in project blue by kunstmusik.
the class Score method loadFromXML.
public static Score loadFromXML(Element data, Map<String, Object> objRefMap) throws Exception {
Score score = new Score(false);
Elements nodes = data.getElements();
LayerGroupProviderManager manager = LayerGroupProviderManager.getInstance();
while (nodes.hasMoreElements()) {
Element node = nodes.next();
switch(node.getName()) {
case "tempo":
score.tempo = Tempo.loadFromXML(node);
break;
case "timeState":
score.timeState = TimeState.loadFromXML(node);
break;
case "noteProcessorChain":
score.npc = NoteProcessorChain.loadFromXML(node);
break;
default:
LayerGroup layerGroup = manager.loadFromXML(node, objRefMap);
if (layerGroup == null) {
throw new RuntimeException("Unable to load Score LayerGroup of type: " + node.getName());
}
score.add(layerGroup);
if (layerGroup instanceof PolyObject) {
((PolyObject) layerGroup).setTimeBehavior(SoundObject.TIME_BEHAVIOR_NONE);
}
break;
}
}
if (score.size() == 0) {
PolyObject pObj = new PolyObject(true);
score.add(pObj);
}
return score;
}
use of blue.soundObject.PolyObject in project blue by kunstmusik.
the class PolyObjectEditor method testSoundObject.
public final void testSoundObject() {
if (this.pObj == null) {
return;
}
BlueData data = BlueProjectManager.getInstance().getCurrentBlueData();
if (data == null) {
System.err.println("PolyObjectEditor::testSoundObject() - " + "Could not get reference to current BlueData object");
return;
}
Tables tables = new Tables(data.getTableSet());
Arrangement arrangement = new Arrangement(data.getArrangement());
PolyObject tempPObj = new PolyObject(this.pObj);
OpcodeList opcodeList = new OpcodeList(data.getOpcodeList());
GlobalOrcSco globalOrcSco = new GlobalOrcSco(data.getGlobalOrcSco());
// adding all compile-time instruments from soundObjects to arrangement
arrangement.generateFTables(tables);
CompileData compileData = new CompileData(arrangement, tables);
// grabbing all notes from soundObjects
NoteList generatedNotes = null;
try {
generatedNotes = tempPObj.generateForCSD(compileData, 0.0f, -1.0f);
} catch (Exception e) {
Exceptions.printStackTrace(e);
return;
}
if (generatedNotes != null) {
InfoDialog.showInformationDialog(SwingUtilities.getRoot(this), generatedNotes.toString(), BlueSystem.getString("soundObject.generatedScore"));
}
}
Aggregations