Search in sources :

Example 41 with Parameter

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

the class SoundLayerPanel method updateParameterPanel.

// GEN-LAST:event_muteToggleButtonActionPerformed
private void updateParameterPanel() {
    if (!automatable) {
        paramSelectPanel.setVisible(false);
        return;
    }
    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)

Example 42 with Parameter

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

the class CSDRender method generateCSDForBlueLiveImpl.

@Override
protected synchronized CsdRenderResult generateCSDForBlueLiveImpl(BlueData data, boolean usingAPI) {
    ProjectPluginManager.getInstance().preRender(data);
    StringChannelNameManager scnm = new StringChannelNameManager();
    ArrayList<StringChannel> stringChannels = getStringChannels(data.getArrangement(), scnm);
    ParameterHelper.clearCompilationVarNames(data);
    double totalDur = 36000f;
    // making copies to use for adding compileTime tables and instruments
    Tables tables = new Tables(data.getTableSet());
    ArrayList<Parameter> originalParameters = null;
    if (usingAPI) {
        originalParameters = ParameterHelper.getAllParameters(data.getArrangement(), data.getMixer());
        assignParameterNames(originalParameters, new ParameterNameManager());
    }
    Arrangement arrangement = new Arrangement(data.getArrangement());
    arrangement.clearUnusedInstrAssignments();
    String[] instrIds = arrangement.getInstrumentIds();
    // PolyObject tempPObj = (PolyObject) data.getPolyObject().clone();
    boolean hasInstruments = arrangement.size() > 0;
    GlobalOrcSco globalOrcSco = new GlobalOrcSco(data.getGlobalOrcSco());
    OpcodeList udos = new OpcodeList(data.getOpcodeList());
    // add all UDO's from instruments and effects
    arrangement.generateUserDefinedOpcodes(udos);
    appendFtgenTableNumbers(globalOrcSco.getGlobalOrc(), tables);
    arrangement.generateFTables(tables);
    CompileData compileData = new CompileData(arrangement, tables);
    // SKIPPING ANYTHING RELATED TO SCORE
    boolean mixerEnabled = data.getMixer().isEnabled();
    Mixer mixer = null;
    if (mixerEnabled) {
        mixer = new Mixer(data.getMixer());
        assignChannelIds(compileData, mixer);
    }
    boolean generateMixer = mixerEnabled && (hasInstruments || mixer.hasSubChannelDependencies());
    int nchnls = getNchnls(data, true);
    ArrayList<Instrument> alwaysOnInstruments = new ArrayList<>();
    arrangement.preGenerateOrchestra(compileData, mixer, nchnls, alwaysOnInstruments);
    String globalSco = globalOrcSco.getGlobalSco() + "\n";
    globalSco += arrangement.generateGlobalSco(compileData) + "\n";
    globalSco = preprocessSco(globalSco, totalDur, 0, 0, null);
    NoteList generatedNotes = null;
    for (Instrument instrument : alwaysOnInstruments) {
        String sourceId = compileData.getInstrSourceId(instrument);
        if (StringUtils.isNumeric(sourceId)) {
            int instrId = arrangement.addInstrumentAtEnd(instrument);
            globalSco += "i" + instrId + " 0 " + totalDur + "\n";
        } else {
            String instrId = sourceId + "_alwaysOn";
            arrangement.addInstrumentWithId(instrument, instrId, false);
            globalSco += "i \"" + instrId + "\" 0 " + totalDur + "\n";
        }
    }
    if (usingAPI) {
        // ArrayList parameters = ParameterHelper.getAllParameters(
        // arrangement, mixer);
        generatedNotes = new NoteList();
        handleParametersForBlueLive(originalParameters, stringChannels, globalOrcSco, generatedNotes, arrangement, usingAPI);
    }
    if (generateMixer) {
        final String mixerId = "BlueMixer";
        clearUnusedMixerChannels(mixer, arrangement);
        globalOrcSco.appendGlobalOrc(mixer.getInitStatements(compileData, nchnls));
        arrangement.addInstrumentWithId(mixer.getMixerInstrument(compileData, udos, nchnls), mixerId, false);
        globalSco += "i \"BlueMixer\" 0 " + totalDur;
    }
    arrangement.addInstrument("blueAllNotesOff", createAllNotesOffInstrument(instrIds));
    String ftables = tables.getTables();
    StrBuilder score = new StrBuilder();
    score.append("<CsoundSynthesizer>\n\n");
    appendCsInstruments(compileData, data, udos, arrangement, globalOrcSco, score, mixer, true);
    appendCsScore(globalSco, ftables, generatedNotes, totalDur, score);
    score.append("</CsoundSynthesizer>");
    // Tempo tempo = data.getScore().getTempo();
    TempoMapper tempoMapper = null;
    // if (tempo.isEnabled()) {
    // tempoMapper = CSDRender.getTempoMapper(tempo);
    // } else {
    // tempoMapper = CSDRender.getTempoMapper(globalSco);
    // }
    CsdRenderResult renderResult = new CsdRenderResult(score.toString(), tempoMapper, originalParameters, stringChannels);
    return renderResult;
}
Also used : GlobalOrcSco(blue.GlobalOrcSco) NoteList(blue.soundObject.NoteList) StringChannel(blue.orchestra.blueSynthBuilder.StringChannel) Mixer(blue.mixer.Mixer) ArrayList(java.util.ArrayList) Arrangement(blue.Arrangement) LinePoint(blue.components.lines.LinePoint) TempoMapper(blue.noteProcessor.TempoMapper) ParameterNameManager(blue.automation.ParameterNameManager) OpcodeList(blue.udo.OpcodeList) StringChannelNameManager(blue.orchestra.blueSynthBuilder.StringChannelNameManager) Instrument(blue.orchestra.Instrument) GenericInstrument(blue.orchestra.GenericInstrument) Tables(blue.Tables) Parameter(blue.automation.Parameter) CompileData(blue.CompileData) StrBuilder(org.apache.commons.lang3.text.StrBuilder) CsdRenderResult(blue.services.render.CsdRenderResult)

