Search in sources :

Example 16 with Instrument

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);
    }
}
Also used : Instrument(blue.orchestra.Instrument) GenericInstrument(blue.orchestra.GenericInstrument) TransferableInstrument(blue.TransferableInstrument) Point(java.awt.Point)

Example 17 with Instrument

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

Example 18 with 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);
    }
}
Also used : Instrument(blue.orchestra.Instrument) GenericInstrument(blue.orchestra.GenericInstrument) TransferableInstrument(blue.TransferableInstrument) GenericInstrument(blue.orchestra.GenericInstrument) BlueSynthBuilder(blue.orchestra.BlueSynthBuilder) Point(java.awt.Point)

Example 19 with Instrument

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);
}
Also used : Instrument(blue.orchestra.Instrument) GenericInstrument(blue.orchestra.GenericInstrument) TransferableInstrument(blue.TransferableInstrument) Point(java.awt.Point)

Example 20 with Instrument

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);
}
Also used : TreePath(javax.swing.tree.TreePath) DefaultMutableTreeNode(javax.swing.tree.DefaultMutableTreeNode) Instrument(blue.orchestra.Instrument) IOException(java.io.IOException) XmlRpcException(org.apache.xmlrpc.XmlRpcException)

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