Search in sources :

Example 16 with IStepInfo

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

the class AbstractDrumLaneView method drawGrid.

/**
 * {@inheritDoc}
 */
@Override
public void drawGrid() {
    final IPadGrid padGrid = this.surface.getPadGrid();
    if (!this.isActive()) {
        padGrid.turnOff();
        return;
    }
    // Clip length/loop area
    final INoteClip clip = this.getClip();
    final int step = clip.getCurrentStep();
    // Paint the sequencer steps
    final int hiStep = this.isInXRange(step) ? step % this.clipCols : -1;
    final int offsetY = this.scales.getDrumOffset();
    final int editMidiChannel = this.configuration.getMidiEditChannel();
    final List<GridStep> editNotes = this.getEditNotes();
    for (int sound = 0; sound < this.lanes; sound++) {
        final int noteRow = offsetY + sound;
        final Optional<ColorEx> drumPadColor = this.getPadColor(this.primary, sound);
        for (int col = 0; col < this.clipCols; col++) {
            final IStepInfo stepInfo = clip.getStep(editMidiChannel, col, noteRow);
            final boolean hilite = col == hiStep;
            final int x = col % this.numColumns;
            int y = this.lanes - 1 - sound;
            if (col >= this.numColumns)
                y += this.lanes;
            padGrid.lightEx(x, y, this.getStepColor(stepInfo, hilite, drumPadColor, editMidiChannel, col, noteRow, editNotes));
        }
    }
}
Also used : IPadGrid(de.mossgrabers.framework.controller.grid.IPadGrid) 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)

Example 17 with IStepInfo

use of de.mossgrabers.framework.daw.IStepInfo 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)

Example 18 with IStepInfo

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

the class EditNoteMode method onKnobValue.

/**
 * {@inheritDoc}
 */
@Override
public void onKnobValue(final int index, final int value) {
    for (final GridStep noteInfo : this.notes) {
        final int channel = noteInfo.channel();
        final int step = noteInfo.step();
        final int note = noteInfo.note();
        final int idx = index < 0 ? this.selectedParam : index;
        final boolean hasMCUDisplay = this.surface.getMaschine().hasMCUDisplay();
        final IStepInfo stepInfo = this.clip.getStep(channel, step, note);
        switch(idx + 10 * this.selectedPage) {
            case DURATION:
            case DURATION2:
            case DURATION3:
            case DURATION4:
            case DURATION5:
            case DURATION6:
                this.clip.changeStepDuration(channel, step, note, value);
                if (!hasMCUDisplay)
                    this.mvHelper.delayDisplay(() -> "Duration: " + StringUtils.formatMeasures(this.model.getTransport().getQuartersPerMeasure(), stepInfo.getDuration(), 0, true));
                break;
            case VELOCITY:
            case VELOCITY2:
                this.clip.changeStepVelocity(channel, step, note, value);
                if (!hasMCUDisplay)
                    this.mvHelper.delayDisplay(() -> "Velocity: " + StringUtils.formatPercentage(stepInfo.getVelocity()));
                break;
            case GAIN:
                if (this.host.supports(Capability.NOTE_EDIT_EXPRESSIONS)) {
                    this.clip.changeStepGain(channel, step, note, value);
                    if (!hasMCUDisplay)
                        this.mvHelper.delayDisplay(() -> "Gain: " + StringUtils.formatPercentage(stepInfo.getGain()));
                }
                break;
            case PANORAMA:
                if (this.host.supports(Capability.NOTE_EDIT_EXPRESSIONS)) {
                    this.clip.changeStepPan(channel, step, note, value);
                    if (!hasMCUDisplay)
                        this.mvHelper.delayDisplay(() -> "Panorama: " + StringUtils.formatPercentage(stepInfo.getPan() * 2.0 - 1.0));
                }
                break;
            case PITCH:
                if (this.host.supports(Capability.NOTE_EDIT_EXPRESSIONS)) {
                    this.clip.changeStepTranspose(channel, step, note, value);
                    if (!hasMCUDisplay)
                        this.mvHelper.delayDisplay(() -> "Pitch: " + String.format("%.1f", Double.valueOf(stepInfo.getTranspose() * 48.0 - 24.0)));
                }
                break;
            case PRESSURE:
                if (this.host.supports(Capability.NOTE_EDIT_EXPRESSIONS)) {
                    this.clip.changeStepPressure(channel, step, note, value);
                    if (!hasMCUDisplay)
                        this.mvHelper.delayDisplay(() -> "Pressure: " + StringUtils.formatPercentage(stepInfo.getPressure()));
                }
                break;
            case TIMBRE:
                if (this.host.supports(Capability.NOTE_EDIT_EXPRESSIONS)) {
                    this.clip.changeStepTimbre(channel, step, note, value);
                    if (!hasMCUDisplay)
                        this.mvHelper.delayDisplay(() -> "Timbre: " + StringUtils.formatPercentage(stepInfo.getTimbre()));
                }
                break;
            case VELOCITY_SPREAD:
                if (this.host.supports(Capability.NOTE_EDIT_VELOCITY_SPREAD)) {
                    this.clip.changeVelocitySpread(channel, step, note, value);
                    if (!hasMCUDisplay)
                        this.mvHelper.delayDisplay(() -> "Velocity Spread: " + StringUtils.formatPercentage(stepInfo.getVelocitySpread()));
                }
                break;
            case RELEASE_VELOCITY:
                if (this.host.supports(Capability.NOTE_EDIT_RELEASE_VELOCITY)) {
                    this.clip.changeStepReleaseVelocity(channel, step, note, value);
                    if (!hasMCUDisplay)
                        this.mvHelper.delayDisplay(() -> "Release Velocity: " + StringUtils.formatPercentage(stepInfo.getReleaseVelocity()));
                }
                break;
            case CHANCE:
                if (this.host.supports(Capability.NOTE_EDIT_CHANCE)) {
                    this.clip.changeChance(channel, step, note, value);
                    if (!hasMCUDisplay)
                        this.mvHelper.delayDisplay(() -> "Chance: " + StringUtils.formatPercentage(stepInfo.getChance()));
                }
                break;
            case OCCURRENCE:
                if (this.host.supports(Capability.NOTE_EDIT_OCCURRENCE)) {
                    final boolean increase = this.model.getValueChanger().isIncrease(value);
                    this.clip.setPrevNextOccurrence(channel, step, note, increase);
                    if (!hasMCUDisplay)
                        this.mvHelper.delayDisplay(() -> "Occurrence: " + StringUtils.optimizeName(stepInfo.getOccurrence().getName(), 8));
                }
                break;
            case VELOCITY_END:
                if (this.host.supports(Capability.NOTE_EDIT_REPEAT)) {
                    this.clip.changeRepeatVelocityEnd(channel, step, note, value);
                    if (!hasMCUDisplay)
                        this.mvHelper.delayDisplay(() -> "Velocity End: " + StringUtils.formatPercentage(stepInfo.getRepeatVelocityEnd()));
                }
                break;
            case VELOCITY_CURVE:
                if (this.host.supports(Capability.NOTE_EDIT_REPEAT)) {
                    this.clip.changeRepeatVelocityCurve(channel, step, note, value);
                    if (!hasMCUDisplay)
                        this.mvHelper.delayDisplay(() -> "Velocity Curve: " + StringUtils.formatPercentage(stepInfo.getRepeatVelocityCurve()));
                }
                break;
            case COUNT:
                if (this.host.supports(Capability.NOTE_EDIT_REPEAT)) {
                    this.clip.changeRepeatCount(channel, step, note, value);
                    if (!hasMCUDisplay)
                        this.mvHelper.delayDisplay(() -> "Repeat Count: " + stepInfo.getFormattedRepeatCount());
                }
                break;
            case CURVE:
                if (this.host.supports(Capability.NOTE_EDIT_REPEAT)) {
                    this.clip.changeRepeatCurve(channel, step, note, value);
                    if (!hasMCUDisplay)
                        this.mvHelper.delayDisplay(() -> "Repeat Curve: " + StringUtils.formatPercentage(stepInfo.getRepeatCurve()));
                }
                break;
            default:
                return;
        }
    }
}
Also used : GridStep(de.mossgrabers.framework.daw.data.GridStep) IStepInfo(de.mossgrabers.framework.daw.IStepInfo)

