use of blue.orchestra.Instrument in project blue by kunstmusik.
the class ArrangementEditPanel method removeInstrument.
public void removeInstrument() {
int selectedRow = arrangementTable.getSelectedRow();
if (selectedRow < 0) {
return;
}
Instrument instr = arrangement.removeInstrument(selectedRow);
String instrId = arrangement.getInstrumentId(instr);
if (instrId != null) {
OrchestraEdit edit = new OrchestraEdit(arrangement, instr, instrId, OrchestraEdit.REMOVE);
BlueUndoManager.setUndoManager("orchestra");
BlueUndoManager.addEdit(edit);
}
}
use of blue.orchestra.Instrument in project blue by kunstmusik.
the class BlueShareRemoteCaller method getInstrument.
public static Instrument getInstrument(InstrumentOption iOption) throws IOException, XmlRpcException, ParseException {
Vector v = new Vector();
String result;
v.add(new Integer(iOption.getInstrumentId()));
result = (String) xrpc.execute("blueShare.getInstrument", v);
Instrument instrument = null;
try {
Document d = new Document(result);
instrument = (Instrument) ObjectUtilities.loadFromXML(d.getRoot());
} catch (Exception e) {
}
return instrument;
}
use of blue.orchestra.Instrument in project blue by kunstmusik.
the class ArrangementEditPanel method convertToBSB.
public void convertToBSB() {
int selectedRow = arrangementTable.getSelectedRow();
if (selectedRow < 0) {
return;
}
String instrumentId = (String) arrangement.getValueAt(selectedRow, 1);
Instrument instr = arrangement.getInstrument(selectedRow);
if (instr instanceof GenericInstrument) {
GenericInstrument genInstr = (GenericInstrument) instr;
BlueSynthBuilder bsb = new BlueSynthBuilder();
bsb.setName(genInstr.getName());
bsb.setComment(genInstr.getComment());
bsb.setGlobalOrc(genInstr.getGlobalOrc());
bsb.setGlobalSco(genInstr.getGlobalSco());
bsb.setInstrumentText(genInstr.getText());
bsb.setOpcodeList(genInstr.getOpcodeList());
arrangement.replaceInstrument(instrumentId, bsb);
}
}
use of blue.orchestra.Instrument in project blue by kunstmusik.
the class ArrangementEditPanel method copyInstrument.
public void copyInstrument() {
int selectedRow = arrangementTable.getSelectedRow();
if (selectedRow < 0) {
return;
}
Instrument instr = arrangement.getInstrument(selectedRow);
Object clone = instr.deepCopy();
CopyBuffer.setBufferedObject(CopyBuffer.INSTRUMENT, clone);
}
use of blue.orchestra.Instrument in project blue by kunstmusik.
the class InstrumentExportPane method submitInstrument.
private void submitInstrument() {
try {
TreePath path = instrumentLibraryTree.getSelectionPath();
if (path == null) {
return;
}
Object userObj = path.getLastPathComponent();
if (!(userObj instanceof Instrument)) {
return;
}
Instrument instrument = (Instrument) userObj;
DefaultMutableTreeNode tempNode = (DefaultMutableTreeNode) categoryTree.getSelectionPath().getLastPathComponent();
BlueShareInstrumentCategory category = (BlueShareInstrumentCategory) tempNode.getUserObject();
String username = namePasswordPanel.getUsername();
String password = namePasswordPanel.getPassword();
int categoryId = category.getCategoryId();
String name = instrument.getName();
String instrumentType = instrument.getClass().getName();
String description = descriptionText.getText();
String instrumentText = instrument.saveAsXML().toString();
System.out.println(instrument.saveAsXML().getTextString());
BlueShareRemoteCaller.submitInstrument(username, password, categoryId, name, instrumentType, description, instrumentText);
} catch (IOException | XmlRpcException e) {
JOptionPane.showMessageDialog(null, BlueSystem.getString("blueShare.errorSubmittingInstrument") + "\n\n" + e.getLocalizedMessage(), BlueSystem.getString("common.error"), JOptionPane.ERROR_MESSAGE);
e.printStackTrace();
return;
}
JOptionPane.showMessageDialog(null, BlueSystem.getString("blueShare.successfullyReceived"), BlueSystem.getString("common.success"), JOptionPane.PLAIN_MESSAGE);
}
Aggregations