use of blue.orchestra.BlueSynthBuilder 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);
}
}
}
}
}
}
use of blue.orchestra.BlueSynthBuilder in project blue by kunstmusik.
the class PasteBSBAsSoundAction method actionPerformed.
@Override
public void actionPerformed(ActionEvent e) {
double start = (double) p.x / timeState.getPixelSecond();
if (timeState.isSnapEnabled()) {
start = ScoreUtilities.getSnapValueStart(start, timeState.getSnapValue());
}
Object obj = CopyBuffer.getBufferedObject(CopyBuffer.INSTRUMENT);
Sound sound = new Sound();
sound.setStartTime(start);
BlueSynthBuilder bsbCopy = ((BlueSynthBuilder) obj).deepCopy();
// clear out any existing automations
for (Parameter param : bsbCopy.getParameterList()) {
param.setAutomationEnabled(false);
param.getLine().clear();
param.getLine().addLinePoint(new LinePoint(0.0, param.getValue(0.0)));
param.getLine().addLinePoint(new LinePoint(1.0, param.getValue(0.0)));
}
sound.setBlueSynthBuilder(bsbCopy);
Layer layer = scorePath.getGlobalLayerForY(p.y);
if (!layer.accepts(sound)) {
JOptionPane.showMessageDialog(null, "Unable to paste due to target layers not " + "accepting types of objects within the copy buffer (i.e. trying to " + "paste a SoundObject into an AudioLayer");
return;
}
SoundLayer sLayer = (SoundLayer) layer;
sLayer.add(sound);
BlueData data = BlueProjectManager.getInstance().getCurrentBlueData();
AddScoreObjectEdit undoEdit = new AddScoreObjectEdit(sLayer, sound);
BlueUndoManager.setUndoManager("score");
BlueUndoManager.addEdit(undoEdit);
}
Aggregations