use of blue.soundObject.GenericScore in project blue by kunstmusik.
the class PatternLayerTest method testGenerateForCSD.
/**
* Test of generateForCSD method, of class PatternLayer.
*/
@Test
public void testGenerateForCSD() throws SoundObjectException {
CompileData compileData = null;
float startTime = 0.0F;
float endTime = 0.0F;
int patternBeatsLength = 4;
PatternLayer instance = new PatternLayer();
GenericScore score = new GenericScore();
score.setTimeBehavior(SoundObject.TIME_BEHAVIOR_NONE);
score.setText("i1 0 .25 1 2\ni1 1 .25 1 2");
instance.setSoundObject(score);
instance.getPatternData().setPattern(0, true);
instance.getPatternData().setPattern(1, true);
instance.getPatternData().setPattern(2, true);
NoteList result = instance.generateForCSD(compileData, startTime, endTime, patternBeatsLength);
System.out.println(result.toString());
assertEquals(6, result.size());
assertEquals("1.0", result.get(1).getPField(2));
assertEquals("8.0", result.get(4).getPField(2));
result = instance.generateForCSD(compileData, 4.0f, endTime, patternBeatsLength);
assertEquals(4, result.size());
}
use of blue.soundObject.GenericScore in project blue by kunstmusik.
the class PatternsLayerGroupTest method testGenerateForCSD.
/**
* Test of generateForCSD method, of class PatternsLayerGroup.
*/
@Test
public void testGenerateForCSD() throws ScoreGenerationException {
CompileData compileData = null;
float startTime = 4.0F;
float endTime = 0.0F;
PatternsLayerGroup instance = new PatternsLayerGroup();
int patternBeatsLength = 4;
instance.newLayerAt(-1);
PatternLayer patternLayer = instance.get(0);
GenericScore score = new GenericScore();
score.setTimeBehavior(SoundObject.TIME_BEHAVIOR_NONE);
score.setText("i1 0 .25 1 2\ni1 1 .25 1 2");
patternLayer.setSoundObject(score);
patternLayer.getPatternData().setPattern(0, true);
patternLayer.getPatternData().setPattern(1, true);
patternLayer.getPatternData().setPattern(2, true);
NoteList result = instance.generateForCSD(compileData, startTime, endTime, false);
assertEquals(4, result.size());
assertEquals("1.0", result.get(1).getPField(2));
assertEquals("5.0", result.get(3).getPField(2));
}
use of blue.soundObject.GenericScore in project blue by kunstmusik.
the class CSDRender method getGlobalDuration.
/**
* @param globalSco
* @return
* @throws SoundObjectException
*/
private double getGlobalDuration(String globalSco) throws SoundObjectException {
NoteList globalNotes;
try {
globalNotes = ScoreUtilities.getNotes(globalSco);
} catch (NoteParseException e) {
GenericScore gs = new GenericScore();
gs.setName("Global Orchestra Text");
throw new SoundObjectException(gs, e);
}
double globalDur = ScoreUtilities.getTotalDuration(globalNotes);
return globalDur;
}
use of blue.soundObject.GenericScore 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.GenericScore in project blue by kunstmusik.
the class MoveScoreObjectsListenerTest method testGetMaxYAdjust.
/**
* Test of getMaxYAdjust method, of class MoveScoreObjectsListener.
*/
@Test
public void testGetMaxYAdjust() {
System.out.println("getMaxYAdjust");
List<Layer> layers = new ArrayList<>();
final SoundLayer soundLayer = new SoundLayer();
ScoreObject scoreObj = new GenericScore();
soundLayer.add((SoundObject) scoreObj);
layers.add(new SoundLayer());
layers.add(soundLayer);
layers.add(new SoundLayer());
int sObjLayerIndex = 1;
int result = MoveScoreObjectsListener.getMaxYAdjust(layers, scoreObj, sObjLayerIndex);
assertEquals(1, result);
layers.add(0, new InvalidLayer());
layers.add(1, new SoundLayer());
layers.add(new InvalidLayer());
sObjLayerIndex = 3;
result = MoveScoreObjectsListener.getMaxYAdjust(layers, scoreObj, sObjLayerIndex);
assertEquals(1, result);
}
Aggregations