Search in sources :

Example 6 with Parameter

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);
}
Also used : Parameter(blue.automation.Parameter) BigDecimal(java.math.BigDecimal)

Example 7 with Parameter

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);
    }
}
Also used : Parameter(blue.automation.Parameter)

Example 8 with Parameter

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));
    }
}
Also used : Parameter(blue.automation.Parameter)

Example 9 with Parameter

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);
}
Also used : Parameter(blue.automation.Parameter) BigDecimal(java.math.BigDecimal)

Example 10 with Parameter

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);
}
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