use of blue.soundObject.SoundObject in project blue by kunstmusik.
the class BlueLiveTopComponent method triggerButtonActionPerformed.
// GEN-LAST:event_noteTemplateTextMousePressed
private void triggerButtonActionPerformed(java.awt.event.ActionEvent evt) {
if (data == null) {
return;
}
LiveObjectSet liveObjects = data.getLiveData().getLiveObjectBins().getEnabledLiveObjectSet();
if (liveObjects.size() > 0) {
System.out.println("LiveObjectsSize: " + liveObjects.size());
NoteList nl = new NoteList();
try {
for (LiveObject liveObj : liveObjects) {
SoundObject sObj = liveObj.getSoundObject();
if (sObj.getTimeBehavior() != SoundObject.TIME_BEHAVIOR_NOT_SUPPORTED) {
sObj.setTimeBehavior(SoundObject.TIME_BEHAVIOR_NONE);
}
nl.addAll(sObj.generateForCSD(compileData, 0.0f, -1.0f));
}
} catch (Exception e) {
Exceptions.printStackTrace(e);
}
int tempo = (Integer) tempoSpinner.getValue();
ScoreUtilities.scaleScore(nl, 60.0f / tempo);
String scoreText = nl.toString();
if (scoreText != null && scoreText.length() > 0) {
RealtimeRenderManager.getInstance().passToStdin(scoreText);
}
}
}
use of blue.soundObject.SoundObject in project blue by kunstmusik.
the class ReplaceWithBufferSoundObjectAction method getReplacementObject.
protected SoundObject getReplacementObject(ScoreController.ScoreObjectBuffer buffer, List<Instance> instances) {
if (buffer.scoreObjects.size() == 1) {
SoundObject sObj = (SoundObject) buffer.scoreObjects.get(0).deepCopy();
if (sObj instanceof Instance) {
instances.add((Instance) sObj);
}
return sObj;
}
PolyObject pObj = new PolyObject();
int minLayer = Integer.MAX_VALUE;
int maxLayer = Integer.MIN_VALUE;
for (Integer layerIndex : buffer.layerIndexes) {
if (layerIndex < minLayer) {
minLayer = layerIndex;
}
if (layerIndex > maxLayer) {
maxLayer = layerIndex;
}
}
int numLayers = maxLayer - minLayer + 1;
for (int i = 0; i < numLayers; i++) {
pObj.newLayerAt(-1);
}
for (int i = 0; i < buffer.scoreObjects.size(); i++) {
ScoreObject scoreObj = buffer.scoreObjects.get(i);
int layerIndex = buffer.layerIndexes.get(i);
SoundLayer layer = pObj.get(layerIndex - minLayer);
SoundObject clone = (SoundObject) scoreObj.deepCopy();
layer.add(clone);
if (clone instanceof Instance) {
instances.add((Instance) clone);
}
}
return pObj;
}
use of blue.soundObject.SoundObject in project blue by kunstmusik.
the class SetSubjectiveToObjectiveTimeAction method actionPerformed.
@Override
public void actionPerformed(ActionEvent e) {
if (soundObjects.size() > 0 && scoreObjects.size() == soundObjects.size()) {
ResizeScoreObjectEdit top = null;
for (SoundObject soundObject : soundObjects) {
if (soundObject.getObjectiveDuration() <= 0) {
JOptionPane.showMessageDialog(null, BlueSystem.getString("soundObjectPopup.setTime.error.text"), BlueSystem.getString("soundObjectPopup.setTime.error.title"), JOptionPane.ERROR_MESSAGE);
return;
}
double oldTime = soundObject.getSubjectiveDuration();
double newTime = soundObject.getObjectiveDuration();
if (oldTime != newTime) {
soundObject.setSubjectiveDuration(newTime);
ResizeScoreObjectEdit edit = new ResizeScoreObjectEdit(soundObject, oldTime, newTime);
if (top == null) {
top = edit;
} else {
top.addEdit(edit);
}
}
}
if (top != null) {
BlueUndoManager.setUndoManager("score");
BlueUndoManager.addEdit(top);
}
}
}
use of blue.soundObject.SoundObject in project blue by kunstmusik.
the class AddToSoundObjectLibraryAction method actionPerformed.
@Override
public void actionPerformed(ActionEvent e) {
SoundObject sObj = (SoundObject) soundObjects.iterator().next().deepCopy();
if (sObj instanceof Instance) {
return;
}
BlueData data = BlueProjectManager.getInstance().getCurrentBlueData();
Instance i = new Instance(sObj);
i.setStartTime(sObj.getStartTime());
i.setSubjectiveDuration(sObj.getSubjectiveDuration());
data.getSoundObjectLibrary().addSoundObject(sObj);
SoundLayer layer = (SoundLayer) scorePath.getGlobalLayerForY(p.y);
layer.remove(soundObjects.iterator().next());
layer.add(i);
// BlueUndoManager.setUndoManager("score");
// BlueUndoManager.addEdit(new ReplaceScoreObjectEdit(
// sCanvas.getPolyObject(), oldSoundObject,
// newSoundObject, index));
}
use of blue.soundObject.SoundObject in project blue by kunstmusik.
the class ConvertToObjectBuilderAction method actionPerformed.
@Override
public void actionPerformed(ActionEvent e) {
SoundObject temp = soundObjects.iterator().next();
int retVal = JOptionPane.showConfirmDialog(null, "This operation can not be undone.\nAre you sure?");
if (retVal != JOptionPane.OK_OPTION) {
return;
}
SoundLayer layer = (SoundLayer) scorePath.getGlobalLayerForY(p.y);
ObjectBuilder objBuilder = new ObjectBuilder();
if (temp instanceof PythonObject) {
PythonObject tempPython = (PythonObject) temp;
objBuilder.setName(tempPython.getName());
objBuilder.setNoteProcessorChain(tempPython.getNoteProcessorChain());
objBuilder.setTimeBehavior(tempPython.getTimeBehavior());
objBuilder.setStartTime(tempPython.getStartTime());
objBuilder.setSubjectiveDuration(tempPython.getSubjectiveDuration());
objBuilder.setCode(tempPython.getText());
objBuilder.setBackgroundColor(tempPython.getBackgroundColor());
} else if (temp instanceof External) {
External tempExt = (External) temp;
objBuilder.setName(tempExt.getName());
objBuilder.setNoteProcessorChain(tempExt.getNoteProcessorChain());
objBuilder.setTimeBehavior(tempExt.getTimeBehavior());
objBuilder.setStartTime(tempExt.getStartTime());
objBuilder.setSubjectiveDuration(tempExt.getSubjectiveDuration());
objBuilder.setCode(tempExt.getText());
objBuilder.setCommandLine(tempExt.getCommandLine());
objBuilder.setLanguageType(LanguageType.EXTERNAL);
objBuilder.setBackgroundColor(tempExt.getBackgroundColor());
} else {
return;
}
layer.remove(temp);
layer.add(objBuilder);
ScoreController.getInstance().removeSelectedScoreObject(temp);
ScoreController.getInstance().addSelectedScoreObject(objBuilder);
}
Aggregations