Search in sources :

Example 26 with GridStep

use of de.mossgrabers.framework.daw.data.GridStep in project DrivenByMoss by git-moss.

the class EditNoteMode method updateDisplay.

/**
 * {@inheritDoc}
 */
@Override
public void updateDisplay() {
    final ITextDisplay d = this.surface.getTextDisplay().clear();
    if (this.notes.isEmpty()) {
        d.setBlock(0, 0, "Please select");
        d.setBlock(0, 1, "a note...");
        d.allDone();
        return;
    }
    final GridStep noteInfo = this.notes.get(0);
    final int channel = noteInfo.channel();
    final int step = noteInfo.step();
    final int note = noteInfo.note();
    final IStepInfo stepInfo = this.clip.getStep(channel, step, note);
    d.setCell(0, 0, "Note");
    if (this.notes.size() > 1)
        d.setCell(1, 0, "*:" + this.notes.size());
    else
        d.setCell(1, 0, stepInfo == null ? "-" : Integer.toString(step + 1) + ":" + Scales.formatNoteAndOctave(note, -3));
    d.setCell(0, 1, this.mark("Length", DURATION + this.selectedPage * 10));
    if (stepInfo == null)
        d.setCell(1, 2, "-");
    else {
        final String[] formatLength = this.formatLength(stepInfo.getDuration()).split(":");
        d.setCell(1, 1, formatLength[0]);
        d.setCell(1, 2, ":" + formatLength[1]);
    }
    switch(this.selectedPage) {
        default:
        case PAGE_NOTE:
            d.setCell(0, 3, this.mark("Velocity", VELOCITY)).setCell(1, 3, stepInfo == null ? "-" : StringUtils.formatPercentage(stepInfo.getVelocity()));
            if (this.host.supports(Capability.NOTE_EDIT_VELOCITY_SPREAD))
                d.setCell(0, 4, this.mark("Spread", VELOCITY_SPREAD)).setCell(1, 4, stepInfo == null ? "-" : StringUtils.formatPercentage(stepInfo.getVelocitySpread()));
            if (this.host.supports(Capability.NOTE_EDIT_RELEASE_VELOCITY))
                d.setCell(0, 5, this.mark("R-Vel", RELEASE_VELOCITY)).setCell(1, 5, stepInfo == null ? "-" : StringUtils.formatPercentage(stepInfo.getReleaseVelocity()));
            if (this.host.supports(Capability.NOTE_EDIT_CHANCE))
                d.setCell(0, 6, this.mark("Chance", CHANCE)).setCell(1, 6, stepInfo == null ? "-" : StringUtils.formatPercentage(stepInfo.getChance()));
            if (this.host.supports(Capability.NOTE_EDIT_OCCURRENCE))
                d.setCell(0, 7, this.mark("Occurnce", OCCURRENCE)).setCell(1, 7, stepInfo == null ? "-" : StringUtils.optimizeName(stepInfo.getOccurrence().getName(), 8));
            break;
        case PAGE_EXPRESSIONS:
            d.setCell(0, 3, this.mark("Gain", GAIN)).setCell(1, 3, stepInfo == null ? "-" : StringUtils.formatPercentage(stepInfo.getGain()));
            d.setCell(0, 4, this.mark("Pan", PANORAMA)).setCell(1, 4, stepInfo == null ? "-" : StringUtils.formatPercentage(stepInfo.getPan()));
            d.setCell(0, 5, this.mark("Pitch", PITCH)).setCell(1, 5, stepInfo == null ? "-" : String.format("%.1f", Double.valueOf(stepInfo.getTranspose())));
            d.setCell(0, 6, this.mark("Timbre", TIMBRE)).setCell(1, 6, stepInfo == null ? "-" : StringUtils.formatPercentage(stepInfo.getTimbre()));
            d.setCell(0, 7, this.mark("Pressure", PRESSURE)).setCell(1, 7, stepInfo == null ? "-" : StringUtils.formatPercentage(stepInfo.getPressure()));
            break;
        case PAGE_REPEAT:
            d.setCell(0, 3, this.mark("Velocity", VELOCITY2)).setCell(1, 3, stepInfo == null ? "-" : StringUtils.formatPercentage(stepInfo.getVelocity()));
            d.setCell(0, 4, this.mark("V-End", VELOCITY_END)).setCell(1, 4, stepInfo == null ? "-" : StringUtils.formatPercentage(stepInfo.getRepeatVelocityEnd()));
            d.setCell(0, 5, this.mark("V-Curve", VELOCITY_CURVE)).setCell(1, 5, stepInfo == null ? "-" : StringUtils.formatPercentage(stepInfo.getRepeatVelocityCurve()));
            d.setCell(0, 6, this.mark("Count", COUNT)).setCell(1, 6, stepInfo == null ? "-" : stepInfo.getFormattedRepeatCount());
            d.setCell(0, 7, this.mark("Curve", CURVE)).setCell(1, 7, stepInfo == null ? "-" : StringUtils.formatPercentage(stepInfo.getRepeatCurve()));
            break;
    }
    d.allDone();
}
Also used : ITextDisplay(de.mossgrabers.framework.controller.display.ITextDisplay) GridStep(de.mossgrabers.framework.daw.data.GridStep) IStepInfo(de.mossgrabers.framework.daw.IStepInfo)

