Search in sources :

Example 1 with StrBuilder

use of org.apache.commons.lang3.text.StrBuilder in project RoboBinding by RoboBinding.

the class PresentationModelErrors method getMessage.

@Override
public String getMessage() {
    StrBuilder sb = new StrBuilder();
    sb.appendln("");
    sb.appendln(MessageFormat.format("----------------{0} errors:---------------", presentationModelTypeName));
    appendErrors(sb, "property errors:", propertyErrors);
    sb.appendln("");
    appendErrors(sb, "property dependency errors:", propertyDependencyErrors);
    return sb.toString();
}
Also used : StrBuilder(org.apache.commons.lang3.text.StrBuilder)

Example 2 with StrBuilder

use of org.apache.commons.lang3.text.StrBuilder in project RoboBinding by RoboBinding.

the class InlineLinkTagTranslator method translate.

public String translate(String text, Tag containingTag, Doc doc, TagletWriterImpl tagletWriterImpl) {
    StrBuilder sb = new StrBuilder(text);
    List<SeeTag> inlineLinkTags = getInlineLinkTags(containingTag);
    for (SeeTag inlineLinkTag : inlineLinkTags) {
        String inlineLinkContent = "{@link " + inlineLinkTag.text() + "}";
        if (sb.contains(inlineLinkContent)) {
            TagletOutput tagletOutput = tagletWriterImpl.seeTagOutput(doc, new SeeTag[] { inlineLinkTag });
            String seeAlsoText = tagletOutput.toString();
            sb.replaceAll(inlineLinkContent, seeAlsoText.split("</span></dt><dd>")[1]);
        }
    }
    return sb.toString();
}
Also used : SeeTag(com.sun.javadoc.SeeTag) StrBuilder(org.apache.commons.lang3.text.StrBuilder) TagletOutput(com.sun.tools.doclets.internal.toolkit.taglets.TagletOutput)

Example 3 with StrBuilder

use of org.apache.commons.lang3.text.StrBuilder in project blue by kunstmusik.

the class BlueX7 method generateFTables.

