Search in sources :

Example 6 with GridStep

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

the class NoteMode method addNote.

/**
 * {@inheritDoc}
 */
@Override
public void addNote(final INoteClip clip, final int channel, final int step, final int note) {
    if (this.clip != clip) {
        this.notes.clear();
        this.clip = clip;
    }
    // Is the note already edited? Remove it.
    for (final GridStep gridStep : this.notes) {
        if (gridStep.channel() == channel && gridStep.step() == step && gridStep.note() == note) {
            this.notes.remove(gridStep);
            return;
        }
    }
    this.notes.add(new GridStep(channel, step, note));
}
Also used : GridStep(de.mossgrabers.framework.daw.data.GridStep)

Example 7 with GridStep

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

the class AbstractNoteSequencerView method drawGrid.

/**
 * {@inheritDoc}
 */
@Override
public void drawGrid() {
    final IPadGrid gridPad = this.surface.getPadGrid();
    if (!this.isActive()) {
        gridPad.turnOff();
        return;
    }
    // Steps with notes
    final INoteClip clip = this.getClip();
    final int step = clip.getCurrentStep();
    final int hiStep = this.isInXRange(step) ? step % this.numDisplayCols : -1;
    final int editMidiChannel = this.configuration.getMidiEditChannel();
    final List<GridStep> editNotes = this.getEditNotes();
    for (int x = 0; x < this.numDisplayCols; x++) {
        for (int y = 0; y < this.numSequencerRows; y++) {
            final int map = this.keyManager.map(y);
            final IStepInfo stepInfo = map < 0 ? null : clip.getStep(editMidiChannel, x, map);
            gridPad.lightEx(x, this.numDisplayRows - 1 - y, this.getStepColor(stepInfo, x == hiStep, editMidiChannel, x, y, map, editNotes));
        }
    }
    if (this.numDisplayRows - this.numSequencerRows <= 0)
        return;
    // CLip Pages on the top
    final int lengthOfOnePad = this.getLengthOfOnePage(this.numDisplayCols);
    final double loopStart = clip.getLoopStart();
    final int loopStartPad = (int) Math.ceil(loopStart / lengthOfOnePad);
    final int loopEndPad = (int) Math.ceil((loopStart + clip.getLoopLength()) / lengthOfOnePad);
    final int currentPage = step / this.numDisplayCols;
    for (int pad = 0; pad < this.numDisplayCols; pad++) gridPad.lightEx(pad, 0, this.getPageColor(loopStartPad, loopEndPad, currentPage, clip.getEditPage(), pad));
}
Also used : IPadGrid(de.mossgrabers.framework.controller.grid.IPadGrid) GridStep(de.mossgrabers.framework.daw.data.GridStep) IStepInfo(de.mossgrabers.framework.daw.IStepInfo) INoteClip(de.mossgrabers.framework.daw.INoteClip)

Example 8 with GridStep

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

the class NoteMode 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();
        switch(this.page) {
            case NOTE:
                switch(index) {
                    case 0:
                        this.clip.changeStepDuration(channel, step, note, value);
                        break;
                    case 1:
                        if (this.host.supports(Capability.NOTE_EDIT_MUTE))
                            this.clip.changeMuteState(channel, step, note, value);
                        break;
                    case 2:
                        this.clip.changeStepVelocity(channel, step, note, value);
                        break;
                    case 3:
                        if (this.host.supports(Capability.NOTE_EDIT_VELOCITY_SPREAD))
                            this.clip.changeVelocitySpread(channel, step, note, value);
                        break;
                    case 4:
                        if (this.host.supports(Capability.NOTE_EDIT_RELEASE_VELOCITY))
                            this.clip.changeStepReleaseVelocity(channel, step, note, value);
                        break;
                    case 5:
                        if (this.host.supports(Capability.NOTE_EDIT_CHANCE))
                            this.clip.changeChance(channel, step, note, value);
                        break;
                    case 6:
                        if (this.host.supports(Capability.NOTE_EDIT_OCCURRENCE)) {
                            final boolean increase = this.model.getValueChanger().isIncrease(value);
                            this.clip.setPrevNextOccurrence(channel, step, note, increase);
                        }
                        break;
                    case 7:
                        if (this.host.supports(Capability.NOTE_EDIT_RECCURRENCE))
                            this.clip.changeRecurrenceLength(channel, step, note, value);
                        break;
                    default:
                        return;
                }
                break;
            case EXPRESSIONS:
                switch(index) {
                    case 0:
                        this.clip.changeStepDuration(channel, step, note, value);
                        break;
                    case 1:
                        if (this.host.supports(Capability.NOTE_EDIT_MUTE))
                            this.clip.changeMuteState(channel, step, note, value);
                        break;
                    case 3:
                        if (this.host.supports(Capability.NOTE_EDIT_EXPRESSIONS))
                            this.clip.changeStepGain(channel, step, note, value);
                        break;
                    case 4:
                        if (this.host.supports(Capability.NOTE_EDIT_EXPRESSIONS))
                            this.clip.changeStepPan(channel, step, note, value);
                        break;
                    case 5:
                        if (this.host.supports(Capability.NOTE_EDIT_EXPRESSIONS))
                            this.clip.changeStepTranspose(channel, step, note, value);
                        break;
                    case 6:
                        if (this.host.supports(Capability.NOTE_EDIT_EXPRESSIONS))
                            this.clip.changeStepTimbre(channel, step, note, value);
                        break;
                    case 7:
                        if (this.host.supports(Capability.NOTE_EDIT_EXPRESSIONS))
                            this.clip.changeStepPressure(channel, step, note, value);
                        break;
                    default:
                        return;
                }
                break;
            case REPEAT:
                switch(index) {
                    case 0:
                        this.clip.changeStepDuration(channel, step, note, value);
                        break;
                    case 1:
                        if (this.host.supports(Capability.NOTE_EDIT_MUTE))
                            this.clip.changeMuteState(channel, step, note, value);
                        break;
                    case 3:
                        if (this.host.supports(Capability.NOTE_EDIT_REPEAT))
                            this.clip.changeRepeatCount(channel, step, note, value);
                        break;
                    case 4:
                        if (this.host.supports(Capability.NOTE_EDIT_REPEAT))
                            this.clip.changeRepeatCurve(channel, step, note, value);
                        break;
                    case 5:
                        if (this.host.supports(Capability.NOTE_EDIT_REPEAT))
                            this.clip.changeRepeatVelocityCurve(channel, step, note, value);
                        break;
                    case 6:
                        if (this.host.supports(Capability.NOTE_EDIT_REPEAT))
                            this.clip.changeRepeatVelocityEnd(channel, step, note, value);
                        break;
                    default:
                        return;
                }
                break;
            case RECCURRENCE_PATTERN:
                if (index == 7 && this.host.supports(Capability.NOTE_EDIT_RECCURRENCE))
                    this.clip.changeRecurrenceLength(channel, step, note, value);
                break;
        }
    }
}
Also used : GridStep(de.mossgrabers.framework.daw.data.GridStep)

