Search in sources :

Example 56 with ITrackBank

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

the class SessionView method canScroll.

/**
 * {@inheritDoc}
 */
@Override
public boolean canScroll(final Direction direction) {
    final boolean flipSession = this.surface.getConfiguration().isFlipSession();
    final ITrackBank trackBank = this.model.getCurrentTrackBank();
    switch(direction) {
        case LEFT:
        case RIGHT:
            if (flipSession)
                return direction == Direction.LEFT ? trackBank.getSceneBank().canScrollPageBackwards() : trackBank.getSceneBank().canScrollPageForwards();
            return direction == Direction.LEFT ? trackBank.canScrollPageBackwards() : trackBank.canScrollPageForwards();
        case UP:
        case DOWN:
            if (flipSession)
                return direction == Direction.UP ? trackBank.canScrollPageBackwards() : trackBank.canScrollPageForwards();
            return direction == Direction.UP ? trackBank.getSceneBank().canScrollPageBackwards() : trackBank.getSceneBank().canScrollPageForwards();
    }
    return false;
}
Also used : ITrackBank(de.mossgrabers.framework.daw.data.bank.ITrackBank)

Example 57 with ITrackBank

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

the class OSCControllerSetup method createObservers.

/**
 * {@inheritDoc}
 */
@Override
protected void createObservers() {
    super.createObservers();
    this.configuration.addSettingObserver(OSCConfiguration.RECEIVE_PORT, () -> {
        try {
            final int receivePort = this.configuration.getReceivePort();
            if (receivePort == this.configuration.getSendPort()) {
                final String message = "Could not start OSC server. OSC send and receive port must be different! Both are: " + receivePort;
                this.host.showNotification(message);
                this.host.println(message);
                return;
            }
            this.oscServer.start(receivePort);
            this.host.println("Started OSC server on port " + receivePort + ".");
        } catch (final IOException ex) {
            this.host.error("Could not start OSC server.", ex);
        }
    });
    final ITrackBank tb = this.model.getTrackBank();
    tb.addSelectionObserver((final int index, final boolean isSelected) -> this.keyManager.clearPressedKeys());
    tb.addNoteObserver(this.keyManager);
    this.configuration.registerDeactivatedItemsHandler(this.model);
    this.configuration.addSettingObserver(OSCConfiguration.VALUE_RESOLUTION, () -> {
        switch(this.configuration.getValueResolution()) {
            case LOW:
                this.valueChanger.setUpperBound(128);
                this.valueChanger.setStepSize(1);
                break;
            case MEDIUM:
                this.valueChanger.setUpperBound(1024);
                this.valueChanger.setStepSize(8);
                break;
            case HIGH:
                this.valueChanger.setUpperBound(16384);
                this.valueChanger.setStepSize(128);
                break;
        }
    });
}
Also used : ITrackBank(de.mossgrabers.framework.daw.data.bank.ITrackBank) IOException(java.io.IOException)

Example 58 with ITrackBank

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

the class AbstractTrackMode method onButton.

/**
 * {@inheritDoc}
 */
@Override
public void onButton(final int row, final int index, final ButtonEvent event) {
    if (event != ButtonEvent.UP || row != 0)
        return;
    // Combination with Shift
    if (this.surface.isShiftPressed()) {
        this.onButtonShifted(index);
        return;
    }
    // Combination with Arrow Down
    if (this.surface.isLongPressed(ButtonID.ARROW_DOWN)) {
        this.surface.getModeManager().setActive(MODES[index]);
        this.surface.setTriggerConsumed(ButtonID.ARROW_DOWN);
        return;
    }
    final ITrackBank tb = this.model.getCurrentTrackBank();
    final ITrack track = tb.getItem(index);
    // Combination with Duplicate
    if (this.surface.isPressed(ButtonID.DUPLICATE)) {
        this.surface.setTriggerConsumed(ButtonID.DUPLICATE);
        track.duplicate();
        return;
    }
    // Combination with Delete
    if (this.surface.isPressed(ButtonID.DELETE)) {
        this.surface.setTriggerConsumed(ButtonID.DELETE);
        track.remove();
        return;
    }
    // Select track or expand group
    track.selectOrExpandGroup();
}
Also used : ITrack(de.mossgrabers.framework.daw.data.ITrack) ITrackBank(de.mossgrabers.framework.daw.data.bank.ITrackBank)

Example 59 with ITrackBank

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

the class SLMkIIIVolumeMode method updateDisplay.

/**
 * {@inheritDoc}
 */
