Search in sources :

Example 11 with IDrumDevice

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

the class AbstractDrum64View method onOctaveUp.

/**
 * {@inheritDoc}
 */
@Override
public void onOctaveUp(final ButtonEvent event) {
    if (event != ButtonEvent.DOWN)
        return;
    this.clearPressedKeys();
    final int oldDrumOctave = this.drumOctave;
    this.drumOctave = Math.min(1, this.drumOctave + 1);
    this.offsetY = DRUM_START_KEY + this.drumOctave * BLOCK_SIZE;
    this.updateNoteMapping();
    this.surface.getDisplay().notify(this.getDrumRangeText());
    if (oldDrumOctave != this.drumOctave) {
        final IDrumDevice drumDevice64 = this.model.getDrumDevice64();
        final IDrumPadBank drumPadBank = drumDevice64.getDrumPadBank();
        for (int i = 0; i < BLOCK_SIZE; i++) drumPadBank.scrollForwards();
    }
}
Also used : IDrumDevice(de.mossgrabers.framework.daw.data.IDrumDevice) IDrumPadBank(de.mossgrabers.framework.daw.data.bank.IDrumPadBank)

Example 12 with IDrumDevice

use of de.mossgrabers.framework.daw.data.IDrumDevice 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 13 with IDrumDevice

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

the class PlayView method getDrumPadColor.

private int getDrumPadColor(final int index) {
    final int offsetY = this.scales.getDrumOffset();
    // Selected?
    if (this.pressedKeys[offsetY + index] > 0 || this.selectedPad == index)
        return SLControlSurface.MKII_BUTTON_STATE_ON;
    // Exists and active?
    final IDrumDevice primary = this.model.getDrumDevice();
    final IDrumPadBank drumPadBank = primary.getDrumPadBank();
    final boolean isSoloed = primary.hasDrumPads() && drumPadBank.hasSoloedPads();
    final IChannel drumPad = drumPadBank.getItem(index);
    if (!drumPad.doesExist() || !drumPad.isActivated())
        return SLControlSurface.MKII_BUTTON_STATE_OFF;
    // Muted or soloed?
    if (drumPad.isMute() || isSoloed && !drumPad.isSolo())
        return SLControlSurface.MKII_BUTTON_STATE_OFF;
    return SLControlSurface.MKII_BUTTON_STATE_OFF;
}
Also used : IChannel(de.mossgrabers.framework.daw.data.IChannel) IDrumDevice(de.mossgrabers.framework.daw.data.IDrumDevice) IDrumPadBank(de.mossgrabers.framework.daw.data.bank.IDrumPadBank)

Example 14 with IDrumDevice

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

the class DrumView method drawGrid.

/**
 * {@inheritDoc}
 */
@Override
public void drawGrid() {
    if (this.isGridEditor) {
        final IPadGrid padGrid = this.surface.getPadGrid();
        for (int i = 0; i < 8; i++) padGrid.light(36 + i, this.getButtonColorID(ButtonID.get(ButtonID.SCENE1, 7 - i)));
        for (int i = 8; i < 12; i++) padGrid.light(36 + i, MaschineColorManager.COLOR_BLACK);
        for (int i = 12; i < 14; i++) padGrid.light(36 + i, MaschineColorManager.COLOR_BLUE);
        for (int i = 14; i < 16; i++) padGrid.light(36 + i, MaschineColorManager.COLOR_BLACK);
        return;
    }
    if (this.isSequencerVisible) {
        final INoteClip clip = this.getClip();
        final boolean isActive = this.isActive();
        final IDrumDevice primary = this.model.getDrumDevice();
        this.drawSequencerSteps(clip, isActive, this.scales.getDrumOffset() + this.selectedPad, this.getPadColor(primary, this.selectedPad), y -> 3 - y);
        return;
    }
    if (this.isShifted)
        this.drawShiftedGrid();
    else
        super.drawGrid();
}
Also used : IPadGrid(de.mossgrabers.framework.controller.grid.IPadGrid) IDrumDevice(de.mossgrabers.framework.daw.data.IDrumDevice) INoteClip(de.mossgrabers.framework.daw.INoteClip)

Example 15 with IDrumDevice

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

IDrumDevice (de.mossgrabers.framework.daw.data.IDrumDevice)15 IPadGrid (de.mossgrabers.framework.controller.grid.IPadGrid)7 INoteClip (de.mossgrabers.framework.daw.INoteClip)6 IDrumPadBank (de.mossgrabers.framework.daw.data.bank.IDrumPadBank)6 ColorEx (de.mossgrabers.framework.controller.color.ColorEx)3 IStepInfo (de.mossgrabers.framework.daw.IStepInfo)3 GridStep (de.mossgrabers.framework.daw.data.GridStep)3 ICursorDevice (de.mossgrabers.framework.daw.data.ICursorDevice)2 IDrumPad (de.mossgrabers.framework.daw.data.IDrumPad)2 ModeManager (de.mossgrabers.framework.featuregroup.ModeManager)2 Kontrol1ControlSurface (de.mossgrabers.controller.ni.kontrol.mki.controller.Kontrol1ControlSurface)1 ILightGuide (de.mossgrabers.framework.controller.grid.ILightGuide)1 StepState (de.mossgrabers.framework.daw.StepState)1 IChannel (de.mossgrabers.framework.daw.data.IChannel)1 IView (de.mossgrabers.framework.featuregroup.IView)1