Example 9 with GridStep

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

the class NoteMode method getButtonColor.

/**
 * {@inheritDoc}
 */
@Override
public int getButtonColor(final ButtonID buttonID) {
    if (this.notes.isEmpty())
        return this.colorManager.getColorIndex(PushColorManager.PUSH_BLACK);
    for (final GridStep noteInfo : this.notes) {
        final int channel = noteInfo.channel();
        final int step = noteInfo.step();
        final int note = noteInfo.note();
        final IStepInfo stepInfo = this.clip.getStep(channel, step, note);
        int index = this.isButtonRow(0, buttonID);
        if (index >= 0) {
            switch(this.page) {
                case NOTE:
                    if (index == 5 && this.host.supports(Capability.NOTE_EDIT_CHANCE))
                        return this.colorManager.getColorIndex(stepInfo.isChanceEnabled() ? PushColorManager.PUSH_ORANGE_HI : PushColorManager.PUSH_ORANGE_LO);
                    if (index == 6 && this.host.supports(Capability.NOTE_EDIT_OCCURRENCE))
                        return this.colorManager.getColorIndex(stepInfo.isOccurrenceEnabled() ? PushColorManager.PUSH_ORANGE_HI : PushColorManager.PUSH_ORANGE_LO);
                    if (index == 7 && this.host.supports(Capability.NOTE_EDIT_RECCURRENCE))
                        return this.colorManager.getColorIndex(stepInfo.isRecurrenceEnabled() ? PushColorManager.PUSH_ORANGE_HI : PushColorManager.PUSH_ORANGE_LO);
                    break;
                case EXPRESSIONS:
                    break;
                case REPEAT:
                    if (index == 3)
                        return this.colorManager.getColorIndex(stepInfo.isRepeatEnabled() ? PushColorManager.PUSH_ORANGE_HI : PushColorManager.PUSH_ORANGE_LO);
                    break;
                case RECCURRENCE_PATTERN:
                    final int recurrenceLength = stepInfo.getRecurrenceLength();
                    final int mask = stepInfo.getRecurrenceMask();
                    final boolean isOn = (mask & 1 << index) > 0;
                    String color = PushColorManager.PUSH_BLACK;
                    if (index < recurrenceLength)
                        color = isOn ? PushColorManager.PUSH_ORANGE_HI : PushColorManager.PUSH_ORANGE_LO;
                    return this.colorManager.getColorIndex(color);
            }
            return this.colorManager.getColorIndex(PushColorManager.PUSH_BLACK);
        }
        index = this.isButtonRow(1, buttonID);
        if (index >= 0) {
            switch(this.page) {
                case NOTE:
                    if (index == 0)
                        return this.colorManager.getColorIndex(PushColorManager.PUSH_GREEN_2);
                    break;
                case EXPRESSIONS:
                    if (index == 1)
                        return this.colorManager.getColorIndex(PushColorManager.PUSH_GREEN_2);
                    break;
                case REPEAT:
                    if (index == 2)
                        return this.colorManager.getColorIndex(PushColorManager.PUSH_GREEN_2);
                    break;
                case RECCURRENCE_PATTERN:
                    if (index == 7)
                        return this.colorManager.getColorIndex(PushColorManager.PUSH_GREEN_2);
                    break;
            }
            if (index == 0 || index == 1 && this.host.supports(Capability.NOTE_EDIT_EXPRESSIONS))
                return this.colorManager.getColorIndex(PushColorManager.PUSH_GREY_LO_2);
            if (index == 2 && this.host.supports(Capability.NOTE_EDIT_REPEAT) || index == 7 && this.host.supports(Capability.NOTE_EDIT_RECCURRENCE))
                return this.colorManager.getColorIndex(PushColorManager.PUSH_GREY_LO_2);
            return this.colorManager.getColorIndex(PushColorManager.PUSH_BLACK_2);
        }
    }
    return this.colorManager.getColorIndex(PushColorManager.PUSH_BLACK);
}
Also used : GridStep(de.mossgrabers.framework.daw.data.GridStep) IStepInfo(de.mossgrabers.framework.daw.IStepInfo)

Example 10 with GridStep

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

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