Search in sources :

Example 1 with Instrument

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

the class InstrumentLibrary method valueForPathChanged.

/*
     * (non-Javadoc)
     * 
     * @see javax.swing.tree.TreeModel#valueForPathChanged(javax.swing.tree.TreePath,
     *      java.lang.Object)
     */
@Override
public void valueForPathChanged(TreePath path, Object newValue) {
    Object obj = path.getLastPathComponent();
    if (obj instanceof InstrumentCategory) {
        ((InstrumentCategory) obj).setCategoryName(newValue.toString());
    } else if (obj instanceof Instrument) {
        ((Instrument) obj).setName(newValue.toString());
    }
    TreeModelEvent e = new TreeModelEvent(this, path);
    fireNodesChanged(e);
}
Also used : TreeModelEvent(javax.swing.event.TreeModelEvent) Instrument(blue.orchestra.Instrument) InstrumentCategory(blue.orchestra.InstrumentCategory)

Example 2 with Instrument

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

the class Arrangement method appendInstrumentText.

private void appendInstrumentText(CompileData data, StrBuilder buffer, InstrumentAssignment ia, Mixer mixer, int nchnls) {
    Instrument instr = ia.instr;
    buffer.append("\tinstr ").append(ia.arrangementId);
    buffer.append("\t;").append(instr.getName()).append("\n");
    String instrumentText = instr.generateInstrument();
    String assignmentId;
    if ((assignmentId = data.getInstrSourceId(instr)) == null) {
        assignmentId = ia.arrangementId;
    }
    String transformed = replaceInstrumentId(assignmentId, instrumentText);
    transformed = convertBlueMixerOut(data, mixer, ia.arrangementId, transformed, nchnls);
    buffer.append(transformed).append("\n");
    buffer.append("\tendin\n\n");
}
Also used : GenericInstrument(blue.orchestra.GenericInstrument) Instrument(blue.orchestra.Instrument)

Example 3 with Instrument

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

the class Arrangement method preGenerateOrchestra.

/**
 * Called before generating Mixer instrument in CSD Render. This needs to be
 * called earlier as it will go and find out what subchannels have
 * non-channel dependencies which result from SoundObject's that contain
 * blueMixerOut code that uses subchannels.
 *
 * @param mixer
 * @param nchnls
 */
public void preGenerateOrchestra(CompileData data, Mixer mixer, int nchnls, ArrayList<Instrument> alwaysOnInstruments) {
    if (preGenerationCache == null) {
        preGenerationCache = new StrBuilder();
        preGenList = new ArrayList<>();
    }
    for (Iterator<InstrumentAssignment> iter = arrangement.iterator(); iter.hasNext(); ) {
        InstrumentAssignment ia = iter.next();
        preGenList.add(ia);
        if (!ia.enabled) {
            continue;
        }
        appendInstrumentText(data, preGenerationCache, ia, mixer, nchnls);
        Instrument alwaysOnInstr = createAlwaysOnInstrument(data, ia, mixer, nchnls);
        if (alwaysOnInstr != null) {
            alwaysOnInstruments.add(alwaysOnInstr);
            data.addInstrSourceId(alwaysOnInstr, ia.arrangementId);
        }
    }
}
Also used : GenericInstrument(blue.orchestra.GenericInstrument) Instrument(blue.orchestra.Instrument) StrBuilder(org.apache.commons.lang3.text.StrBuilder)

Example 4 with Instrument

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

the class Arrangement method createAlwaysOnInstrument.

private Instrument createAlwaysOnInstrument(CompileData data, InstrumentAssignment ia, Mixer mixer, int nchnls) {
    Instrument instr = ia.instr;
    String alwaysOnInstrCode = instr.generateAlwaysOnInstrument();
    if (alwaysOnInstrCode == null || alwaysOnInstrCode.trim().isEmpty()) {
        return null;
    }
    String transformed = convertBlueMixerOut(data, mixer, ia.arrangementId, alwaysOnInstrCode, nchnls);
    GenericInstrument retVal = new GenericInstrument();
    retVal.setText(transformed);
    return retVal;
}
Also used : GenericInstrument(blue.orchestra.GenericInstrument) Instrument(blue.orchestra.Instrument) GenericInstrument(blue.orchestra.GenericInstrument)

Example 5 with Instrument

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

the class CSDRender method getStringChannels.

private ArrayList<StringChannel> getStringChannels(Arrangement arrangement, StringChannelNameManager scnm) {
    ArrayList<StringChannel> params = new ArrayList<>();
    for (int i = 0; i < arrangement.size(); i++) {
        InstrumentAssignment ia = arrangement.getInstrumentAssignment(i);
        if (ia.enabled) {
            Instrument instr = ia.instr;
            if (instr instanceof Automatable) {
                Automatable auto = (Automatable) instr;
                ArrayList<StringChannel> stringChannels = auto.getStringChannels();
                if (stringChannels != null) {
                    params.addAll(stringChannels);
                }
            }
        }
    }
    for (StringChannel strChannel : params) {
        strChannel.setChannelName(scnm.getUniqueStringChannel());
    }
    return params;
}
Also used : StringChannel(blue.orchestra.blueSynthBuilder.StringChannel) ArrayList(java.util.ArrayList) Instrument(blue.orchestra.Instrument) GenericInstrument(blue.orchestra.GenericInstrument) InstrumentAssignment(blue.InstrumentAssignment) LinePoint(blue.components.lines.LinePoint) Automatable(blue.automation.Automatable)

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