use of blue.soundObject.Sound 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.Sound in project blue by kunstmusik.
the class SoundEditor method editScoreObject.
@Override
public final void editScoreObject(ScoreObject sObj) {
if (sObj == null) {
this.sObj = null;
editorLabel.setText("no editor available");
editor.editInstrument(null);
return;
}
if (!(sObj instanceof Sound)) {
this.sObj = null;
editorLabel.setText("no editor available");
editor.editInstrument(null);
return;
}
if (this.sObj != null) {
final Sound temp = this.sObj;
BlueFX.runOnFXThread(() -> {
temp.commentProperty().unbind();
temp.removeScoreObjectListener(sObjListener);
});
}
this.sObj = (Sound) sObj;
editor.editInstrument(this.sObj.getBlueSynthBuilder());
BlueFX.runOnFXThread(() -> {
lineList.clear();
int colorCount = 0;
for (Parameter p : this.sObj.getBlueSynthBuilder().getParameterList().sorted()) {
if (p.isAutomationEnabled()) {
p.getLine().setVarName(p.getName());
p.getLine().setColor(LineColors.getColor(colorCount++));
List<LinePoint> points = p.getLine().getObservableList();
if (points.size() < 2) {
LinePoint lp = new LinePoint();
lp.setLocation(1.0, points.get(0).getY());
points.add(lp);
}
lineList.add(p.getLine());
}
}
lineView.setStartTime(this.sObj.getStartTime());
lineView.setDuration(this.sObj.getSubjectiveDuration());
commentTextArea.setText(this.sObj.getComment());
this.sObj.commentProperty().bind(commentTextArea.textProperty());
this.sObj.addScoreObjectListener(sObjListener);
});
}
use of blue.soundObject.Sound in project blue by kunstmusik.
the class PasteBSBAsSoundAction method actionPerformed.
@Override
public void actionPerformed(ActionEvent e) {
double start = (double) p.x / timeState.getPixelSecond();
if (timeState.isSnapEnabled()) {
start = ScoreUtilities.getSnapValueStart(start, timeState.getSnapValue());
}
Object obj = CopyBuffer.getBufferedObject(CopyBuffer.INSTRUMENT);
Sound sound = new Sound();
sound.setStartTime(start);
BlueSynthBuilder bsbCopy = ((BlueSynthBuilder) obj).deepCopy();
// clear out any existing automations
for (Parameter param : bsbCopy.getParameterList()) {
param.setAutomationEnabled(false);
param.getLine().clear();
param.getLine().addLinePoint(new LinePoint(0.0, param.getValue(0.0)));
param.getLine().addLinePoint(new LinePoint(1.0, param.getValue(0.0)));
}
sound.setBlueSynthBuilder(bsbCopy);
Layer layer = scorePath.getGlobalLayerForY(p.y);
if (!layer.accepts(sound)) {
JOptionPane.showMessageDialog(null, "Unable to paste due to target layers not " + "accepting types of objects within the copy buffer (i.e. trying to " + "paste a SoundObject into an AudioLayer");
return;
}
SoundLayer sLayer = (SoundLayer) layer;
sLayer.add(sound);
BlueData data = BlueProjectManager.getInstance().getCurrentBlueData();
AddScoreObjectEdit undoEdit = new AddScoreObjectEdit(sLayer, sound);
BlueUndoManager.setUndoManager("score");
BlueUndoManager.addEdit(undoEdit);
}
Aggregations