Search in sources :

Example 21 with Instrument

use of blue.orchestra.Instrument in project blue by kunstmusik.

the class InstrumentExportPane method jbInit.

private void jbInit() throws Exception {
    this.setLayout(new BorderLayout());
    this.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    instrumentListPanel.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"));
    instrumentListPanel.setLayout(new BorderLayout());
    iLabel.setText(BlueSystem.getString("blueShare.instrumentsFromCurrentProject"));
    // instrumentLibraryTree.setSelectionModel(TreeSelectionModel.SINGLE_TREE_SELECTION);
    topSplitPane.add(instrumentListPanel, JSplitPane.LEFT);
    instrumentListPanel.add(instrumentListScrollPane, BorderLayout.CENTER);
    instrumentListPanel.add(iLabel, BorderLayout.NORTH);
    instrumentListScrollPane.getViewport().add(instrumentLibraryTree, 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) -> {
        submitInstrument();
    });
    instrumentLibraryTree.addMouseListener(new MouseAdapter() {

        @Override
        public void mouseClicked(MouseEvent e) {
            TreePath path = instrumentLibraryTree.getSelectionPath();
            if (path == null) {
                descriptionText.setText(SELECT_INSTR_TEXT);
                descriptionText.setEnabled(false);
                return;
            }
            Object userObj = path.getLastPathComponent();
            if (!(userObj instanceof Instrument)) {
                descriptionText.setText(SELECT_INSTR_TEXT);
                descriptionText.setEnabled(false);
                return;
            }
            Instrument instr = (Instrument) userObj;
            descriptionText.setText(instr.getComment());
            descriptionText.setEnabled(true);
        }
    });
}
Also used : MouseEvent(java.awt.event.MouseEvent) BorderLayout(java.awt.BorderLayout) TreePath(javax.swing.tree.TreePath) ActionEvent(java.awt.event.ActionEvent) MouseAdapter(java.awt.event.MouseAdapter) Instrument(blue.orchestra.Instrument) TitledBorder(javax.swing.border.TitledBorder)

Example 22 with Instrument

use of blue.orchestra.Instrument in project blue by kunstmusik.

the class AudioFile method generateForCSD.

@Override
public NoteList generateForCSD(CompileData compileData, double startTime, double endTime) throws SoundObjectException {
    Instrument instr = this.generateInstrument();
    if (instr == null) {
        throw new RuntimeException(new SoundObjectException(this, BlueSystem.getString("audioFile.couldNotGenerate") + " " + getSoundFileName()));
    }
    int instrNum = compileData.addInstrument(instr);
    NoteList nl = this.generateNotes(instrNum, startTime, endTime);
    return nl;
}
Also used : GenericInstrument(blue.orchestra.GenericInstrument) Instrument(blue.orchestra.Instrument)

Example 23 with Instrument

use of blue.orchestra.Instrument in project blue by kunstmusik.

the class Arrangement method generateGlobalOrc.

public String generateGlobalOrc(CompileData data) {
    StrBuilder retVal = new StrBuilder();
    ArrayList<Instrument> instruments = new ArrayList<>();
    for (Iterator<InstrumentAssignment> iter = arrangement.iterator(); iter.hasNext(); ) {
        InstrumentAssignment ia = iter.next();
        if (!ia.enabled) {
            continue;
        }
        Instrument instr = ia.instr;
        if (!instruments.contains(instr)) {
            String globalOrc = instr.generateGlobalOrc();
            if (globalOrc != null) {
                String assignmentId;
                if ((assignmentId = data.getInstrSourceId(instr)) == null) {
                    assignmentId = ia.arrangementId;
                }
                String transformed = replaceInstrumentId(assignmentId, globalOrc);
                retVal.append(transformed);
                retVal.append("\n");
            }
            instruments.add(instr);
        }
    }
    return retVal.toString();
}
Also used : GenericInstrument(blue.orchestra.GenericInstrument) Instrument(blue.orchestra.Instrument) StrBuilder(org.apache.commons.lang3.text.StrBuilder)

Example 24 with Instrument

use of blue.orchestra.Instrument in project blue by kunstmusik.

the class Arrangement method generateGlobalSco.

