use of blue.automation.Parameter in project blue by kunstmusik.
the class BSBDropdown method initializeParameters.
/* AUTOMATABLE METHODS */
@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.setMax(dropdownItems.size() - 1, true);
parameter.addParameterListener(this);
if (!parameter.isAutomationEnabled()) {
parameter.setValue(getSelectedIndex());
}
return;
}
Parameter param = new Parameter();
param.setValue(getSelectedIndex());
param.setMax(dropdownItems.size() - 1, 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 BSBDropdown method setupForCompilation.
/*
* (non-Javadoc)
*
* @see blue.orchestra.blueSynthBuilder.BSBObject#setupForCompilation(blue.orchestra.blueSynthBuilder.BSBCompilationUnit)
*/
@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;
}
}
if (dropdownItems.size() == 0) {
compilationUnit.addReplacementValue(getObjectName(), "0");
} else {
String replaceVal;
if (isAutomationAllowed()) {
replaceVal = "" + getSelectedIndex();
} else {
BSBDropdownItem item = dropdownItems.get(getSelectedIndex());
replaceVal = item.getValue();
}
compilationUnit.addReplacementValue(getObjectName(), replaceVal);
}
}
use of blue.automation.Parameter in project blue by kunstmusik.
the class BSBDropdown method lineDataChanged.
// private void updateSelectedIndex(int index) {
// int oldValue = getSelectedIndex();
// setSelectedIndex(index);
//
// if (propListeners != null) {
// propListeners.firePropertyChange("updateValue",
// new Integer(oldValue), new Integer(index));
// }
// }
@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);
setSelectedIndex((int) Math.round(val));
}
}
use of blue.automation.Parameter in project blue by kunstmusik.
the class BSBValue 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(getDefaultValue());
}
return;
}
Parameter param = new Parameter();
param.setValue(getDefaultValue());
param.setMax(getMaximum(), true);
param.setMin(getMinimum(), true);
param.setName(getObjectName());
param.setResolution(new BigDecimal(-1));
param.addParameterListener(this);
param.setValue(getDefaultValue());
parameters.add(param);
}
use of blue.automation.Parameter in project blue by kunstmusik.
the class BSBXYController method setupForCompilation.
@Override
public void setupForCompilation(BSBCompilationUnit compilationUnit) {
String xCompVal = null;
String yCompVal = null;
String objectName = getObjectName();
if (parameters != null) {
Parameter param = parameters.getParameter(objectName + "X");
if (param != null && param.getCompilationVarName() != null) {
xCompVal = param.getCompilationVarName();
}
param = parameters.getParameter(objectName + "Y");
if (param != null && param.getCompilationVarName() != null) {
yCompVal = param.getCompilationVarName();
}
}
compilationUnit.addReplacementValue(objectName + "X", (xCompVal == null) ? NumberUtilities.formatDouble(xValue.getValue()) : xCompVal);
compilationUnit.addReplacementValue(objectName + "Y", (yCompVal == null) ? NumberUtilities.formatDouble(yValue.getValue()) : yCompVal);
}
Aggregations