Search in sources :

Example 81 with ITrack

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

the class AbstractRaindropsView method drawGrid.

/**
 * {@inheritDoc}
 */
@Override
public void drawGrid() {
    final IPadGrid padGrid = this.surface.getPadGrid();
    if (!this.isActive()) {
        padGrid.turnOff();
        return;
    }
    if (this.ongoingResolutionChange)
        return;
    final ITrack cursorTrack = this.useDawColors ? this.model.getCursorTrack() : null;
    final INoteClip clip = this.getClip();
    final int length = (int) Math.floor(clip.getLoopLength() / Resolution.getValueAt(this.selectedResolutionIndex));
    final int step = clip.getCurrentStep();
    for (int x = 0; x < AbstractRaindropsView.NUM_DISPLAY_COLS; x++) {
        final int mappedKey = this.keyManager.map(x);
        if (mappedKey == -1)
            continue;
        final int left = this.getNoteDistanceToTheLeft(mappedKey, step, length);
        final int right = this.getNoteDistanceToTheRight(mappedKey, step, length);
        final boolean isOn = left >= 0 && right >= 0;
        final int sum = left + right;
        final int distance = sum == 0 ? 0 : (sum + 1) / 2;
        for (int y = 0; y < this.numDisplayRows; y++) {
            String colorID = y == 0 ? this.getPadColor(x, cursorTrack) : AbstractSequencerView.COLOR_NO_CONTENT;
            if (isOn) {
                if (y == distance)
                    colorID = AbstractSequencerView.COLOR_CONTENT;
                if (left <= distance && y == left || left > distance && y == sum - left)
                    colorID = AbstractSequencerView.COLOR_STEP_HILITE_NO_CONTENT;
            }
            padGrid.lightEx(x, this.numDisplayRows - 1 - y, colorID);
        }
    }
}
Also used : IPadGrid(de.mossgrabers.framework.controller.grid.IPadGrid) ITrack(de.mossgrabers.framework.daw.data.ITrack) INoteClip(de.mossgrabers.framework.daw.INoteClip)

Example 82 with ITrack

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

the class AbstractSessionView method onGridNote.

/**
 * {@inheritDoc}
 */
@Override
public void onGridNote(final int note, final int velocity) {
    // Trigger on pad release to intercept long presses
    if (velocity != 0)
        return;
    final Pair<Integer, Integer> padPos = this.getPad(note);
    final ITrack track = this.model.getCurrentTrackBank().getItem(padPos.getKey().intValue());
    final ISlot slot = track.getSlotBank().getItem(padPos.getValue().intValue());
    if (this.handleButtonCombinations(track, slot))
        return;
    if (this.surface.isSelectPressed()) {
        slot.select();
        if (slot.hasContent()) {
            final String slotName = slot.getName();
            if (!slotName.isBlank())
                this.surface.getDisplay().notify(slotName);
        }
        return;
    }
    if (this.doSelectClipOnLaunch())
        slot.select();
    if (!track.isRecArm() || slot.hasContent()) {
        slot.launch();
        return;
    }
    final C configuration = this.surface.getConfiguration();
    switch(configuration.getActionForRecArmedPad()) {
        case 0:
            this.model.recordNoteClip(track, slot);
            break;
        case 1:
            final int lengthInBeats = configuration.getNewClipLenghthInBeats(this.model.getTransport().getQuartersPerMeasure());
            this.model.createNoteClip(track, slot, lengthInBeats, true);
            break;
        case 2:
        default:
            // Do nothing
            break;
    }
}
Also used : ITrack(de.mossgrabers.framework.daw.data.ITrack) ISlot(de.mossgrabers.framework.daw.data.ISlot)

Example 83 with ITrack

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

the class ColorView method onGridNote.

/**
 * {@inheritDoc}
 */
@Override
public void onGridNote(final int note, final int velocity) {
    if (velocity > 0)
        return;
    final int offset = this.page * this.pageSize;
    final int color = offset + note - 36;
    final DAWColor[] dawColors = DAWColor.values();
    if (color < dawColors.length) {
        final ColorEx entry = dawColors[color].getColor();
        switch(this.mode) {
            case MODE_TRACK:
                final ITrack cursorTrack = this.model.getCursorTrack();
                if (cursorTrack.doesExist())
                    cursorTrack.setColor(entry);
                else {
                    final IMasterTrack master = this.model.getMasterTrack();
                    if (master.isSelected())
                        master.setColor(entry);
                }
                break;
            case MODE_LAYER:
                final IBank<? extends ILayer> layerBank = this.getLayerBank();
                final Optional<?> selectedItem = layerBank.getSelectedItem();
                if (selectedItem.isPresent())
                    ((ILayer) selectedItem.get()).setColor(entry);
                break;
            case MODE_CLIP:
                final IClip clip = this.model.getCursorClip();
                if (clip.doesExist())
                    clip.setColor(entry);
                break;
        }
    }
    this.surface.getViewManager().restore();
}
Also used : ITrack(de.mossgrabers.framework.daw.data.ITrack) DAWColor(de.mossgrabers.framework.daw.DAWColor) ColorEx(de.mossgrabers.framework.controller.color.ColorEx) IClip(de.mossgrabers.framework.daw.IClip) IMasterTrack(de.mossgrabers.framework.daw.data.IMasterTrack)