public String generateGlobalSco(CompileData data) {
    StrBuilder retVal = new StrBuilder();
    for (Iterator<InstrumentAssignment> iter = arrangement.iterator(); iter.hasNext(); ) {
        InstrumentAssignment ia = iter.next();
        if (!ia.enabled) {
            continue;
        }
        Instrument instr = ia.instr;
        String globalSco = instr.generateGlobalSco();
        if (globalSco != null) {
            String assignmentId;
            if ((assignmentId = data.getInstrSourceId(instr)) == null) {
                assignmentId = ia.arrangementId;
            }
            String transformed = replaceInstrumentId(assignmentId, globalSco);
            retVal.append(transformed);
            retVal.append("\n");
        }
    }
    return retVal.toString();
}
Also used : GenericInstrument(blue.orchestra.GenericInstrument) Instrument(blue.orchestra.Instrument) StrBuilder(org.apache.commons.lang3.text.StrBuilder)

Example 25 with Instrument

use of blue.orchestra.Instrument in project blue by kunstmusik.

the class AutomationManager method setData.

public void setData(BlueData data) {
    if (this.data != null) {
        Arrangement arrangement = this.data.getArrangement();
        arrangement.removeAutomatableCollectionListener(this);
        for (int i = 0; i < arrangement.size(); i++) {
            Instrument instr = arrangement.getInstrument(i);
            if (instr instanceof Automatable) {
                Automatable temp = (Automatable) instr;
                ParameterList parameters = temp.getParameterList();
                // parameterMap.put(temp, parameters);
                parameters.removeListener(parameterListListener);
            }
        }
        Mixer mixer = this.data.getMixer();
        mixer.getChannelListGroups().removeListener(channelListListener);
        for (ChannelList list : mixer.getChannelListGroups()) {
            list.removeListener(this);
            for (Channel c : list) {
                removeListenerFromChannel(c);
            }
        }
        ChannelList channels = mixer.getChannels();
        channels.removeListener(this);
        for (Channel c : channels) {
            removeListenerFromChannel(c);
        }
        ChannelList subChannels = mixer.getSubChannels();
        subChannels.removeListener(this);
        for (int i = 0; i < subChannels.size(); i++) {
            removeListenerFromChannel(subChannels.get(i));
        }
        removeListenerFromChannel(mixer.getMaster());
        if (this.score != null) {
            for (LayerGroup<? extends Layer> layerGroup : score) {
                layerGroup.removeLayerGroupListener(this);
            }
        }
        this.data.removePropertyChangeListener(renderTimeListener);
    }
    // menu = null;
    // dirty = false;
    allParameters.clear();
    if (data == null) {
        return;
    }
    // Build Map from Instruments
    Arrangement arrangement = data.getArrangement();
    for (int i = 0; i < arrangement.size(); i++) {
        Instrument instr = arrangement.getInstrument(i);
        if (instr instanceof Automatable) {
            Automatable temp = (Automatable) instr;
            ParameterList parameters = temp.getParameterList();
            allParameters.addAll(parameters);
            parameters.addListener(parameterListListener);
        }
    }
    arrangement.addAutomatableCollectionListener(this);
    Mixer mixer = data.getMixer();
    mixer.getChannelListGroups().addListener(channelListListener);
    for (ChannelList list : mixer.getChannelListGroups()) {
        list.addListener(this);
        for (Channel c : list) {
            addListenerToChannel(c);
        }
    }
    ChannelList channels = mixer.getChannels();
    channels.addListener(this);
    for (Channel c : channels) {
        addListenerToChannel(c);
    }
    ChannelList subChannels = mixer.getSubChannels();
    subChannels.addListener(this);
    for (int i = 0; i < subChannels.size(); i++) {
        addListenerToChannel(subChannels.get(i));
    }
    addListenerToChannel(mixer.getMaster());
    // System.err.println(this);
    this.data = data;
    this.score = data.getScore();
    for (LayerGroup<? extends Layer> layerGroup : this.score) {
        layerGroup.addLayerGroupListener(this);
    }
    this.data.addPropertyChangeListener(renderTimeListener);
// Build Map from Mixer Channels
}
Also used : Mixer(blue.mixer.Mixer) Channel(blue.mixer.Channel) Instrument(blue.orchestra.Instrument) ChannelList(blue.mixer.ChannelList) 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