use of blue.automation.Parameter in project blue by kunstmusik.
the class BSBXYController method setObjectName.
// OVERRIDE to handle parameter name changes and multiple parameters
@Override
public void setObjectName(String objectName) {
String oldName = this.getObjectName();
if (unm != null) {
if (objectName != null && objectName.length() != 0) {
if (!unm.isUnique(objectName + "X") || !unm.isUnique(objectName + "Y")) {
return;
}
}
}
boolean doInitialize = false;
if (parameters != null && automationAllowed) {
if (objectName == null || objectName.length() == 0) {
parameters.removeParameter(oldName + "X");
parameters.removeParameter(oldName + "Y");
} else {
Parameter param = parameters.getParameter(oldName + "X");
Parameter param2 = parameters.getParameter(oldName + "Y");
if (param == null || param2 == null) {
parameters.removeParameter(oldName + "X");
parameters.removeParameter(oldName + "Y");
doInitialize = true;
} else {
param.setName(objectName + "X");
param2.setName(objectName + "Y");
}
}
}
this.objectNameProperty().set(objectName);
if (doInitialize) {
initializeParameters();
}
}
use of blue.automation.Parameter in project blue by kunstmusik.
the class BSBXYController method initializeParameters.
@Override
public void initializeParameters() {
if (parameters == null) {
return;
}
String objectName = getObjectName();
if (!automationAllowed) {
if (objectName != null && objectName.length() != 0) {
Parameter param = parameters.getParameter(objectName + "X");
if (param != null && param.isAutomationEnabled()) {
automationAllowed = true;
} else {
parameters.removeParameter(objectName + "X");
parameters.removeParameter(objectName + "Y");
return;
}
}
}
if (objectName == null || objectName.trim().length() == 0) {
return;
}
Parameter param = parameters.getParameter(objectName + "X");
Parameter param2 = parameters.getParameter(objectName + "Y");
if (param != null && param2 != null) {
param.addParameterListener(this);
param2.addParameterListener(this);
if (!param.isAutomationEnabled()) {
param.setValue(xValue.getValue());
}
if (!param2.isAutomationEnabled()) {
param2.setValue(yValue.getValue());
}
return;
}
// in case of corrupted file
if (param != null || param2 != null) {
parameters.removeParameter(objectName + "X");
parameters.removeParameter(objectName + "Y");
return;
}
param = new Parameter();
param.setValue(xValue.getValue());
param.setMax(xValue.getMax(), true);
param.setMin(xValue.getMin(), true);
param.setName(getObjectName() + "X");
param.setResolution(new BigDecimal(-1));
param.addParameterListener(this);
param.setValue(xValue.getValue());
parameters.add(param);
param = new Parameter();
param.setValue(yValue.getValue());
param.setMax(yValue.getMax(), true);
param.setMin(yValue.getMin(), true);
param.setName(getObjectName() + "Y");
param.setResolution(new BigDecimal(-1));
param.addParameterListener(this);
param.setValue(yValue.getValue());
parameters.add(param);
}
use of blue.automation.Parameter in project blue by kunstmusik.
the class BSBKnob 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(new BigDecimal(-1));
param.addParameterListener(this);
param.setValue(getValue());
parameters.add(param);
}
use of blue.automation.Parameter in project blue by kunstmusik.
the class BSBKnob 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);
}
}
use of blue.automation.Parameter in project blue by kunstmusik.
the class BSBHSliderBank method setObjectName.
// OVERRIDE to handle Parameter name changes and multiple parameters
@Override
public void setObjectName(String objectName) {
if (objectName == null || objectName.equals(getObjectName())) {
return;
}
if (unm != null) {
if (!objectName.isEmpty()) {
Object[] vals = new Object[2];
vals[0] = objectName;
for (int i = 0; i < sliders.size(); i++) {
vals[1] = new Integer(i);
String objName = KEY_FMT.format(vals);
if (!unm.isUnique(objName)) {
return;
}
}
}
}
String oldName = this.getObjectName();
boolean doInitialize = false;
if (parameters != null && automationAllowed) {
Object[] vals = new Object[2];
vals[0] = oldName;
Object[] vals2 = new Object[2];
vals2[0] = objectName;
if (!objectName.isEmpty()) {
for (int i = 0; i < sliders.size(); i++) {
vals[1] = new Integer(i);
String oldKey = KEY_FMT.format(vals);
parameters.removeParameter(oldKey);
}
} else {
boolean missingParameters = false;
for (int i = 0; i < sliders.size(); i++) {
vals[1] = new Integer(i);
vals2[1] = new Integer(i);
String oldKey = KEY_FMT.format(vals);
String newKey = KEY_FMT.format(vals2);
Parameter param = parameters.getParameter(oldKey);
if (param == null) {
missingParameters = true;
break;
} else {
param.setName(newKey);
}
}
if (missingParameters) {
for (int i = 0; i < sliders.size(); i++) {
vals[1] = new Integer(i);
String oldKey = KEY_FMT.format(vals);
parameters.removeParameter(oldKey);
}
doInitialize = true;
}
}
}
this.objectNameProperty().set(objectName);
if (doInitialize) {
initializeParameters();
}
}
Aggregations