Search in sources :

Example 6 with IDrumPadBank

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

the class ControlView method getDrumPadColor.

protected String getDrumPadColor(final int index, final IDrumDevice primary, final boolean isRecording) {
    final int midiNote = this.keyManager.map(index);
    if (midiNote == -1)
        return Scales.SCALE_COLOR_OFF;
    // Playing note?
    if (this.keyManager.isKeyPressed(index))
        return isRecording ? AbstractDrumView.COLOR_PAD_RECORD : AbstractDrumView.COLOR_PAD_PLAY;
    // Exists and active?
    final IDrumPadBank drumPadBank = primary.getDrumPadBank();
    final IChannel drumPad = drumPadBank.getItem(index);
    if (!drumPad.doesExist() || !drumPad.isActivated())
        return this.surface.getConfiguration().isTurnOffEmptyDrumPads() ? AbstractDrumView.COLOR_PAD_OFF : AbstractDrumView.COLOR_PAD_NO_CONTENT;
    // Muted or soloed?
    if (drumPad.isMute() || drumPadBank.hasSoloedPads() && !drumPad.isSolo())
        return AbstractDrumView.COLOR_PAD_MUTED;
    return DAWColor.getColorIndex(drumPad.getColor());
}
Also used : IChannel(de.mossgrabers.framework.daw.data.IChannel) IDrumPadBank(de.mossgrabers.framework.daw.data.bank.IDrumPadBank)

Example 7 with IDrumPadBank

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

the class Drum64View method handleSelectButton.

/**
 * {@inheritDoc}
 */
@Override
protected void handleSelectButton(final int playedPad) {
    // Do we have drum pads?
    final IDrumDevice primary = this.model.getDrumDevice64();
    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, if pad is already selected
    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();
}
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)

Example 8 with IDrumPadBank

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

the class AbstractDrumView method getDrumPadColor.

protected String getDrumPadColor(final int index, final IDrumDevice primary, final boolean isRecording) {
    final int offsetY = this.scales.getDrumOffset();
    // Playing note?
    if (this.keyManager.isKeyPressed(offsetY + index))
        return isRecording ? AbstractDrumView.COLOR_PAD_RECORD : AbstractDrumView.COLOR_PAD_PLAY;
    // Selected?
    if (this.selectedPad == index)
        return AbstractDrumView.COLOR_PAD_SELECTED;
    // Exists and active?
    final IDrumPadBank drumPadBank = primary.getDrumPadBank();
    final IChannel drumPad = drumPadBank.getItem(index);
    if (!drumPad.doesExist() || !drumPad.isActivated())
        return this.surface.getConfiguration().isTurnOffEmptyDrumPads() ? AbstractDrumView.COLOR_PAD_OFF : AbstractDrumView.COLOR_PAD_NO_CONTENT;
    // Muted or soloed?
    if (drumPad.isMute() || drumPadBank.hasSoloedPads() && !drumPad.isSolo())
        return AbstractDrumView.COLOR_PAD_MUTED;
    return this.getPadContentColor(drumPad);
}
Also used : IChannel(de.mossgrabers.framework.daw.data.IChannel) IDrumPadBank(de.mossgrabers.framework.daw.data.bank.IDrumPadBank)

Example 9 with IDrumPadBank

use of de.mossgrabers.framework.daw.data.bank.IDrumPadBank 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 10 with IDrumPadBank

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

Aggregations

IDrumPadBank (de.mossgrabers.framework.daw.data.bank.IDrumPadBank)11 IDrumDevice (de.mossgrabers.framework.daw.data.IDrumDevice)6 IChannel (de.mossgrabers.framework.daw.data.IChannel)5 ICursorDevice (de.mossgrabers.framework.daw.data.ICursorDevice)3 IDrumPad (de.mossgrabers.framework.daw.data.IDrumPad)2 ModeManager (de.mossgrabers.framework.featuregroup.ModeManager)2 IDeviceBank (de.mossgrabers.framework.daw.data.bank.IDeviceBank)1 ITrackBank (de.mossgrabers.framework.daw.data.bank.ITrackBank)1