use of blue.soundObject.NoteList in project blue by kunstmusik.
the class pa method getValue.
@Override
public double[] getValue(CybilNoteList cybilNoteList) {
NoteList nl = cybilNoteList.notes;
int index = Integer.parseInt((String) args.get(0));
double[] val = new double[1];
int currentNoteIndex = cybilNoteList.index;
Note note = cybilNoteList.notes.get(currentNoteIndex);
val[0] = Double.parseDouble(note.getPField(index));
return val;
}
use of blue.soundObject.NoteList in project blue by kunstmusik.
the class PatternLayer method generateForCSD.
NoteList generateForCSD(CompileData compileData, double startTime, double endTime, int patternBeatsLength) throws SoundObjectException {
NoteList notes = new NoteList();
this.soundObject.setStartTime(0);
// this.soundObject.setSubjectiveDuration(patternBeatsLength);
// this.soundObject.setTimeBehavior(SoundObject.TIME_BEHAVIOR_NONE);
NoteList tempNotes = this.soundObject.generateForCSD(compileData, -1, -1);
int currentIndex = (int) (startTime / patternBeatsLength);
while (currentIndex < this.patternData.getSize()) {
if (this.patternData.isPatternSet(currentIndex)) {
double time = currentIndex * patternBeatsLength;
final NoteList copy = new NoteList(tempNotes);
ScoreUtilities.setScoreStart(copy, time);
notes.addAll(copy);
}
currentIndex++;
}
return notes;
}
use of blue.soundObject.NoteList 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.NoteList 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.NoteList 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;
}
Aggregations