Search in sources :

Example 36 with Parameter

use of blue.automation.Parameter in project blue by kunstmusik.

the class BSBHSliderBank method initializeParameters.

@Override
public void initializeParameters() {
    if (parameters == null) {
        return;
    }
    if (!automationAllowed) {
        String objectName = getObjectName();
        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 (getObjectName() == null || getObjectName().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()) {
            BSBHSlider slider = (BSBHSlider) sliders.get(i);
            param.setValue(slider.getValue());
        }
        param.addParameterListener(this);
    }
    if (!missingParameters) {
        return;
    }
    for (int i = 0; i < sliders.size(); i++) {
        BSBHSlider slider = (BSBHSlider) 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);
    }
}
Also used : Parameter(blue.automation.Parameter)

Example 37 with Parameter

use of blue.automation.Parameter in project blue by kunstmusik.

the class BSBHSliderBank method setupForCompilation.

/*
     * (non-Javadoc)
     * 
     * @see blue.orchestra.blueSynthBuilder.BSBObject#setupForCompilation(blue.orchestra.blueSynthBuilder.BSBCompilationUnit)
     */
@Override
public void setupForCompilation(BSBCompilationUnit compilationUnit) {
    Object[] vals = new Object[2];
    vals[0] = getObjectName();
    for (int i = 0; i < sliders.size(); i++) {
        BSBHSlider slider = sliders.get(i);
        vals[1] = new Integer(i);
        String key = KEY_FMT.format(vals);
        if (parameters != null) {
            Parameter param = parameters.getParameter(key);
            if (param != null && param.getCompilationVarName() != null) {
                compilationUnit.addReplacementValue(key, param.getCompilationVarName());
                continue;
            }
        }
        compilationUnit.addReplacementValue(key, NumberUtilities.formatDouble(slider.getValue()));
    }
}
Also used : Parameter(blue.automation.Parameter)

Example 38 with Parameter

use of blue.automation.Parameter in project blue by kunstmusik.

the class BSBCheckBox method lineDataChanged.

@Override
public void lineDataChanged(Parameter param) {
    Parameter parameter = parameters.getParameter(this.getObjectName());
    if (parameter != null) {
        double time = ParameterTimeManagerFactory.getInstance().getTime();
        long val = Math.round(parameter.getLine().getValue(time));
        boolean newSelected = (val > 0);
        if (newSelected != isSelected()) {
            updateSelected(newSelected);
        }
    }
}
Also used : Parameter(blue.automation.Parameter)

Example 39 with Parameter

use of blue.automation.Parameter in project blue by kunstmusik.

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

Example 40 with Parameter

use of blue.automation.Parameter in project blue by kunstmusik.

the class Sound method setBlueSynthBuilder.

public void setBlueSynthBuilder(BlueSynthBuilder bsbObj) {
    if (this.bsbObj != null) {
        ParameterList paramList = bsbObj.getParameterList();
        paramList.removeListener(paramListListener);
    }
    ParameterList paramList = bsbObj.getParameterList();
    for (Parameter param : paramList) {
        adjustLineType(param);
    }
    paramList.addListener(paramListListener);
    this.bsbObj = bsbObj;
}
Also used : ParameterList(blue.automation.ParameterList) 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