Search in sources :

Example 1 with IDrumDevice

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

the class AbstractDrum64View method onOctaveDown.

/**
 * {@inheritDoc}
 */
@Override
public void onOctaveDown(final ButtonEvent event) {
    if (event != ButtonEvent.DOWN)
        return;
    this.clearPressedKeys();
    final int oldDrumOctave = this.drumOctave;
    this.drumOctave = Math.max(-2, 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.scrollBackwards();
    }
}
Also used : IDrumDevice(de.mossgrabers.framework.daw.data.IDrumDevice) IDrumPadBank(de.mossgrabers.framework.daw.data.bank.IDrumPadBank)

Example 2 with IDrumDevice

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

the class Kontrol1ControllerSetup method handleTrackChange.

/**
 * Handle a track selection change.
 *
 * @param isSelected Has the track been selected?
 */
private void handleTrackChange(final boolean isSelected) {
    if (!isSelected)
        return;
    this.host.scheduleTask(() -> {
        final Kontrol1ControlSurface surface = this.getSurface();
        final IView activeView = surface.getViewManager().getActive();
        if (activeView != null) {
            activeView.updateNoteMapping();
            activeView.drawGrid();
        }
        if (this.model.canSelectedTrackHoldNotes()) {
            final IDrumDevice primary = this.model.getDrumDevice();
            if (primary.hasDrumPads())
                primary.getDrumPadBank().scrollTo(0);
        }
    }, 100);
}
Also used : IView(de.mossgrabers.framework.featuregroup.IView) Kontrol1ControlSurface(de.mossgrabers.controller.ni.kontrol.mki.controller.Kontrol1ControlSurface) IDrumDevice(de.mossgrabers.framework.daw.data.IDrumDevice)

Example 3 with IDrumDevice

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

the class ControlView method drawGrid.

/**
 * {@inheritDoc}
 */
@Override
public void drawGrid() {
    final ILightGuide lightGuide = this.surface.getLightGuide();
    if (this.model.getHost().supports(Capability.HAS_DRUM_DEVICE) && this.model.canSelectedTrackHoldNotes()) {
        final IDrumDevice primary = this.model.getDrumDevice();
        if (primary.hasDrumPads()) {
            final boolean isRecording = this.model.hasRecordingState();
            for (int i = this.scales.getStartNote(); i < this.scales.getEndNote(); i++) lightGuide.light(i, this.getDrumPadColor(i, primary, isRecording));
            return;
        }
    }
    this.drawLightGuide(lightGuide);
}
Also used : IDrumDevice(de.mossgrabers.framework.daw.data.IDrumDevice) ILightGuide(de.mossgrabers.framework.controller.grid.ILightGuide)

Example 4 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 5 with IDrumDevice

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

the class DrumView method handleSelectButton.

/**
 * {@inheritDoc}
 */
@Override
public synchronized void handleSelectButton(final int playedPad) {
    // Do we have drum pads?
    final IDrumDevice primary = this.model.getDrumDevice();
    if (!primary.hasDrumPads())
        return;
    final ICursorDevice cd = this.model.getCursorDevice();
    final boolean isNested = cd.isNested();
    if (isNested) {
        // We have to move up to compare the main drum devices
        cd.selectParent();
    }
    // Can only scroll to the channel if the cursor device is the primary device
    if (primary.getPosition() != cd.getPosition())
        return;
    // Align the primary and cursor device drum bank view
    final IDrumPadBank drumPadBank = primary.getDrumPadBank();
    final int scrollPos = drumPadBank.getScrollPosition();
    final IDrumPadBank cdDrumPadBank = cd.getDrumPadBank();
    final int pageSize = cdDrumPadBank.getPageSize();
    final int adjustedPage = playedPad / pageSize * pageSize;
    cdDrumPadBank.scrollTo(scrollPos + adjustedPage, false);
    // Do not reselect
    final IDrumPad drumPad = drumPadBank.getItem(playedPad);
    if (drumPad.isSelected()) {
        // If the instrument of the pad was selected for editing, try to select it again
        if (isNested) {
            final IDrumPad selectedItem = cdDrumPadBank.getItem(playedPad % pageSize);
            if (selectedItem != null)
                selectedItem.enter();
        }
        return;
    }
    // Only activate layer mode if not one of the layer modes is already active
    final ModeManager modeManager = this.surface.getModeManager();
    if (!Modes.isLayerMode(modeManager.getActiveID()))
        modeManager.setActive(Modes.DEVICE_LAYER);
    drumPad.select();
    this.updateNoteMapping();
}
Also used : IDrumDevice(de.mossgrabers.framework.daw.data.IDrumDevice) IDrumPadBank(de.mossgrabers.framework.daw.data.bank.IDrumPadBank) IDrumPad(de.mossgrabers.framework.daw.data.IDrumPad) ICursorDevice(de.mossgrabers.framework.daw.data.ICursorDevice) ModeManager(de.mossgrabers.framework.featuregroup.ModeManager)

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