Search in sources :

Example 31 with Parameter

use of blue.automation.Parameter in project blue by kunstmusik.

the class MixerNode method applyEffects.

private static void applyEffects(EffectsChain chain, OpcodeList udos, EffectManager manager, String signalChannels, StrBuilder buffer, final int lastSendIndex, Set<String> inputSignalCache) {
    int lastIndex = lastSendIndex;
    if (lastIndex == Integer.MAX_VALUE) {
        lastIndex = chain.size() - 1;
    } else if (lastIndex < 0) {
        return;
    }
    for (int i = 0; i <= lastIndex; i++) {
        Object obj = chain.getElementAt(i);
        if (obj instanceof Effect) {
            Effect effect = (Effect) obj;
            if (effect.isEnabled()) {
                UserDefinedOpcode udo = effect.generateUDO(udos);
                udo.commentText = effect.getName();
                String effectName = udos.getNameOfEquivalentCopy(udo);
                if (effectName == null) {
                    effectName = manager.getEffectName();
                    udo.opcodeName = effectName;
                    udos.addOpcode(udo);
                }
                buffer.append(signalChannels).append("\t");
                buffer.append(effectName).append("\t");
                buffer.append(signalChannels).append("\n");
            }
        } else if (obj instanceof Send) {
            Send send = (Send) obj;
            if (send.isEnabled()) {
                String[] parts = signalChannels.split(",");
                String sendChannelName = send.getSendChannel();
                inputSignalCache.add(sendChannelName);
                for (int j = 0; j < parts.length; j++) {
                    String subVar = Mixer.getSubChannelVar(sendChannelName, j);
                    buffer.append(subVar).append("\t+=\t");
                    Parameter levelParam = send.getLevelParameter();
                    if (levelParam.isAutomationEnabled()) {
                        String compilationVarName = levelParam.getCompilationVarName();
                        buffer.append("(").append(parts[j].trim()).append(" * ");
                        buffer.append(compilationVarName).append(")\n");
                    } else if (send.getLevel() == 1.0f) {
                        buffer.append(parts[j].trim()).append("\n");
                    } else {
                        String levelStr = NumberUtilities.formatDouble(send.getLevel());
                        buffer.append("(").append(parts[j].trim()).append(" * ");
                        buffer.append(levelStr).append(")\n");
                    }
                }
            }
        }
    }
}
Also used : UserDefinedOpcode(blue.udo.UserDefinedOpcode) Parameter(blue.automation.Parameter)

Example 32 with Parameter

use of blue.automation.Parameter in project blue by kunstmusik.

the class BSBVSlider method initializeParameters.

@Override
public void initializeParameters() {
    if (parameters == null) {
        return;
    }
    if (!automationAllowed) {
        if (getObjectName() != null && getObjectName().length() != 0) {
            Parameter param = parameters.getParameter(getObjectName());
            if (param != null && param.isAutomationEnabled()) {
                automationAllowed = true;
            } else {
                parameters.removeParameter(getObjectName());
                return;
            }
        }
    }
    if (this.getObjectName() == null || this.getObjectName().trim().length() == 0) {
        return;
    }
    Parameter parameter = parameters.getParameter(this.getObjectName());
    if (parameter != null) {
        parameter.addParameterListener(this);
        if (!parameter.isAutomationEnabled()) {
            parameter.setValue(getValue());
        }
        return;
    }
    Parameter param = new Parameter();
    param.setValue(getValue());
    param.setMax(getMaximum(), true);
    param.setMin(getMinimum(), true);
    param.setName(getObjectName());
    param.setResolution(getResolution());
    param.addParameterListener(this);
    param.setValue(getValue());
    parameters.add(param);
}
Also used : Parameter(blue.automation.Parameter)

Example 33 with Parameter

use of blue.automation.Parameter in project blue by kunstmusik.

the class BSBVSlider method lineDataChanged.

