Search in sources :

Example 31 with Instrument

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;
    }
}
Also used : InstrumentLibrary(blue.InstrumentLibrary) Instrument(blue.orchestra.Instrument) ParseException(electric.xml.ParseException) IOException(java.io.IOException) XmlRpcException(org.apache.xmlrpc.XmlRpcException)

Example 32 with Instrument

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);
                    }
                }
            }
        }
    }
}
Also used : BlueData(blue.BlueData) BSBGraphicInterface(blue.orchestra.blueSynthBuilder.BSBGraphicInterface) BSBObject(blue.orchestra.blueSynthBuilder.BSBObject) BSBSubChannelDropdown(blue.orchestra.blueSynthBuilder.BSBSubChannelDropdown) Instrument(blue.orchestra.Instrument) BlueSynthBuilder(blue.orchestra.BlueSynthBuilder) Arrangement(blue.Arrangement)

Aggregations

Instrument (blue.orchestra.Instrument)32 GenericInstrument (blue.orchestra.GenericInstrument)14 Arrangement (blue.Arrangement)6 BlueSynthBuilder (blue.orchestra.BlueSynthBuilder)5 InstrumentCategory (blue.orchestra.InstrumentCategory)5 StrBuilder (org.apache.commons.lang3.text.StrBuilder)5 TransferableInstrument (blue.TransferableInstrument)4 Automatable (blue.automation.Automatable)4 Channel (blue.mixer.Channel)4 ChannelList (blue.mixer.ChannelList)4 Mixer (blue.mixer.Mixer)4 Point (java.awt.Point)4 IOException (java.io.IOException)4 ArrayList (java.util.ArrayList)4 TreePath (javax.swing.tree.TreePath)4 InstrumentAssignment (blue.InstrumentAssignment)3 Parameter (blue.automation.Parameter)3 LinePoint (blue.components.lines.LinePoint)3 StringChannel (blue.orchestra.blueSynthBuilder.StringChannel)3 BlueData (blue.BlueData)2