Example 43 with Parameter

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

the class CSDRender method assignParameterNames.

private void assignParameterNames(ArrayList parameters, ParameterNameManager pnm) {
    for (int i = 0; i < parameters.size(); i++) {
        Parameter param = (Parameter) parameters.get(i);
        param.setCompilationVarName(pnm.getUniqueParamName());
    }
}
Also used : Parameter(blue.automation.Parameter) LinePoint(blue.components.lines.LinePoint)

Example 44 with Parameter

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

the class CSDRender method handleParametersForBlueLive.

private void handleParametersForBlueLive(ArrayList parameters, ArrayList<StringChannel> stringChannels, GlobalOrcSco globalOrcSco, NoteList notes, Arrangement arrangement, boolean useAPI) {
    Object[] varNum = new Object[1];
    StrBuilder initStatements = new StrBuilder();
    StrBuilder paramScore = new StrBuilder();
    for (StringChannel strChannel : stringChannels) {
        String varName = strChannel.getChannelName();
        initStatements.append(varName);
        initStatements.append(" = ");
        initStatements.append("\"").append(strChannel.getValue()).append("\"\n");
        if (useAPI) {
            initStatements.append(varName).append(" chnexport \"");
            initStatements.append(varName).append("\", 3\n");
        }
    }
    for (int i = 0; i < parameters.size(); i++) {
        Parameter param = (Parameter) parameters.get(i);
        varNum[0] = new Integer(i);
        String varName = param.getCompilationVarName();
        // param.setCompilationVarName(varName);
        double initialVal = param.getFixedValue();
        // init statements
        initStatements.append(varName);
        initStatements.append(" init ");
        initStatements.append(NumberUtilities.formatDouble(initialVal));
        initStatements.append("\n");
        if (useAPI) {
            initStatements.append(varName).append(" chnexport \"");
            initStatements.append(varName).append("\", 3\n");
        }
    }
    globalOrcSco.appendGlobalOrc(initStatements.toString());
    try {
        notes.addAll(ScoreUtilities.getNotes(paramScore.toString()));
    } catch (NoteParseException ex) {
        ex.printStackTrace();
    }
// globalOrcSco.appendGlobalSco(paramScore.toString());
}
Also used : NoteParseException(blue.soundObject.NoteParseException) StringChannel(blue.orchestra.blueSynthBuilder.StringChannel) Parameter(blue.automation.Parameter) StrBuilder(org.apache.commons.lang3.text.StrBuilder) LinePoint(blue.components.lines.LinePoint)

Example 45 with Parameter

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

the class ParameterHelper method appendAllParametersFromChannel.

private static void appendAllParametersFromChannel(ArrayList<Parameter> params, Channel channel) {
    EffectsChain pre = channel.getPreEffects();
    for (int i = 0; i < pre.size(); i++) {
        ParameterList list = ((Automatable) pre.getElementAt(i)).getParameterList();
        params.addAll(list);
    }
    EffectsChain post = channel.getPostEffects();
    for (int i = 0; i < post.size(); i++) {
        ParameterList list = ((Automatable) post.getElementAt(i)).getParameterList();
        params.addAll(list);
    }
    Parameter levelParameter = channel.getLevelParameter();
    // if(!levelParameter.isAutomationEnabled()) {
    // levelParameter.setCompilationVarName(channel.getName());
    // }
    params.add(levelParameter);
}
Also used : EffectsChain(blue.mixer.EffectsChain) ParameterList(blue.automation.ParameterList) Parameter(blue.automation.Parameter) Automatable(blue.automation.Automatable)

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