@Override
public void generateFTables(Tables tables) {
    StrBuilder buffer = new StrBuilder();
    Object obj = tables.getCompilationVariable(BLUEX7_HAS_BEEN_COMPILED);
    // static ftable generation)
    if (obj == null || obj != Boolean.TRUE) {
        tables.setCompilationVariable(BLUEX7_HAS_BEEN_COMPILED, Boolean.TRUE);
        // assigning static table numbers
        sineTable = tables.getOpenFTableNumber();
        outputAmpTable = tables.getOpenFTableNumber();
        rateScaleTable = tables.getOpenFTableNumber();
        egRateRiseLvlTable = tables.getOpenFTableNumber();
        egRateRisePercentageTable = tables.getOpenFTableNumber();
        egRateDecayLvlTable = tables.getOpenFTableNumber();
        egRateDecayPercentageTable = tables.getOpenFTableNumber();
        egLevelPeakTable = tables.getOpenFTableNumber();
        velAmpTable = tables.getOpenFTableNumber();
        velSensitivityTable = tables.getOpenFTableNumber();
        feedbackScaleTable = tables.getOpenFTableNumber();
        buffer.append("; [BLUEX7] - START STATIC TABLES");
        buffer.append("; sine wave\n");
        buffer.append("f" + sineTable + "     0       512     10      1\n");
        buffer.append("; operator output level to amp scale function (data from Chowning/Bristow)\n");
        buffer.append("f" + outputAmpTable + "     0       128     7       0       10      .003    10      .013");
        buffer.append("       10      .031    10      .079    10      .188    10      .446");
        buffer.append("       5       .690    5       1.068   5       1.639   5       2.512");
        buffer.append("       5       3.894   5       6.029   5       9.263   4       13.119");
        buffer.append("       29      13.119\n");
        buffer.append("; rate scaling function\n");
        buffer.append("f" + rateScaleTable + "     0       128     7       0       128     1\n");
        buffer.append("; eg rate rise function for lvl change between 0 and 99 (data from Opcode)\n");
        buffer.append("f" + egRateRiseLvlTable + "     0       128     -7      38      5       22.8    5       12      5");
        buffer.append("       7.5     5       4.8     5       2.7     5       1.8     5       1.3");
        buffer.append("       8       .737    3       .615    3       .505    3       .409    3");
        buffer.append("       .321    6       .080    6       .055    2       .032    3       .024");
        buffer.append("       3       .018    3       .014    3       .011    3       .008    3");
        buffer.append("       .008    3       .007    3       .005    3       .003    32      .003\n");
        buffer.append("; eg rate rise percentage function\n");
        buffer.append("f" + egRateRisePercentageTable + "     0       128     -7      .00001  31      .00001  4       .02     5");
        buffer.append("       .06     10      .14     10      .24     10      .35     10      .50");
        buffer.append("       10      .70     5       .86     4       1.0     29      1.0\n");
        buffer.append("; eg rate decay function for lvl change between 0 and 99\n");
        buffer.append("f" + egRateDecayLvlTable + "     0       128     -7      318     4       181     5       115     5");
        buffer.append("       63      5       39.7    5       20      5       11.2    5       7");
        buffer.append("       8       5.66    3       3.98    6       1.99    3       1.34    3");
        buffer.append("       .99     3       .71     5       .41     3       .15     3       .081");
        buffer.append("       3       .068    3       .047    3       .037    3       .025    3");
        buffer.append("       .02     3       .013    3       .008    36      .008\n");
        buffer.append("; eg rate decay percentage function\n");
        buffer.append("f" + egRateDecayPercentageTable + "     0       128     -7      .00001  10      .25     10      .35     10");
        buffer.append("     .43     10      .52     10      .59     10      .70     10      .77");
        buffer.append("     10      .84     10      .92     9       1.0     29      1.0\n");
        buffer.append("; eg level to peak deviation mapping function (index in radians = Index / 2PI)\n");
        buffer.append("f" + egLevelPeakTable + "     0       128     -7      0       10      .000477 10      .002");
        buffer.append("     10      .00493  10      .01257  10      .02992  10      .07098");
        buffer.append("     5       .10981  5       .16997  5       .260855 5       .39979");
        buffer.append("     5       .61974  5       .95954  5       1.47425 4       2.08795");
        buffer.append("     29      2.08795\n");
        buffer.append("; velocity to amp factor mapping function (rough guess)\n");
        buffer.append("f" + velAmpTable + "     0       129     9       .25     1       0\n");
        buffer.append("; velocity sensitivity scaling function\n");
        buffer.append("f" + velSensitivityTable + "     0       8       -7      0       8       1\n");
        buffer.append("; feedback scaling function\n");
        buffer.append("f" + feedbackScaleTable + "     0       8       -7      0       8       7\n");
        buffer.append("; [BLUEX7] - END STATIC TABLES\n\n");
    }
    // end static ftable generation
    buffer.append("; FTABLES FOR BLUEX7 INSTRUMENT: " + this.getName() + "\n");
    operatorTableNums = new int[6];
    for (int i = 0; i < 6; i++) {
        operatorTableNums[i] = tables.getOpenFTableNumber();
        buffer.append(generateFTableForOperator(this.operators[i], operatorTableNums[i]) + "\n");
    }
    buffer.append("\n");
    tables.setTables(tables.getTables() + "\n" + buffer.toString());
}
Also used : StrBuilder(org.apache.commons.lang3.text.StrBuilder) EnvelopePoint(blue.orchestra.blueX7.EnvelopePoint)

Example 4 with StrBuilder

use of org.apache.commons.lang3.text.StrBuilder in project blue by kunstmusik.

the class BlueX7 method generateInstrument.

@Override
public String generateInstrument() {
    String algNum = this.algorithmCommon.algorithm < 10 ? "0" + this.algorithmCommon.algorithm : Integer.toString(this.algorithmCommon.algorithm);
    StrBuilder buffer = new StrBuilder();
    try {
        try (BufferedReader br = new BufferedReader(new InputStreamReader(this.getClass().getClassLoader().getResourceAsStream("blue/resources/blueX7/dx7" + algNum + ".orc")))) {
            String line;
            while ((line = br.readLine()) != null) {
                buffer.append(line).append("\n");
            }
        }
    } catch (IOException ioe) {
        System.err.println("[error] BlueX7::generateInstrument");
        return "";
    }
    String credits = "; Instrument derived from Russell Pinkston's DX7 emulation patches\n" + "; Code from Jeff Harrington's DX72SCO consulted in building BlueX7\n" + "; as well as the JSynthLib project\n";
    buffer.insert(0, credits);
    String instrText = buffer.toString();
    instrText = instrText.substring(instrText.indexOf('\n', instrText.indexOf("instr")) + 1);
    instrText = instrText.substring(0, instrText.indexOf("endin") - 1);
    instrText = TextUtilities.replace(instrText, "abs(p3)", "idur");
    instrText = TextUtilities.replace(instrText, "ihold", "idur \t= abs(p3) \np3 = p3 + 4");
    instrText = TextUtilities.replace(instrText, "cpspch(p4)", "(p4 < 15 ? cpspch(p4) : p4)");
    instrText = TextUtilities.replace(instrText, "octpch(p4)", "(p4 < 15 ? octpch(p4) : p4)");
    /* Static FTable Swap */
    instrText = TextUtilities.replace(instrText, "p16", Integer.toString(outputAmpTable));
    // instrText = TextUtilities.replace(instrText, "p17",
    // Integer.toString(peakAmp)); // some multiplier value
    instrText = TextUtilities.replace(instrText, "p17", "5000");
    // some multiplier value, maybe should map output level
    instrText = TextUtilities.replace(instrText, "p18", Integer.toString(rateScaleTable));
    instrText = TextUtilities.replace(instrText, "p19", Integer.toString(egLevelPeakTable));
    instrText = TextUtilities.replace(instrText, "p20", Integer.toString(egRateRiseLvlTable));
    instrText = TextUtilities.replace(instrText, "p21", Integer.toString(egRateDecayLvlTable));
    instrText = TextUtilities.replace(instrText, "p22", Integer.toString(velSensitivityTable));
    instrText = TextUtilities.replace(instrText, "p23", Integer.toString(velAmpTable));
    instrText = TextUtilities.replace(instrText, "p24", Integer.toString(feedbackScaleTable));
    /* Swapping other values */
    instrText = TextUtilities.replace(instrText, "p25", Integer.toString(this.algorithmCommon.feedback));
    for (int i = 0; i < 6; i++) {
        instrText = TextUtilities.replace(instrText, "p" + (i + 10), Integer.toString(operatorTableNums[i]));
    }
    int pos = instrText.lastIndexOf("out");
    instrText = instrText.substring(0, pos) + "aout = " + instrText.substring(pos + 7);
    instrText += "\n" + this.csoundPostCode;
    // egRateDecayPercentageTable = tables.getOpenFTableNumber(); unused
    return instrText;
}
Also used : InputStreamReader(java.io.InputStreamReader) BufferedReader(java.io.BufferedReader) IOException(java.io.IOException) StrBuilder(org.apache.commons.lang3.text.StrBuilder) EnvelopePoint(blue.orchestra.blueX7.EnvelopePoint)

