Search in sources :

Example 31 with IChannelBank

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

the class LeftCommand method execute.

/**
 * {@inheritDoc}
 */
@Override
public void execute(final ButtonEvent event) {
    final IChannelBank tb = this.model.getCurrentTrackBank();
    final ITrack sel = tb.getSelectedTrack();
    final int index = sel == null ? 0 : sel.getIndex() - 1;
    final View view = this.surface.getViewManager().getActiveView();
    if (index == -1 || this.surface.isShiftPressed()) {
        if (!tb.canScrollTracksUp())
            return;
        tb.scrollTracksPageUp();
        final int newSel = index == -1 || sel == null ? 7 : sel.getIndex();
        this.surface.scheduleTask(() -> view.selectTrack(newSel), 75);
        return;
    }
    view.selectTrack(index);
}
Also used : ITrack(de.mossgrabers.framework.daw.data.ITrack) IChannelBank(de.mossgrabers.framework.daw.IChannelBank) View(de.mossgrabers.framework.view.View)

Example 32 with IChannelBank

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

the class SelectNoteViewCommand method execute.

/**
 * {@inheritDoc}
 */
@Override
public void execute(final ButtonEvent event) {
    if (event != ButtonEvent.DOWN)
        return;
    final ViewManager viewManager = this.surface.getViewManager();
    final IChannelBank tb = this.model.getCurrentTrackBank();
    final ITrack sel = tb.getSelectedTrack();
    if (sel == null) {
        viewManager.setActiveView(Views.VIEW_SESSION);
        return;
    }
    final boolean isShifted = this.surface.isShiftPressed();
    if (Views.isNoteView(isShifted ? viewManager.getPreviousViewId() : viewManager.getActiveViewId())) {
        if (isShifted)
            this.seqSelect.executeNormal(event);
        else
            this.playSelect.executeNormal(event);
    } else {
        final Integer viewID = viewManager.getPreferredView(sel.getPosition());
        if (viewID == null)
            this.seqSelect.executeNormal(event);
        else
            viewManager.setActiveView(viewID);
    }
    viewManager.setPreferredView(sel.getPosition(), viewManager.getActiveViewId());
    this.surface.getDisplay().notify(viewManager.getActiveView().getName());
}
Also used : ITrack(de.mossgrabers.framework.daw.data.ITrack) IChannelBank(de.mossgrabers.framework.daw.IChannelBank) ViewManager(de.mossgrabers.framework.view.ViewManager)

Example 33 with IChannelBank

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

the class BaseMode method updateFirstRow.

/**
 * {@inheritDoc}
 */
@Override
public void updateFirstRow() {
    final IChannelBank tb = this.model.getCurrentTrackBank();
    final int extenderOffset = this.surface.getExtenderOffset();
    for (int i = 0; i < 8; i++) {
        final ITrack track = tb.getTrack(extenderOffset + i);
        this.surface.updateButton(MCUControlSurface.MCU_ARM1 + i, track.isRecArm() ? MCUControllerSetup.MCU_BUTTON_STATE_ON : MCUControllerSetup.MCU_BUTTON_STATE_OFF);
        this.surface.updateButton(MCUControlSurface.MCU_SOLO1 + i, track.isSolo() ? MCUControllerSetup.MCU_BUTTON_STATE_ON : MCUControllerSetup.MCU_BUTTON_STATE_OFF);
        this.surface.updateButton(MCUControlSurface.MCU_MUTE1 + i, track.isMute() ? MCUControllerSetup.MCU_BUTTON_STATE_ON : MCUControllerSetup.MCU_BUTTON_STATE_OFF);
        this.surface.updateButton(MCUControlSurface.MCU_SELECT1 + i, track.isSelected() ? MCUControllerSetup.MCU_BUTTON_STATE_ON : MCUControllerSetup.MCU_BUTTON_STATE_OFF);
    }
    this.updateKnobLEDs();
}
Also used : ITrack(de.mossgrabers.framework.daw.data.ITrack) IChannelBank(de.mossgrabers.framework.daw.IChannelBank)

Example 34 with IChannelBank

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

the class BaseMode method drawDisplay2.