Example 84 with ITrack

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

the class MastertrackCommand method handleButtonUp.

private void handleButtonUp(final ModeManager modeManager) {
    if (this.quitMasterMode) {
        modeManager.restore();
        return;
    }
    if (Modes.MASTER.equals(modeManager.getActiveID())) {
        if (this.selectedTrackBeforeMasterMode >= 0)
            this.model.getCurrentTrackBank().getItem(this.selectedTrackBeforeMasterMode).select();
        return;
    }
    modeManager.setActive(Modes.MASTER);
    this.model.getMasterTrack().select();
    final ITrack cursorTrack = this.model.getCursorTrack();
    this.selectedTrackBeforeMasterMode = cursorTrack.doesExist() ? cursorTrack.getIndex() : -1;
}
Also used : ITrack(de.mossgrabers.framework.daw.data.ITrack)

Example 85 with ITrack

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

the class TrackEditing method onTrackKnob.

/**
 * A knob is moved for changing a track parameter.
 *
 * @param index The index of the knob
 * @param value The knobs value
 * @param isTurnedRight The knob is turned to the right (positive value change)
 */
public void onTrackKnob(final int index, final int value, final boolean isTurnedRight) {
    final ITrackBank tb = this.model.getCurrentTrackBank();
    final Optional<ITrack> selectedTrack = tb.getSelectedItem();
    if (selectedTrack.isEmpty())
        return;
    switch(index) {
        case 0:
            selectedTrack.get().changeVolume(value);
            break;
        case 1:
            selectedTrack.get().changePan(value);
            break;
        case 2:
            selectedTrack.get().setMute(isTurnedRight);
            break;
        case 3:
            selectedTrack.get().setSolo(isTurnedRight);
            break;
        case 4:
            selectedTrack.get().getCrossfadeParameter().changeValue(value);
            break;
        case 5:
            this.model.getTransport().changeTempo(isTurnedRight, this.surface.isShiftPressed());
            break;
        case 6:
            this.model.getTransport().changePosition(isTurnedRight, this.surface.isShiftPressed());
            break;
        case 7:
            this.model.getMasterTrack().changeVolume(value);
            break;
        // Send 1 - 4
        case 8:
        case 9:
        case 10:
        case 11:
            if (!this.model.isEffectTrackBankActive())
                selectedTrack.get().getSendBank().getItem(index - 8).changeValue(value);
            break;
        default:
            // Not used
            break;
    }
}
Also used : ITrack(de.mossgrabers.framework.daw.data.ITrack) ITrackBank(de.mossgrabers.framework.daw.data.bank.ITrackBank)

Aggregations

ITrack (de.mossgrabers.framework.daw.data.ITrack)312 IChannelBank (de.mossgrabers.framework.daw.IChannelBank)92 ITrackBank (de.mossgrabers.framework.daw.data.bank.ITrackBank)84 ISend (de.mossgrabers.framework.daw.data.ISend)40 ISendBank (de.mossgrabers.framework.daw.data.bank.ISendBank)25 ICursorDevice (de.mossgrabers.framework.daw.ICursorDevice)19 ISlot (de.mossgrabers.framework.daw.data.ISlot)19 Display (de.mossgrabers.framework.controller.display.Display)18 ITrackBank (de.mossgrabers.framework.daw.ITrackBank)18 ModeManager (de.mossgrabers.framework.mode.ModeManager)18 ITextDisplay (de.mossgrabers.framework.controller.display.ITextDisplay)16 ViewManager (de.mossgrabers.framework.view.ViewManager)16 IMasterTrack (de.mossgrabers.framework.daw.data.IMasterTrack)15 ModeManager (de.mossgrabers.framework.featuregroup.ModeManager)15 PushConfiguration (de.mossgrabers.push.PushConfiguration)14 ViewManager (de.mossgrabers.framework.featuregroup.ViewManager)12 IPadGrid (de.mossgrabers.framework.controller.grid.IPadGrid)11 PushDisplay (de.mossgrabers.push.controller.PushDisplay)11 ITransport (de.mossgrabers.framework.daw.ITransport)9 IParameter (de.mossgrabers.framework.daw.data.IParameter)9