Example 5 with StrBuilder

use of org.apache.commons.lang3.text.StrBuilder in project blue by kunstmusik.

the class BlueX7 method generateFTableForOperator.

private String generateFTableForOperator(Operator op, int tableNum) {
    StrBuilder buffer = new StrBuilder();
    buffer.append("f ").append(tableNum).append(" 0 32 -2 ");
    buffer.append(Integer.toString(op.outputLevel)).append(" ");
    buffer.append(Integer.toString(op.velocitySensitivity)).append(" ");
    buffer.append(Integer.toString(op.envelopePoints[0].x)).append(" ");
    buffer.append(Integer.toString(op.envelopePoints[1].x)).append(" ");
    buffer.append(Integer.toString(op.envelopePoints[2].x)).append(" ");
    buffer.append(Integer.toString(op.envelopePoints[3].x)).append(" ");
    buffer.append(Integer.toString(op.envelopePoints[0].y)).append(" ");
    buffer.append(Integer.toString(op.envelopePoints[1].y)).append(" ");
    buffer.append(Integer.toString(op.envelopePoints[2].y)).append(" ");
    buffer.append(Integer.toString(op.envelopePoints[3].y)).append(" ");
    buffer.append(Integer.toString(op.modulationAmplitude)).append(" ");
    buffer.append(Integer.toString(op.mode)).append(" ");
    // buffer.append(Integer.toString(op.freqCoarse) + " ");
    buffer.append(Integer.toString(1)).append(" ");
    buffer.append(Integer.toString(op.detune)).append(" ");
    buffer.append(Integer.toString(op.keyboardRateScaling)).append(" ");
    // adding 0 to fill table
    buffer.append("0 \n");
    return buffer.toString();
}
Also used : StrBuilder(org.apache.commons.lang3.text.StrBuilder)

Aggregations

StrBuilder (org.apache.commons.lang3.text.StrBuilder)44 GenericInstrument (blue.orchestra.GenericInstrument)9 LinePoint (blue.components.lines.LinePoint)8 Instrument (blue.orchestra.Instrument)5 StringChannel (blue.orchestra.blueSynthBuilder.StringChannel)4 Parameter (blue.automation.Parameter)3 NoteParseException (blue.soundObject.NoteParseException)3 ArrayList (java.util.ArrayList)3 Arrangement (blue.Arrangement)2 CompileData (blue.CompileData)2 GlobalOrcSco (blue.GlobalOrcSco)2 Tables (blue.Tables)2 ParameterNameManager (blue.automation.ParameterNameManager)2 Line (blue.components.lines.Line)2 SoundObjectParameterLine (blue.components.lines.SoundObjectParameterLine)2 Mixer (blue.mixer.Mixer)2 TempoMapper (blue.noteProcessor.TempoMapper)2 StringChannelNameManager (blue.orchestra.blueSynthBuilder.StringChannelNameManager)2 EnvelopePoint (blue.orchestra.blueX7.EnvelopePoint)2 CsdRenderResult (blue.services.render.CsdRenderResult)2