use of blue.noteProcessor.NoteProcessorException in project blue by kunstmusik.
the class JMask method generateNotes.
public NoteList generateNotes(double renderStart, double renderEnd) throws SoundObjectException {
Field temp = new Field(field);
Random rnd = seedUsed ? new Random(seed) : new Random();
NoteList nl = temp.generateNotes(this.getSubjectiveDuration(), rnd);
try {
ScoreUtilities.applyNoteProcessorChain(nl, this.npc);
} catch (NoteProcessorException e) {
throw new SoundObjectException(this, e);
}
ScoreUtilities.applyTimeBehavior(nl, this.getTimeBehavior(), this.getSubjectiveDuration(), this.getRepeatPoint());
ScoreUtilities.setScoreStart(nl, startTime);
return nl;
}
use of blue.noteProcessor.NoteProcessorException in project blue by kunstmusik.
the class ObjectBuilder method generateNotes.
// GENERATION METHODS
public NoteList generateNotes(BSBCompilationUnit bsbCompilationUnit, double renderStart, double renderEnd) throws SoundObjectException {
String codeToRun = bsbCompilationUnit.replaceBSBValues(code);
String tempScore = null;
NoteList nl;
Map<String, Object> initVals = new HashMap<>();
File currentDirFile = BlueSystem.getCurrentProjectDirectory();
initVals.put("score", "");
initVals.put("blueDuration", getSubjectiveDuration());
initVals.put("commandline", this.commandLine);
initVals.put("blueProjectDir", currentDirFile);
ScoreScriptEngine engine = ScoreScriptEngineManager.getInstance().getEngine(getLanguageType().toString());
try {
tempScore = engine.evalCode(codeToRun, initVals);
} catch (ScriptException ex) {
if (getLanguageType() == LanguageType.EXTERNAL) {
throw new SoundObjectException(this, getIOExceptionMessage(), ex);
} else {
throw new SoundObjectException(this, ex);
}
}
try {
nl = ScoreUtilities.getNotes(tempScore);
} catch (NoteParseException e) {
throw new SoundObjectException(this, e);
}
try {
ScoreUtilities.applyNoteProcessorChain(nl, this.npc);
} catch (NoteProcessorException e) {
throw new SoundObjectException(this, e);
}
ScoreUtilities.applyTimeBehavior(nl, this.getTimeBehavior(), this.getSubjectiveDuration(), this.getRepeatPoint());
ScoreUtilities.setScoreStart(nl, startTime);
return nl;
}
use of blue.noteProcessor.NoteProcessorException in project blue by kunstmusik.
the class SoundLayer method generateForCSD.
/**
* Generates notes for the SoundLayer, skipping over soundObjects which do
* not contribute notes between the startTime and endTime arguments.
*
* StartTime and endTime is adjusted by the PolyObject before passing into
* SoundLayer if possible, if not possible, will adjust to render everything
* and filter on top layer.
*/
public NoteList generateForCSD(CompileData compileData, double startTime, double endTime) throws SoundLayerException {
NoteList notes = new NoteList();
Collections.sort(this, sObjComparator);
for (SoundObject sObj : this) {
try {
double sObjStart = sObj.getStartTime();
double sObjDur = sObj.getSubjectiveDuration();
double sObjEnd = sObjStart + sObjDur;
if (sObjEnd > startTime) {
if (endTime <= startTime) {
double adjustedStart = startTime - sObjStart;
if (adjustedStart < 0.0f) {
adjustedStart = 0.0f;
}
notes.merge((sObj).generateForCSD(compileData, adjustedStart, -1.0f));
} else if (sObjStart < endTime) {
double adjustedStart = startTime - sObjStart;
double adjustedEnd = endTime - sObjStart;
if (adjustedStart < 0.0f) {
adjustedStart = 0.0f;
}
if (adjustedEnd >= sObjDur) {
adjustedEnd = -1.0f;
}
notes.merge((sObj).generateForCSD(compileData, adjustedStart, adjustedEnd));
}
}
} catch (Exception e) {
throw new SoundLayerException(this, "Error in SoundLayer: " + this.getName(), e);
}
}
try {
ScoreUtilities.applyNoteProcessorChain(notes, this.npc);
} catch (NoteProcessorException e) {
throw new SoundLayerException(this, "Error in SoundLayer: " + this.getName(), e);
}
return notes;
}
use of blue.noteProcessor.NoteProcessorException in project blue by kunstmusik.
the class External method generateNotes.
public final NoteList generateNotes(double renderStart, double renderEnd) throws SoundObjectException {
if (commandLine.trim().length() == 0 && getText().trim().length() == 0) {
return null;
}
NoteList nl = new NoteList();
ScoreScriptEngine engine = ScoreScriptEngineManager.getInstance().getEngine("External");
Map<String, Object> initVals = new HashMap<>();
initVals.put("commandline", this.commandLine);
try {
String temp = engine.evalCode(this.text, initVals);
nl = blue.utility.ScoreUtilities.getNotes(temp);
} catch (Exception ex) {
throw new SoundObjectException(this, getIOExceptionMessage(), ex);
}
try {
ScoreUtilities.applyNoteProcessorChain(nl, this.npc);
} catch (NoteProcessorException npe) {
throw new SoundObjectException(this, npe);
}
ScoreUtilities.applyTimeBehavior(nl, this.getTimeBehavior(), this.getSubjectiveDuration(), this.getRepeatPoint());
ScoreUtilities.setScoreStart(nl, this.getStartTime());
return nl;
}
use of blue.noteProcessor.NoteProcessorException in project blue by kunstmusik.
the class PatternObject method generateNotes.
/* COMPILATION METHODS */
public NoteList generateNotes(double renderStart, double renderEnd) throws SoundObjectException {
NoteList tempNoteList = new NoteList();
// check if solo is selected, if so, return only that layer's notes if
// not muted
boolean soloFound = false;
double timeIncrement = 1.0f / this.subDivisions;
for (int i = 0; i < this.size(); i++) {
Pattern p = this.getPattern(i);
if (p.isSolo() && !p.isMuted()) {
soloFound = true;
boolean[] tempPatternArray = p.values;
for (int j = 0; j < tempPatternArray.length; j++) {
if (tempPatternArray[j]) {
NoteList tempPattern;
try {
tempPattern = ScoreUtilities.getNotes(p.getPatternScore());
} catch (NoteParseException e) {
throw new SoundObjectException(this, e);
}
double start = (j * timeIncrement);
ScoreUtilities.setScoreStart(tempPattern, start);
tempNoteList.merge(tempPattern);
}
}
}
}
if (!soloFound) {
for (int i = 0; i < this.size(); i++) {
Pattern p = this.getPattern(i);
if (!p.isMuted()) {
boolean[] tempPatternArray = p.values;
for (int j = 0; j < tempPatternArray.length; j++) {
if (tempPatternArray[j]) {
NoteList tempPattern;
try {
tempPattern = ScoreUtilities.getNotes(p.getPatternScore());
} catch (NoteParseException e) {
throw new SoundObjectException(this, e);
}
double start = (j * timeIncrement);
ScoreUtilities.setScoreStart(tempPattern, start);
tempNoteList.merge(tempPattern);
}
}
}
}
}
try {
ScoreUtilities.applyNoteProcessorChain(tempNoteList, this.npc);
} catch (NoteProcessorException e) {
throw new SoundObjectException(this, e);
}
ScoreUtilities.applyTimeBehavior(tempNoteList, this.getTimeBehavior(), this.getSubjectiveDuration(), this.getRepeatPoint(), beats);
ScoreUtilities.setScoreStart(tempNoteList, startTime);
return tempNoteList;
}
Aggregations