protected void drawDisplay2() {
    if (!this.surface.getConfiguration().hasDisplay2())
        return;
    final IChannelBank tb = this.model.getCurrentTrackBank();
    // Format track names
    final Display d2 = this.surface.getSecondDisplay();
    final int extenderOffset = this.surface.getExtenderOffset();
    final boolean isMainDevice = this.surface.isMainDevice();
    for (int i = 0; i < 8; i++) {
        final ITrack t = tb.getTrack(extenderOffset + i);
        d2.setCell(0, i, StringUtils.shortenAndFixASCII(t.getName(), isMainDevice ? 6 : 7));
    }
    if (isMainDevice)
        d2.setCell(0, 8, "Maste");
    d2.done(0);
    d2.clearRow(1);
    if (isMainDevice) {
        final IMasterTrack masterTrack = this.model.getMasterTrack();
        final ICursorDevice cursorDevice = this.model.getCursorDevice();
        final ITrack selectedTrack = masterTrack.isSelected() ? masterTrack : tb.getSelectedTrack();
        d2.setBlock(1, 0, "Sel.track: ").setBlock(1, 1, selectedTrack == null ? "None" : StringUtils.fixASCII(selectedTrack.getName()));
        d2.setBlock(1, 2, "Sel.devce: ").setBlock(1, 3, cursorDevice.hasSelectedDevice() ? cursorDevice.getName() : "None");
    }
    d2.done(1);
}
Also used : ITrack(de.mossgrabers.framework.daw.data.ITrack) IChannelBank(de.mossgrabers.framework.daw.IChannelBank) IMasterTrack(de.mossgrabers.framework.daw.data.IMasterTrack) ICursorDevice(de.mossgrabers.framework.daw.ICursorDevice) Display(de.mossgrabers.framework.controller.display.Display)

Example 35 with IChannelBank

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

the class PitchbendVolumeCommand method handleTrack.

private void handleTrack(final int index, final double value) {
    final boolean effectTrackBankActive = this.model.isEffectTrackBankActive();
    final IChannelBank tb = this.model.getCurrentTrackBank();
    final ITrack selectedTrack = tb.getSelectedTrack();
    switch(index) {
        case 0:
            selectedTrack.setVolume(value);
            return;
        case 1:
            selectedTrack.setPan(value);
            return;
    }
    final MCUConfiguration config = this.surface.getConfiguration();
    if (index == 2) {
        if (config.isDisplayCrossfader()) {
            final double range = this.model.getValueChanger().getUpperBound() / 3.0;
            selectedTrack.setCrossfadeModeAsNumber((int) Math.round(value / range));
        } else if (!effectTrackBankActive)
            selectedTrack.getSend(0).setValue(value);
    } else if (!effectTrackBankActive)
        selectedTrack.getSend(index - (config.isDisplayCrossfader() ? 3 : 2)).setValue(value);
}
Also used : ITrack(de.mossgrabers.framework.daw.data.ITrack) MCUConfiguration(de.mossgrabers.mcu.MCUConfiguration) IChannelBank(de.mossgrabers.framework.daw.IChannelBank)

Aggregations

IChannelBank (de.mossgrabers.framework.daw.IChannelBank)114 ITrack (de.mossgrabers.framework.daw.data.ITrack)92 ICursorDevice (de.mossgrabers.framework.daw.ICursorDevice)22 ITrackBank (de.mossgrabers.framework.daw.ITrackBank)20 ModeManager (de.mossgrabers.framework.mode.ModeManager)20 PushConfiguration (de.mossgrabers.push.PushConfiguration)19 Display (de.mossgrabers.framework.controller.display.Display)18 ISend (de.mossgrabers.framework.daw.data.ISend)11 ViewManager (de.mossgrabers.framework.view.ViewManager)10 PushDisplay (de.mossgrabers.push.controller.PushDisplay)10 IChannel (de.mossgrabers.framework.daw.data.IChannel)9 IMasterTrack (de.mossgrabers.framework.daw.data.IMasterTrack)7 ISlot (de.mossgrabers.framework.daw.data.ISlot)7 IValueChanger (de.mossgrabers.framework.controller.IValueChanger)5 View (de.mossgrabers.framework.view.View)5 DisplayMessage (de.mossgrabers.push.controller.DisplayMessage)5 ITransport (de.mossgrabers.framework.daw.ITransport)4 IMidiOutput (de.mossgrabers.framework.daw.midi.IMidiOutput)4 ColorManager (de.mossgrabers.framework.controller.color.ColorManager)3 PadGrid (de.mossgrabers.framework.controller.grid.PadGrid)3