use of blue.automation.Parameter in project blue by kunstmusik.
the class BSBVSliderBank method initializeParameters.
@Override
public void initializeParameters() {
if (parameters == null) {
return;
}
String objectName = getObjectName();
if (!automationAllowed) {
if (parameters != null) {
if (objectName != null && objectName.length() != 0) {
Object[] vals = new Object[2];
vals[0] = objectName;
vals[1] = new Integer(0);
Parameter param = parameters.getParameter(KEY_FMT.format(vals));
if (param != null && param.isAutomationEnabled()) {
automationAllowed = true;
} else {
for (int i = 0; i < sliders.size(); i++) {
vals[1] = new Integer(i);
String oldKey = KEY_FMT.format(vals);
parameters.removeParameter(oldKey);
}
return;
}
}
}
}
if (objectName == null || objectName.trim().length() == 0) {
return;
}
Object[] vals = new Object[2];
vals[0] = getObjectName();
boolean missingParameters = false;
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) {
missingParameters = true;
break;
}
if (!param.isAutomationEnabled()) {
BSBVSlider slider = (BSBVSlider) sliders.get(i);
param.setValue(slider.getValue());
}
param.addParameterListener(this);
}
if (!missingParameters) {
return;
}
for (int i = 0; i < sliders.size(); i++) {
BSBVSlider slider = (BSBVSlider) sliders.get(i);
vals[1] = new Integer(i);
String key = KEY_FMT.format(vals);
// clear for safety
parameters.removeParameter(key);
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(slider.getValue());
param.addParameterListener(this);
parameters.add(param);
}
}
use of blue.automation.Parameter in project blue by kunstmusik.
the class BSBValue 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);
setDefaultValue(val);
}
}
use of blue.automation.Parameter in project blue by kunstmusik.
the class CompileData method addInstrument.
/**
* Adds and instrument to the Arrangement
* @return instrument id that was assigned
*/
public int addInstrument(Instrument instrument) {
if (handleParametersAndChannels && stringChannels != null && originalParameters != null) {
if (instrument instanceof Automatable) {
Automatable auto = (Automatable) instrument;
ArrayList<StringChannel> tempStringChannels = auto.getStringChannels();
if (tempStringChannels != null) {
stringChannels.addAll(tempStringChannels);
for (StringChannel sChan : tempStringChannels) {
sChan.setChannelName(scnm.getUniqueStringChannel());
}
}
ParameterList paramList = auto.getParameterList();
if (paramList != null) {
originalParameters.addAll(paramList);
for (Parameter param : paramList) {
param.setCompilationVarName(pnm.getUniqueParamName());
}
}
}
}
return arrangement.addInstrument(instrument);
}
use of blue.automation.Parameter in project blue by kunstmusik.
the class AudioHeaderLayerPanel method paramColorSelectPropertyChange.
// GEN-LAST:event_automationButtonActionPerformed
private void paramColorSelectPropertyChange(java.beans.PropertyChangeEvent evt) {
// GEN-FIRST:event_paramColorSelectPropertyChange
if (audioLayer == null || paramIdList == null || updating) {
return;
}
int index = paramIdList.getSelectedIndex();
if (index < 0) {
return;
}
String id = paramIdList.getParameterId(index);
Parameter param = AutomationManager.getInstance().getParameter(id);
if (param != null) {
param.getLine().setColor(paramColorSelect.getColor());
}
}
use of blue.automation.Parameter in project blue by kunstmusik.
the class AudioHeaderLayerPanel method updateParameterPanel.
private void updateParameterPanel() {
int index = paramIdList.getSelectedIndex();
if (paramIdList.size() <= 0 || index < 0) {
updating = true;
paramColorSelect.setEnabled(false);
paramColorSelect.setColor(Color.BLACK);
updating = false;
paramNameLabel.setText("No Parameters Available");
paramNameLabel.setEnabled(false);
paramNextButton.setEnabled(false);
paramPreviousButton.setEnabled(false);
paramSelectPanel.setVisible(false);
return;
}
String id = paramIdList.getParameterId(index);
Parameter param = AutomationManager.getInstance().getParameter(id);
if (param == null) {
updating = true;
paramColorSelect.setEnabled(false);
paramColorSelect.setColor(Color.BLACK);
updating = false;
paramNameLabel.setText("No Parameters Available");
paramNameLabel.setEnabled(false);
paramNextButton.setEnabled(false);
paramPreviousButton.setEnabled(false);
paramSelectPanel.setVisible(false);
return;
}
if (getHeight() > 22) {
paramSelectPanel.setVisible(true);
}
updating = true;
paramColorSelect.setEnabled(true);
paramColorSelect.setColor(param.getLine().getColor());
paramNameLabel.setText(param.getName());
paramNameLabel.setEnabled(true);
int size = paramIdList.size();
paramNextButton.setEnabled(true);
paramPreviousButton.setEnabled(true);
updating = false;
}
Aggregations