use of blue.orchestra.Instrument in project blue by kunstmusik.
the class InstrumentImportPane method importInstrument.
private void importInstrument() {
InstrumentOption iOption = iTableModel.getInstrumentOption(instrumentTable.getSelectedRow());
if (iOption == null) {
return;
}
try {
Instrument instrument = BlueShareRemoteCaller.getInstrument(iOption);
if (instrument == null) {
String error = BlueSystem.getString("blueShare.importError");
JOptionPane.showMessageDialog(null, error, BlueSystem.getString("message.error"), JOptionPane.ERROR_MESSAGE);
return;
}
// data.getOrchestra().addInstrument(instrument);
// instrumentTreeModel.reload();
InstrumentLibrary instrLib = BlueSystem.getUserInstrumentLibrary();
instrLib.importInstrument(instrument);
String message = BlueSystem.getString("blueShare.importSuccess");
JOptionPane.showMessageDialog(null, message, BlueSystem.getString("common.success"), JOptionPane.PLAIN_MESSAGE);
} catch (ParseException pe) {
String error = BlueSystem.getString("blueShare.selectServer.couldNotReadResponse");
JOptionPane.showMessageDialog(null, error, BlueSystem.getString("message.error"), JOptionPane.ERROR_MESSAGE);
return;
} catch (XmlRpcException xre) {
String error = "Error: " + xre.getLocalizedMessage();
JOptionPane.showMessageDialog(null, error, BlueSystem.getString("message.error"), JOptionPane.ERROR_MESSAGE);
return;
} catch (IOException ioe) {
String error = "Error: " + ioe.getLocalizedMessage();
JOptionPane.showMessageDialog(null, error, BlueSystem.getString("message.error"), JOptionPane.ERROR_MESSAGE);
return;
}
}
use of blue.orchestra.Instrument in project blue by kunstmusik.
the class SubChannelListPanel method reconcileSubChannelRemoveInBlueArrangement.
/**
* A hack to explicitly walk the current blue orchestra to find any
* BlueSynthBuilder's that contain BSBSubChannelDropdown's and to reconcile
* with the removed channel
*
* @param removedChannel
*
* @param oldName
* @param newName
*/
private void reconcileSubChannelRemoveInBlueArrangement(String removedChannel) {
BlueData data = BlueProjectManager.getInstance().getCurrentBlueData();
if (data == null) {
return;
}
Arrangement arr = data.getArrangement();
for (int i = 0; i < arr.size(); i++) {
Instrument instr = arr.getInstrument(i);
if (instr instanceof BlueSynthBuilder) {
BlueSynthBuilder bsb = (BlueSynthBuilder) instr;
BSBGraphicInterface bsbInterface = bsb.getGraphicInterface();
for (BSBObject bsbObj : bsbInterface.getAllSet()) {
if (bsbObj instanceof BSBSubChannelDropdown) {
BSBSubChannelDropdown bsbSubDrop = (BSBSubChannelDropdown) bsbObj;
if (bsbSubDrop.getChannelOutput().equals(removedChannel)) {
bsbSubDrop.setChannelOutput(Channel.MASTER);
}
}
}
}
}
}
Aggregations