Search in sources :

Example 6 with BlueSynthBuilder

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);
                    }
                }
            }
        }
    }
}
Also used : BlueData(blue.BlueData) BSBGraphicInterface(blue.orchestra.blueSynthBuilder.BSBGraphicInterface) BSBObject(blue.orchestra.blueSynthBuilder.BSBObject) BSBSubChannelDropdown(blue.orchestra.blueSynthBuilder.BSBSubChannelDropdown) Instrument(blue.orchestra.Instrument) BlueSynthBuilder(blue.orchestra.BlueSynthBuilder) Arrangement(blue.Arrangement)

Example 7 with BlueSynthBuilder

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);
}
Also used : BlueData(blue.BlueData) LinePoint(blue.components.lines.LinePoint) AddScoreObjectEdit(blue.ui.core.score.undo.AddScoreObjectEdit) SoundLayer(blue.SoundLayer) Parameter(blue.automation.Parameter) ScoreObject(blue.score.ScoreObject) Sound(blue.soundObject.Sound) BlueSynthBuilder(blue.orchestra.BlueSynthBuilder) SoundLayer(blue.SoundLayer) Layer(blue.score.layers.Layer)

Aggregations

BlueSynthBuilder (blue.orchestra.BlueSynthBuilder)7 Instrument (blue.orchestra.Instrument)5 BlueData (blue.BlueData)3 BSBGraphicInterface (blue.orchestra.blueSynthBuilder.BSBGraphicInterface)3 Arrangement (blue.Arrangement)2 TransferableInstrument (blue.TransferableInstrument)2 GenericInstrument (blue.orchestra.GenericInstrument)2 BSBObject (blue.orchestra.blueSynthBuilder.BSBObject)2 BSBSubChannelDropdown (blue.orchestra.blueSynthBuilder.BSBSubChannelDropdown)2 Point (java.awt.Point)2 InstrumentLibrary (blue.InstrumentLibrary)1 SoundLayer (blue.SoundLayer)1 Parameter (blue.automation.Parameter)1 LinePoint (blue.components.lines.LinePoint)1 InstrumentCategory (blue.orchestra.InstrumentCategory)1 PresetGroup (blue.orchestra.blueSynthBuilder.PresetGroup)1 ScoreObject (blue.score.ScoreObject)1 Layer (blue.score.layers.Layer)1 Sound (blue.soundObject.Sound)1 AddScoreObjectEdit (blue.ui.core.score.undo.AddScoreObjectEdit)1