Search in sources :

Example 1 with Parameter

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

the class MixerNode method applyFader.

private static void applyFader(CompileData data, Mixer mixer, MixerNode node, int nchnls, StrBuilder buffer) {
    String modifier = null;
    Parameter levelParam = node.channel.getLevelParameter();
    String compilationVarName = levelParam.getCompilationVarName();
    if (levelParam.isAutomationEnabled()) {
        if (compilationVarName != null) {
            buffer.append("ktempdb = ampdb(");
            buffer.append(compilationVarName).append(")\n");
            modifier = "ktempdb";
        }
    } else {
        double multiplier = MusicFunctions.ampdb(node.channel.getLevel());
        if (compilationVarName != null) {
            buffer.append("ktempdb = ampdb(");
            buffer.append(compilationVarName).append(")\n");
            modifier = "ktempdb";
        } else if (multiplier != 1.0f) {
            modifier = getMultiplierString(multiplier);
        }
    }
    if (modifier != null) {
        for (int i = 0; i < nchnls; i++) {
            String sig = mixer.getVar(data, node.channel, i);
            buffer.append(sig).append(" *= ");
            // buffer.append(sig).append(" * ");
            buffer.append(modifier).append("\n");
        }
    }
}
Also used : Parameter(blue.automation.Parameter)

Example 2 with Parameter

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

the class BSBCheckBox method initializeParameters.

/* Automatable */
@Override
protected 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(this.isSelected() ? 1 : 0);
        }
        return;
    }
    Parameter param = new Parameter();
    param.setValue(this.isSelected() ? 1 : 0);
    param.setMax(1.0f, true);
    param.setMin(0.0f, true);
    param.setName(getObjectName());
    param.setResolution(new BigDecimal(1));
    param.addParameterListener(this);
    parameters.add(param);
}
Also used : Parameter(blue.automation.Parameter) BigDecimal(java.math.BigDecimal)

Example 3 with Parameter

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

the class BSBCheckBox method setupForCompilation.

@Override
public void setupForCompilation(BSBCompilationUnit compilationUnit) {
    if (parameters != null) {
        Parameter param = parameters.getParameter(this.getObjectName());
        if (param != null && param.getCompilationVarName() != null) {
            compilationUnit.addReplacementValue(getObjectName(), param.getCompilationVarName());
            return;
        }
    }
    String replaceVal = this.isSelected() ? "1" : "0";
    compilationUnit.addReplacementValue(getObjectName(), replaceVal);
}
Also used : Parameter(blue.automation.Parameter)

Example 4 with Parameter

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

the class BSBHSlider 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 5 with Parameter

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

the class AutomatableBSBObject method setObjectName.

// OVERRIDE to handle parameter name changes
@Override
public void setObjectName(String objectName) {
    if (objectName == null || objectName.equals(getObjectName())) {
        return;
    }
    if (unm != null) {
        if (objectName != null && objectName.length() != 0 && !unm.isUnique(objectName)) {
            return;
        }
    }
    String oldName = this.getObjectName();
    boolean doInitialize = false;
    if (parameters != null && automationAllowed) {
        if (objectName == null || objectName.length() == 0) {
            parameters.removeParameter(oldName);
        } else {
            Parameter param = parameters.getParameter(oldName);
            if (param == null) {
                doInitialize = true;
            } else {
                param.setName(objectName);
            }
        }
    }
    super.setObjectName(objectName);
    if (doInitialize) {
        initializeParameters();
    }
}
Also used : 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