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);
}
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");
}
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);
}
}
}
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;
}
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;
}
Aggregations