@Override
public void updateDisplay() {
    final SLMkIIIDisplay d = this.surface.getDisplay();
    d.clear();
    d.setCell(0, 8, "Volume");
    final ITrackBank tb = this.model.getCurrentTrackBank();
    for (int i = 0; i < 8; i++) {
        final ITrack t = tb.getItem(i);
        if (t.doesExist())
            d.setCell(0, i, "Volume").setCell(1, i, t.getVolumeStr(9));
        this.setColumnColors(d, i, t, SLMkIIIColorManager.SLMKIII_BLUE);
    }
    final ITrack cursorTrack = this.model.getCursorTrack();
    d.setCell(1, 8, cursorTrack.doesExist() ? StringUtils.fixASCII(cursorTrack.getName(9)) : "");
    this.drawRow4();
    this.setButtonInfo(d);
    d.allDone();
}
Also used : ITrack(de.mossgrabers.framework.daw.data.ITrack) ITrackBank(de.mossgrabers.framework.daw.data.bank.ITrackBank) SLMkIIIDisplay(de.mossgrabers.controller.novation.slmkiii.controller.SLMkIIIDisplay)

Example 60 with ITrackBank

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

the class AutoColorSetup method createObservers.

/**
 * {@inheritDoc}
 */
@Override
protected void createObservers() {
    super.createObservers();
    // Update track colors if Auto Color is enabled in the settings
    this.configuration.addSettingObserver(AutoColorConfiguration.ENABLE_AUTO_COLOR, () -> {
        if (!this.configuration.isEnableAutoColor())
            return;
        final ITrackBank tb = this.model.getTrackBank();
        for (int i = 0; i < tb.getPageSize(); i++) this.autoColor.matchTrackName(i, tb.getItem(i).getName());
    });
    // Monitor all color regular expression settings
    final DAWColor[] colors = DAWColor.values();
    for (int i = 0; i < colors.length; i++) {
        final DAWColor color = colors[i];
        this.configuration.addSettingObserver(Integer.valueOf(AutoColorConfiguration.COLOR_REGEX.intValue() + i), () -> this.autoColor.handleRegExChange(color, this.configuration.getColorRegExValue(color)));
    }
    // Add name observers to all tracks
    final ITrackBank tb = this.model.getTrackBank();
    for (int index = 0; index < tb.getPageSize(); index++) {
        final int i = index;
        final ITrack track = tb.getItem(index);
        track.addNameObserver(name -> this.autoColor.matchTrackName(i, name));
        track.addColorObserver(name -> this.autoColor.matchTrackName(i, track.getName()));
    }
}
Also used : ITrack(de.mossgrabers.framework.daw.data.ITrack) ITrackBank(de.mossgrabers.framework.daw.data.bank.ITrackBank) DAWColor(de.mossgrabers.framework.daw.DAWColor)

Aggregations

ITrackBank (de.mossgrabers.framework.daw.data.bank.ITrackBank)121 ITrack (de.mossgrabers.framework.daw.data.ITrack)85 ModeManager (de.mossgrabers.framework.featuregroup.ModeManager)17 ITextDisplay (de.mossgrabers.framework.controller.display.ITextDisplay)16 Modes (de.mossgrabers.framework.mode.Modes)15 PushConfiguration (de.mossgrabers.controller.ableton.push.PushConfiguration)10 IPadGrid (de.mossgrabers.framework.controller.grid.IPadGrid)10 ISend (de.mossgrabers.framework.daw.data.ISend)10 ISendBank (de.mossgrabers.framework.daw.data.bank.ISendBank)8 ICursorDevice (de.mossgrabers.framework.daw.data.ICursorDevice)7 IMasterTrack (de.mossgrabers.framework.daw.data.IMasterTrack)7 ICursorTrack (de.mossgrabers.framework.daw.data.ICursorTrack)6 IValueChanger (de.mossgrabers.framework.controller.valuechanger.IValueChanger)5 ITransport (de.mossgrabers.framework.daw.ITransport)5 IParameterBank (de.mossgrabers.framework.daw.data.bank.IParameterBank)5 ISceneBank (de.mossgrabers.framework.daw.data.bank.ISceneBank)5 SLMkIIIDisplay (de.mossgrabers.controller.novation.slmkiii.controller.SLMkIIIDisplay)4 ColorEx (de.mossgrabers.framework.controller.color.ColorEx)4 Kontrol1Display (de.mossgrabers.controller.ni.kontrol.mki.controller.Kontrol1Display)3 IHost (de.mossgrabers.framework.daw.IHost)3