Example 27 with GridStep

use of de.mossgrabers.framework.daw.data.GridStep in project DrivenByMoss by git-moss.

the class DrumView method drawGrid.

/**
 * {@inheritDoc}
 */
@Override
public void drawGrid() {
    final IPadGrid padGrid = this.surface.getPadGrid();
    final IDrumDevice primary = this.model.getDrumDevice();
    if (this.isPlayMode) {
        for (int y = 0; y < 2; y++) {
            for (int x = 0; x < 8; x++) {
                final int index = 8 * y + x;
                padGrid.lightEx(x, 1 - y, this.getDrumPadColor(index, primary, false));
            }
        }
        return;
    }
    if (!this.isActive()) {
        padGrid.turnOff();
        return;
    }
    // Paint the sequencer steps
    final INoteClip clip = this.getClip();
    final int step = clip.getCurrentStep();
    final int hiStep = this.isInXRange(step) ? step % this.sequencerSteps : -1;
    final int offsetY = this.scales.getDrumOffset();
    final int editMidiChannel = this.configuration.getMidiEditChannel();
    final int selPad = this.getSelectedPad();
    final List<GridStep> editNotes = this.getEditNotes();
    for (int col = 0; col < DrumView.NUM_DISPLAY_COLS; col++) {
        final int noteRow = offsetY + selPad;
        final IStepInfo stepInfo = clip.getStep(editMidiChannel, col, noteRow);
        final boolean hilite = col == hiStep;
        final int x = col % GRID_COLUMNS;
        final int y = col / GRID_COLUMNS;
        final Optional<ColorEx> rowColor = this.getPadColor(primary, this.selectedPad);
        padGrid.lightEx(x, y, this.getStepColor(stepInfo, hilite, rowColor, editMidiChannel, col, noteRow, editNotes));
    }
}
Also used : IPadGrid(de.mossgrabers.framework.controller.grid.IPadGrid) IDrumDevice(de.mossgrabers.framework.daw.data.IDrumDevice) ColorEx(de.mossgrabers.framework.controller.color.ColorEx) GridStep(de.mossgrabers.framework.daw.data.GridStep) IStepInfo(de.mossgrabers.framework.daw.IStepInfo) INoteClip(de.mossgrabers.framework.daw.INoteClip)

Aggregations

GridStep (de.mossgrabers.framework.daw.data.GridStep)27 IStepInfo (de.mossgrabers.framework.daw.IStepInfo)18 IPadGrid (de.mossgrabers.framework.controller.grid.IPadGrid)7 INoteClip (de.mossgrabers.framework.daw.INoteClip)6 ColorEx (de.mossgrabers.framework.controller.color.ColorEx)5 IValueChanger (de.mossgrabers.framework.controller.valuechanger.IValueChanger)3 IDrumDevice (de.mossgrabers.framework.daw.data.IDrumDevice)3 NoteOccurrenceType (de.mossgrabers.framework.daw.NoteOccurrenceType)2 SLMkIIIDisplay (de.mossgrabers.controller.novation.slmkiii.controller.SLMkIIIDisplay)1 ITextDisplay (de.mossgrabers.framework.controller.display.ITextDisplay)1 ITrack (de.mossgrabers.framework.daw.data.ITrack)1