use of blue.soundObject.SoundObject in project blue by kunstmusik.
the class SoundObjectExportPane method submitSoundObject.
private void submitSoundObject() {
try {
TreePath path = soundObjectLibraryTree.getSelectionPath();
if (path == null) {
return;
}
Object userObj = path.getLastPathComponent();
TreeItem<LibraryItem<SoundObject>> node = (TreeItem<LibraryItem<SoundObject>>) userObj;
if (!node.isLeaf()) {
return;
}
SoundObject soundObject = node.getValue().getValue();
DefaultMutableTreeNode tempNode = (DefaultMutableTreeNode) categoryTree.getSelectionPath().getLastPathComponent();
BlueShareSoundObjectCategory category = (BlueShareSoundObjectCategory) tempNode.getUserObject();
String username = namePasswordPanel.getUsername();
String password = namePasswordPanel.getPassword();
int categoryId = category.getCategoryId();
String name = soundObject.getName();
String soundObjectType = soundObject.getClass().getName();
String description = descriptionText.getText();
String soundObjectText = soundObject.saveAsXML(new HashMap<>()).toString();
System.out.println(soundObject.saveAsXML(new HashMap<>()).getTextString());
BlueShareRemoteCaller.submitSoundObject(username, password, categoryId, name, soundObjectType, description, soundObjectText);
} catch (IOException | XmlRpcException e) {
JOptionPane.showMessageDialog(null, "Error submitting SoundObject" + "\n\n" + e.getLocalizedMessage(), BlueSystem.getString("common.error"), JOptionPane.ERROR_MESSAGE);
e.printStackTrace();
return;
}
JOptionPane.showMessageDialog(null, "SoundObject was successfully received.", BlueSystem.getString("common.success"), JOptionPane.PLAIN_MESSAGE);
}
use of blue.soundObject.SoundObject in project blue by kunstmusik.
the class BlueLiveBinding method triggerLiveData.
protected void triggerLiveData() {
LiveObjectSet liveObjects = data.getLiveObjectBins().getEnabledLiveObjectSet();
if (liveObjects.size() > 0) {
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);
}
ScoreUtilities.scaleScore(nl, 60.0f / data.getTempo());
String scoreText = nl.toString();
if (scoreText != null && scoreText.length() > 0) {
// FIXME - this is certainly not good code but functions for now...
BlueLiveToolBar.getInstance().sendEvents(scoreText);
}
}
}
use of blue.soundObject.SoundObject in project blue by kunstmusik.
the class SoundObjectLibraryTopComponent method copyInstanceButtonActionPerformed.
// GEN-LAST:event_copyButtonActionPerformed
private void copyInstanceButtonActionPerformed(java.awt.event.ActionEvent evt) {
// GEN-FIRST:event_copyInstanceButtonActionPerformed
int index = sObjLibTable.getSelectedRow();
if (index != -1) {
SoundObject originalSObj = sObjLib.getSoundObject(index);
Instance tempSObj = new Instance(originalSObj);
tempSObj.setStartTime(0.0f);
tempSObj.setSubjectiveDuration(tempSObj.getObjectiveDuration());
ScoreController.getInstance().setSelectedScoreObjects(Collections.singleton(tempSObj));
scoreObjectBuffer.clear();
scoreObjectBuffer.scoreObjects.add(tempSObj);
scoreObjectBuffer.layerIndexes.add(0);
}
}
use of blue.soundObject.SoundObject in project blue by kunstmusik.
the class SoundObjectPropertiesTopComponent method setScoreObject.
private void setScoreObject(ScoreObject scoreObj) {
SoundObject soundObj = null;
if (scoreObj instanceof SoundObject) {
soundObj = (SoundObject) scoreObj;
}
isUpdating = true;
if (this.sObj != null) {
this.sObj.removeScoreObjectListener(this);
}
if (scoreObj == null) {
sObj = null;
disableFields();
propEdittor.editObject(null);
noteProcessorChainEditor2.setNoteProcessorChain(null);
} else {
enableFields();
setFieldsVisible(soundObj != null);
sObj = scoreObj;
updateProperties();
colorPanel.setColor(sObj.getBackgroundColor());
if (soundObj != null) {
noteProcessorChainEditor2.setNoteProcessorChain(soundObj.getNoteProcessorChain());
final int timeBehavior = soundObj.getTimeBehavior();
if (timeBehavior == SoundObject.TIME_BEHAVIOR_NOT_SUPPORTED) {
timeBehaviorBox.setEnabled(false);
useRepeatPoint.setEnabled(false);
repeatePointText.setEnabled(false);
} else {
timeBehaviorBox.setEnabled(true);
timeBehaviorBox.setSelectedIndex(timeBehavior);
if (timeBehavior == SoundObject.TIME_BEHAVIOR_REPEAT) {
useRepeatPoint.setEnabled(true);
double repeatPoint = soundObj.getRepeatPoint();
if (repeatPoint <= 0.0f) {
useRepeatPoint.setSelected(false);
repeatePointText.setEnabled(false);
} else {
useRepeatPoint.setSelected(true);
repeatePointText.setEnabled(true);
repeatePointText.setText(Double.toString(repeatPoint));
}
} else {
useRepeatPoint.setEnabled(false);
repeatePointText.setEnabled(false);
}
}
}
propEdittor.editObject(null);
sObj.addScoreObjectListener(this);
}
isUpdating = false;
}
use of blue.soundObject.SoundObject in project blue by kunstmusik.
the class SoundObjectPropertiesTopComponent method updateTimeBehavior.
private void updateTimeBehavior() {
if (!(sObj instanceof ScoreObject)) {
return;
}
SoundObject soundObj = (SoundObject) sObj;
soundObj.setTimeBehavior(timeBehaviorBox.getSelectedIndex());
if (timeBehaviorBox.getSelectedIndex() == SoundObject.TIME_BEHAVIOR_REPEAT) {
boolean repeatPointUsed = soundObj.getRepeatPoint() > 0.0f;
useRepeatPoint.setSelected(repeatPointUsed);
useRepeatPoint.setEnabled(true);
repeatePointText.setEnabled(repeatPointUsed);
} else {
useRepeatPoint.setSelected(false);
useRepeatPoint.setEnabled(false);
repeatePointText.setEnabled(false);
if (!isUpdating) {
soundObj.setRepeatPoint(-1.0f);
}
}
}
Aggregations