use of blue.soundObject.NoteList in project blue by kunstmusik.
the class ScoreUtilitiesTest method testScoreCarry.
public void testScoreCarry() {
String testScore = "i1 0 2 3 4 5\n" + "i1.1 0 .\n" + "i1 0 .";
NoteList nl = null;
try {
nl = ScoreUtilities.getNotes(testScore);
} catch (NoteParseException ex) {
ex.printStackTrace();
}
assertNotNull(nl);
assertEquals(3, nl.size());
assertEquals(6, nl.get(1).getPCount());
assertEquals(6, nl.get(2).getPCount());
}
use of blue.soundObject.NoteList in project blue by kunstmusik.
the class ScoreUtilitiesTest method testNGenScore.
public void testNGenScore() {
String testScore = ";I-block #1 (i1):\n" + "i1 0.000 0.010 0.000 100.000\n" + "i1 0.010 0.010 0.111 100.000\n" + "i1 0.020 0.010 0.222 100.000\n" + "i1 0.030 0.010 0.333 100.000\n" + "i1 0.040 0.010 0.444 100.000\n" + "i1 0.050 0.010 0.556 100.000\n" + "i1 0.060 0.010 0.667 100.000\n" + "i1 0.070 0.010 0.778 100.000\n" + "i1 0.080 0.010 0.889 100.000\n" + "i1 0.090 0.010 1.000 100.000\n" + "\n" + "e\n";
NoteList nl = null;
try {
nl = ScoreUtilities.getNotes(testScore);
} catch (NoteParseException ex) {
ex.printStackTrace();
}
assertNotNull(nl);
assertEquals(10, nl.size());
assertEquals(5, nl.get(0).getPCount());
}
use of blue.soundObject.NoteList in project blue by kunstmusik.
the class FieldTest method testGenerateNotesConstant.
/**
* Test of loadFromXML method, of class blue.soundObject.jmask.Field.
*/
// public void testLoadFromXML() throws Exception {
// System.out.println("loadFromXML");
//
// Element data = null;
//
// Field expResult = null;
// Field result = Field.loadFromXML(data);
// assertEquals(expResult, result);
//
// // TODO review the generated test code and remove the default call to
// fail.
// fail("The test case is a prototype.");
// }
//
/**
* Test of saveAsXML method, of class blue.soundObject.jmask.Field.
*/
// public void testSaveAsXML() {
// System.out.println("saveAsXML");
//
// Field instance = new Field();
//
// Element expResult = null;
// Element result = instance.saveAsXML();
// assertEquals(expResult, result);
//
// // TODO review the generated test code and remove the default call to
// fail.
// fail("The test case is a prototype.");
// }
/**
* Test of generateNotes method, of class blue.soundObject.jmask.Field.
*/
public void testGenerateNotesConstant() {
double duration = 5.0;
Field field = new Field();
java.util.Random r = new java.util.Random(0L);
NoteList result = field.generateNotes(duration, r);
assertEquals(5, result.size());
Constant c = (Constant) field.getParameter(0).getGenerator();
c.setValue(2.0);
result = field.generateNotes(duration, r);
for (int i = 0; i < result.size(); i++) {
assertEquals("2", result.get(i).getPField(1));
}
Constant c2 = (Constant) field.getParameter(1).getGenerator();
c2.setValue(1.5);
result = field.generateNotes(duration, new java.util.Random(0L));
assertEquals(4, result.size());
}
use of blue.soundObject.NoteList in project blue by kunstmusik.
the class Score method generateForCSD.
public NoteList generateForCSD(CompileData compileData, double startTime, double endTime) throws ScoreGenerationException {
NoteList noteList = new NoteList();
boolean soloFound = false;
for (LayerGroup layerGroup : this) {
soloFound = layerGroup.hasSoloLayers();
if (soloFound) {
break;
}
}
for (LayerGroup layerGroup : this) {
NoteList nl = layerGroup.generateForCSD(compileData, startTime, endTime, soloFound);
noteList.merge(nl);
}
try {
ScoreUtilities.applyNoteProcessorChain(noteList, this.npc);
} catch (NoteProcessorException e) {
throw new ScoreGenerationException(e);
}
return noteList;
}
use of blue.soundObject.NoteList 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