Search in sources :

Example 6 with GenericScore

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());
}
Also used : NoteList(blue.soundObject.NoteList) GenericScore(blue.soundObject.GenericScore) CompileData(blue.CompileData)

Example 7 with GenericScore

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));
}
Also used : NoteList(blue.soundObject.NoteList) GenericScore(blue.soundObject.GenericScore) CompileData(blue.CompileData)

Example 8 with GenericScore

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;
}
Also used : NoteList(blue.soundObject.NoteList) NoteParseException(blue.soundObject.NoteParseException) GenericScore(blue.soundObject.GenericScore) SoundObjectException(blue.soundObject.SoundObjectException)

Example 9 with GenericScore

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());
}
Also used : BlueData(blue.BlueData) Score(blue.score.Score) GenericScore(blue.soundObject.GenericScore) SoundObject(blue.soundObject.SoundObject) Instance(blue.soundObject.Instance) SoundLayer(blue.SoundLayer) SoundObjectLibrary(blue.SoundObjectLibrary) GenericScore(blue.soundObject.GenericScore) PolyObject(blue.soundObject.PolyObject) Test(org.junit.Test)

Example 10 with GenericScore

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);
}
Also used : SoundLayer(blue.SoundLayer) ArrayList(java.util.ArrayList) ScoreObject(blue.score.ScoreObject) GenericScore(blue.soundObject.GenericScore) SoundLayer(blue.SoundLayer) Layer(blue.score.layers.Layer) Test(org.junit.Test)

Aggregations

GenericScore (blue.soundObject.GenericScore)15 SoundLayer (blue.SoundLayer)5 NoteList (blue.soundObject.NoteList)4 PolyObject (blue.soundObject.PolyObject)3 Test (org.junit.Test)3 CompileData (blue.CompileData)2 Score (blue.score.Score)2 ScoreObject (blue.score.ScoreObject)2 Layer (blue.score.layers.Layer)2 Element (electric.xml.Element)2 ArrayList (java.util.ArrayList)2 BlueData (blue.BlueData)1 SoundObjectLibrary (blue.SoundObjectLibrary)1 LiveObject (blue.blueLive.LiveObject)1 LiveObjectBins (blue.blueLive.LiveObjectBins)1 Instance (blue.soundObject.Instance)1 NoteParseException (blue.soundObject.NoteParseException)1 SoundObject (blue.soundObject.SoundObject)1 SoundObjectException (blue.soundObject.SoundObjectException)1 IOException (java.io.IOException)1