Search in sources :

Example 26 with Parameter

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

Example 27 with Parameter

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

Example 28 with Parameter

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);
}
Also used : StringChannel(blue.orchestra.blueSynthBuilder.StringChannel) ParameterList(blue.automation.ParameterList) Parameter(blue.automation.Parameter) Automatable(blue.automation.Automatable)

Example 29 with Parameter

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

Example 30 with Parameter

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