@Override
public void lineDataChanged(Parameter param) {
    Parameter parameter = parameters.getParameter(this.getObjectName());
    if (parameter != null) {
        double time = ParameterTimeManagerFactory.getInstance().getTime();
        double val = parameter.getLine().getValue(time);
        setValue(val);
    }
}
Also used : Parameter(blue.automation.Parameter)

Example 34 with Parameter

use of blue.automation.Parameter in project blue by kunstmusik.

the class BSBHSliderBank method setNumberOfSliders.

public void setNumberOfSliders(int numSliders) {
    if (numSliders > 0 && numSliders != sliders.size()) {
        int diff = numSliders - sliders.size();
        Object[] vals = new Object[2];
        vals[0] = getObjectName();
        if (diff > 0) {
            if (!willBeUnique(numSliders)) {
                return;
            }
            BSBHSlider lastSlider = (BSBHSlider) sliders.get(sliders.size() - 1);
            for (int i = 0; i < diff; i++) {
                BSBHSlider copy = new BSBHSlider(lastSlider);
                sliders.add(copy);
                if (parameters != null && getObjectName() != null && getObjectName().trim().length() > 0) {
                    vals[1] = new Integer(sliders.size() - 1);
                    String key = KEY_FMT.format(vals);
                    Parameter param = new Parameter();
                    param.setName(key);
                    // order of setting these is important
                    if (getMinimum() > param.getMax()) {
                        param.setMax(getMaximum(), true);
                        param.setMin(getMinimum(), true);
                    } else {
                        param.setMin(getMinimum(), true);
                        param.setMax(getMaximum(), true);
                    }
                    param.setResolution(getResolution());
                    param.setValue(copy.getValue());
                    param.addParameterListener(this);
                    parameters.add(param);
                }
            }
        } else {
            for (int i = 0; i < -diff; i++) {
                BSBHSlider slider = (BSBHSlider) sliders.get(sliders.size() - 1);
                sliders.remove(slider);
                if (parameters != null && getObjectName() != null && getObjectName().trim().length() > 0) {
                    vals[1] = new Integer(sliders.size());
                    String key = KEY_FMT.format(vals);
                    parameters.removeParameter(key);
                }
            }
        }
    }
    fireBSBObjectChanged();
}
Also used : Parameter(blue.automation.Parameter)

Example 35 with Parameter

use of blue.automation.Parameter in project blue by kunstmusik.

the class BSBHSliderBank method getParameters.

private List<Parameter> getParameters() {
    List<Parameter> params = new ArrayList<>();
    if (parameters != null) {
        Object[] vals = new Object[2];
        vals[0] = getObjectName();
        for (int i = 0; i < sliders.size(); i++) {
            vals[1] = new Integer(i);
            String key = KEY_FMT.format(vals);
            Parameter param = parameters.getParameter(key);
            if (param != null) {
                params.add(param);
            }
        }
    }
    return params;
}
Also used : ArrayList(java.util.ArrayList) Parameter(blue.automation.Parameter)

Aggregations

Parameter (blue.automation.Parameter)47 LinePoint (blue.components.lines.LinePoint)6 ParameterList (blue.automation.ParameterList)5 BigDecimal (java.math.BigDecimal)5 ArrayList (java.util.ArrayList)5 Automatable (blue.automation.Automatable)4 StringChannel (blue.orchestra.blueSynthBuilder.StringChannel)4 Instrument (blue.orchestra.Instrument)3 StrBuilder (org.apache.commons.lang3.text.StrBuilder)3 InstrumentAssignment (blue.InstrumentAssignment)2 Channel (blue.mixer.Channel)2 ChannelList (blue.mixer.ChannelList)2 GenericInstrument (blue.orchestra.GenericInstrument)2 NoteParseException (blue.soundObject.NoteParseException)2 Sound (blue.soundObject.Sound)2 Arrangement (blue.Arrangement)1 BlueData (blue.BlueData)1 CompileData (blue.CompileData)1 GlobalOrcSco (blue.GlobalOrcSco)1 SoundLayer (blue.SoundLayer)1