Example 19 with IStepInfo

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

the class CursorClipImpl method changeStepTimbre.

/**
 * {@inheritDoc}
 */
@Override
public void changeStepTimbre(final int channel, final int step, final int row, final int control) {
    final IStepInfo info = this.getStep(channel, step, row);
    final double timbre = info.getTimbre() + 2.0 * this.valueChanger.toNormalizedValue((int) this.valueChanger.calcKnobChange(control));
    this.updateStepTimbre(channel, step, row, timbre);
}
Also used : IStepInfo(de.mossgrabers.framework.daw.IStepInfo)

Example 20 with IStepInfo

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

the class CursorClipImpl method changeRecurrenceLength.

/**
 * {@inheritDoc}
 */
@Override
public void changeRecurrenceLength(final int channel, final int step, final int row, final int control) {
    final IStepInfo info = this.getStep(channel, step, row);
    final int recurrenceLength = info.getRecurrenceLength() + (this.valueChanger.isIncrease(control) ? 1 : -1);
    this.updateRecurrenceLength(channel, step, row, Math.min(8, Math.max(1, recurrenceLength)));
}
Also used : IStepInfo(de.mossgrabers.framework.daw.IStepInfo)

Aggregations

IStepInfo (de.mossgrabers.framework.daw.IStepInfo)41 GridStep (de.mossgrabers.framework.daw.data.GridStep)18 IPadGrid (de.mossgrabers.framework.controller.grid.IPadGrid)7 StepState (de.mossgrabers.framework.daw.StepState)7 ColorEx (de.mossgrabers.framework.controller.color.ColorEx)6 INoteClip (de.mossgrabers.framework.daw.INoteClip)6 IHwButton (de.mossgrabers.framework.controller.hardware.IHwButton)4 IValueChanger (de.mossgrabers.framework.controller.valuechanger.IValueChanger)3 IDrumDevice (de.mossgrabers.framework.daw.data.IDrumDevice)3 NoteOccurrenceType (de.mossgrabers.framework.daw.NoteOccurrenceType)2 NoteStep (com.bitwig.extension.controller.api.NoteStep)1 SLMkIIIDisplay (de.mossgrabers.controller.novation.slmkiii.controller.SLMkIIIDisplay)1 ITextDisplay (de.mossgrabers.framework.controller.display.ITextDisplay)1 DefaultStepInfo (de.mossgrabers.framework.daw.DefaultStepInfo)1 ITrack (de.mossgrabers.framework.daw.data.ITrack)1 ModeManager (de.mossgrabers.framework.featuregroup.ModeManager)1 IGraphicsConfiguration (de.mossgrabers.framework.graphics.IGraphicsConfiguration)1 IGraphicsContext (de.mossgrabers.framework.graphics.IGraphicsContext)1