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