use of blue.soundObject.SoundObject in project blue by kunstmusik.
the class BlueShareRemoteCaller method getSoundObject.
public static SoundObject getSoundObject(SoundObjectOption iOption) throws IOException, XmlRpcException, ParseException {
Vector v = new Vector();
String result;
v.add(new Integer(iOption.getSoundObjectId()));
result = (String) xrpc.execute("blueShare.getSoundObject", v);
SoundObject soundObject = null;
try {
Document d = new Document(result);
soundObject = (SoundObject) ObjectUtilities.loadFromXML(d.getRoot(), new HashMap<>());
} catch (Exception e) {
}
return soundObject;
}
use of blue.soundObject.SoundObject in project blue by kunstmusik.
the class SoundObjectExportPane method jbInit.
private void jbInit() throws Exception {
this.setLayout(new BorderLayout());
this.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
soundObjectListPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
categoryPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
cateogriesLabel.setText(BlueSystem.getString("common.categories"));
categoryPanel.setLayout(new BorderLayout());
this.add(namePasswordPanel, BorderLayout.NORTH);
this.add(mainSplitPane, BorderLayout.CENTER);
this.add(jPanel2, BorderLayout.SOUTH);
descriptionText.setText(BlueSystem.getString("blueShare.enterDescription"));
descriptionText.setLineWrap(true);
descriptionScrollPane.setBorder(new TitledBorder(null, BlueSystem.getString("blueShare.instrDescription")));
submitButton.setText(BlueSystem.getString("common.submit"));
soundObjectListPanel.setLayout(new BorderLayout());
iLabel.setText("SoundObjects from Library");
// soundObjectLibraryTree.setSelectionModel(TreeSelectionModel.SINGLE_TREE_SELECTION);
topSplitPane.add(soundObjectListPanel, JSplitPane.LEFT);
soundObjectListPanel.add(soundObjectListScrollPane, BorderLayout.CENTER);
soundObjectListPanel.add(iLabel, BorderLayout.NORTH);
soundObjectListScrollPane.getViewport().add(soundObjectLibraryTree, null);
descriptionScrollPane.getViewport().add(descriptionText, null);
jPanel2.add(submitButton, null);
topSplitPane.setDividerLocation(300);
mainSplitPane.setOrientation(JSplitPane.VERTICAL_SPLIT);
mainSplitPane.add(topSplitPane, JSplitPane.TOP);
mainSplitPane.add(descriptionScrollPane, JSplitPane.BOTTOM);
topSplitPane.add(categoryPanel, JSplitPane.RIGHT);
categoryPanel.add(cateogriesLabel, BorderLayout.NORTH);
categoryPanel.add(categoryScrollPane, BorderLayout.CENTER);
categoryScrollPane.getViewport().add(categoryTree, null);
mainSplitPane.setDividerLocation(200);
submitButton.addActionListener((ActionEvent e) -> {
submitSoundObject();
});
soundObjectLibraryTree.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
TreePath path = soundObjectLibraryTree.getSelectionPath();
if (path == null) {
descriptionText.setText(SELECT_INSTR_TEXT);
descriptionText.setEnabled(false);
return;
}
Object userObj = path.getLastPathComponent();
TreeItem<LibraryItem<SoundObject>> node = (TreeItem<LibraryItem<SoundObject>>) userObj;
if (!node.isLeaf()) {
descriptionText.setText(SELECT_INSTR_TEXT);
descriptionText.setEnabled(false);
return;
}
SoundObject instr = node.getValue().getValue();
if (instr instanceof Sound) {
descriptionText.setText(((Sound) instr).getComment());
} else if (instr instanceof ObjectBuilder) {
descriptionText.setText(((ObjectBuilder) instr).getComment());
} else {
descriptionText.setText("");
}
descriptionText.setEnabled(true);
}
});
}
use of blue.soundObject.SoundObject in project blue by kunstmusik.
the class AudioFileRenderer method render.
@Override
public void render(Graphics graphics, SoundObjectView sObjView, int pixelSeconds) {
Rectangle clip = graphics.getClipBounds();
Graphics2D g = (Graphics2D) graphics;
int w = sObjView.getSize().width;
int h = sObjView.getSize().height;
Color bgColor;
Color border1;
Color border2;
Color fontColor;
Color waveColor;
SoundObject sObj = sObjView.getSoundObject();
if (sObjView.isSelected()) {
bgColor = selectedBgColor;
border1 = selectedBorder1;
border2 = selectedBorder2;
fontColor = selectedFontColor;
} else {
bgColor = sObj.getBackgroundColor();
border1 = bgColor.brighter().brighter();
border2 = bgColor.darker().darker();
fontColor = isBright(bgColor) ? Color.BLACK : Color.WHITE;
}
if (isBright(bgColor)) {
waveColor = bgColor.brighter().brighter();
} else {
waveColor = bgColor.darker().darker();
}
g.setPaint(bgColor);
g.fillRect(clip.x, 2, clip.width, h - 4);
// Draw Waveform
g.setPaint(waveColor);
paintWaveform(g, sObjView, pixelSeconds);
// DRAW BORDERS
// if (GeneralSettings.getInstance().isDrawFlatSObjBorders()) {
// g.setColor(Color.LIGHT_GRAY);
// g.drawRect(0, 2, w - 1, h - 4);
//
// } else {
g.setColor(border1);
g.drawLine(0, 2, w - 1, 2);
g.drawLine(0, 2, 0, h - 4);
g.setColor(border2);
g.drawLine(0, h - 3, w, h - 3);
g.drawLine(w - 1, h - 3, w - 1, 2);
// }
g.setPaint(fontColor);
if (h >= 20) {
g.setComposite(AlphaComposite.Src);
g.setFont(renderFont);
String[] parts = sObjView.getSoundObject().getName().split("\\\\[n]");
for (int i = 0; i < parts.length; i++) {
int y = 15 + (i * Layer.LAYER_HEIGHT);
g.drawString(parts[i], labelOffset, y);
}
}
}
use of blue.soundObject.SoundObject in project blue by kunstmusik.
the class LetterRenderer method render.
@Override
public void render(Graphics graphics, SoundObjectView sObjView, int pixelSeconds) {
super.render(graphics, sObjView, pixelSeconds);
Graphics2D g = (Graphics2D) graphics;
Color boxColor;
Color fontColor;
SoundObject sObj = sObjView.getSoundObject();
if (sObjView.isSelected()) {
boxColor = selectedBorder2;
fontColor = selectedFontColor;
} else {
Color bgColor = sObj.getBackgroundColor();
boxColor = bgColor.brighter().brighter();
int total = bgColor.getRed() + bgColor.getGreen() + bgColor.getBlue();
if (total > 128 * 3) {
fontColor = Color.black;
} else {
fontColor = Color.white;
}
}
// DRAW BOX
g.setColor(boxColor);
g.fillRect(2, 4, 9, 9);
// DRAW LETTER
g.setColor(fontColor);
g.setFont(miniFont);
g.drawString(letter, 3, 12);
}
use of blue.soundObject.SoundObject in project blue by kunstmusik.
the class ReplaceWithBufferSoundObjectAction method actionPerformed.
@Override
public void actionPerformed(ActionEvent e) {
ScoreController.ScoreObjectBuffer buffer = ScoreController.getInstance().getScoreObjectBuffer();
List<Layer> layers = scorePath.getAllLayers();
BlueData data = BlueProjectManager.getInstance().getCurrentBlueData();
SoundObjectLibrary sObjLib = data.getSoundObjectLibrary();
List<Instance> instances = new ArrayList<>();
ReplaceScoreObjectEdit top = null;
for (SoundObject sObj : soundObjects) {
SoundObject replacement = getReplacementObject(buffer, instances);
replacement.setStartTime(sObj.getStartTime());
replacement.setSubjectiveDuration(sObj.getSubjectiveDuration());
ScoreObjectLayer layer = (ScoreObjectLayer) findLayerForSoundObject(layers, sObj);
layer.remove(sObj);
layer.add(replacement);
ReplaceScoreObjectEdit edit = new ReplaceScoreObjectEdit(layer, sObj, replacement);
if (top == null) {
top = edit;
} else {
top.addEdit(edit);
}
}
// FIXME - this part is not undoable...
sObjLib.checkAndAddInstanceSoundObjects(instances);
BlueUndoManager.setUndoManager("score");
BlueUndoManager.addEdit(top);
}
Aggregations