Search in sources :

Example 21 with ISendBank

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

the class BeatstepControllerSetup method updateIndication.

protected void updateIndication() {
    final BeatstepControlSurface surface = this.getSurface();
    final ViewManager viewManager = surface.getViewManager();
    final boolean isTrack = viewManager.isActive(Views.TRACK);
    final boolean isDevice = viewManager.isActive(Views.DEVICE);
    final boolean isSession = viewManager.isActive(Views.SESSION);
    final IMasterTrack mt = this.model.getMasterTrack();
    mt.setVolumeIndication(!isDevice);
    final ITrackBank tb = this.model.getTrackBank();
    final Optional<ITrack> selectedTrack = tb.getSelectedItem();
    final ITrackBank tbe = this.model.getEffectTrackBank();
    final ICursorDevice cursorDevice = this.model.getCursorDevice();
    final boolean isEffect = this.model.isEffectTrackBankActive();
    tb.setIndication(!isEffect && isSession);
    if (tbe != null)
        tbe.setIndication(isEffect && isSession);
    final IParameterBank parameterBank = cursorDevice.getParameterBank();
    for (int i = 0; i < 8; i++) {
        final boolean hasTrackSel = selectedTrack.isPresent() && selectedTrack.get().getIndex() == i;
        final ITrack track = tb.getItem(i);
        track.setVolumeIndication(!isEffect && hasTrackSel && !isDevice);
        track.setPanIndication(!isEffect && hasTrackSel && !isDevice);
        final ISendBank sendBank = track.getSendBank();
        for (int j = 0; j < 6; j++) sendBank.getItem(j).setIndication(!isEffect && hasTrackSel && isTrack);
        if (tbe != null) {
            final Optional<ITrack> selectedFXTrack = tbe.getSelectedItem();
            final boolean hasFXTrackSel = selectedFXTrack.isPresent() && selectedFXTrack.get().getIndex() == i;
            final ITrack fxTrack = tbe.getItem(i);
            fxTrack.setVolumeIndication(isEffect && hasFXTrackSel && isTrack);
            fxTrack.setPanIndication(isEffect && hasFXTrackSel && isTrack);
        }
        parameterBank.getItem(i).setIndication(isDevice);
    }
}
Also used : ITrack(de.mossgrabers.framework.daw.data.ITrack) ITrackBank(de.mossgrabers.framework.daw.data.bank.ITrackBank) ViewManager(de.mossgrabers.framework.featuregroup.ViewManager) BeatstepControlSurface(de.mossgrabers.controller.arturia.beatstep.controller.BeatstepControlSurface) IParameterBank(de.mossgrabers.framework.daw.data.bank.IParameterBank) ISendBank(de.mossgrabers.framework.daw.data.bank.ISendBank) IMasterTrack(de.mossgrabers.framework.daw.data.IMasterTrack) ICursorDevice(de.mossgrabers.framework.daw.data.ICursorDevice)

Example 22 with ISendBank

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

the class FireLayerMode method updateDisplay.

/**
 * {@inheritDoc}
 */
@Override
public void updateDisplay() {
    this.updateMode();
    final IGraphicDisplay display = this.surface.getGraphicsDisplay();
    String desc = "Select";
    String label = "a drum pad";
    int value = -1;
    int vuLeft = -1;
    int vuRight = -1;
    boolean isPan = false;
    final ISpecificDevice cd = this.model.getDrumDevice();
    final Optional<ILayer> channelOptional = cd.getLayerBank().getSelectedItem();
    if (channelOptional.isPresent()) {
        final IChannel channel = channelOptional.get();
        vuLeft = channel.getVuLeft();
        vuRight = channel.getVuRight();
        desc = channel.getPosition() + 1 + ": " + channel.getName(9);
        final ISendBank sendBank = channel.getSendBank();
        switch(this.selectedParameter) {
            case VOLUME:
                label = "Vol: " + channel.getVolumeStr();
                value = channel.getVolume();
                break;
            case PAN:
                label = "Pan: " + channel.getPanStr();
                value = channel.getPan();
                isPan = true;
                break;
            case SEND1:
            case SEND2:
            case SEND3:
            case SEND4:
            case SEND5:
            case SEND6:
                final int sendIndex = this.selectedParameter.ordinal() - Modes.SEND1.ordinal();
                label = getSendLabel(sendBank, sendIndex);
                value = getSendValue(sendBank, sendIndex);
                break;
            default:
                label = "Select a track";
                break;
        }
    }
    display.addElement(new TitleValueComponent(desc, label, value, vuLeft, vuRight, isPan));
    display.send();
}
Also used : IChannel(de.mossgrabers.framework.daw.data.IChannel) ILayer(de.mossgrabers.framework.daw.data.ILayer) IGraphicDisplay(de.mossgrabers.framework.controller.display.IGraphicDisplay) ISpecificDevice(de.mossgrabers.framework.daw.data.ISpecificDevice) ISendBank(de.mossgrabers.framework.daw.data.bank.ISendBank) TitleValueComponent(de.mossgrabers.controller.akai.fire.graphics.canvas.component.TitleValueComponent)

Example 23 with ISendBank

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

the class FireTrackMode method updateDisplay.

/**
 * {@inheritDoc}
 */
@Override
public void updateDisplay() {
    this.updateMode();
    final IGraphicDisplay display = this.surface.getGraphicsDisplay();
    String desc = "Select";
    String label = "a track";
    int value = -1;
    int vuLeft = -1;
    int vuRight = -1;
    boolean isPan = false;
    final Optional<ITrack> trackOptional = this.model.getCurrentTrackBank().getSelectedItem();
    if (trackOptional.isPresent()) {
        final ITrack track = trackOptional.get();
        vuLeft = track.getVuLeft();
        vuRight = track.getVuRight();
        desc = track.getPosition() + 1 + ": " + track.getName(9);
        final ISendBank sendBank = track.getSendBank();
        switch(this.selectedParameter) {
            case VOLUME:
                label = "Vol: " + track.getVolumeStr();
                value = track.getVolume();
                break;
            case PAN:
                label = "Pan: " + track.getPanStr();
                value = track.getPan();
                isPan = true;
                break;
            case SEND1:
            case SEND2:
            case SEND3:
            case SEND4:
            case SEND5:
            case SEND6:
                final int sendIndex = this.selectedParameter.ordinal() - Modes.SEND1.ordinal();
                label = getSendLabel(sendBank, sendIndex);
                value = getSendValue(sendBank, sendIndex);
                break;
            default:
                // Not used
                break;
        }
    }
    display.addElement(new TitleValueComponent(desc, label, value, vuLeft, vuRight, isPan));
    display.send();
}
Also used : ITrack(de.mossgrabers.framework.daw.data.ITrack) IGraphicDisplay(de.mossgrabers.framework.controller.display.IGraphicDisplay) ISendBank(de.mossgrabers.framework.daw.data.bank.ISendBank) TitleValueComponent(de.mossgrabers.controller.akai.fire.graphics.canvas.component.TitleValueComponent)

Example 24 with ISendBank

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

the class MaschineJamTrackMode method setupFader.

/**
 * {@inheritDoc}
 */
@Override
public FaderConfig setupFader(final int index) {
    final Optional<ITrack> optionalTrack = this.model.getCurrentTrackBank().getSelectedItem();
    if (optionalTrack.isEmpty())
        return FADER_OFF;
    final ITrack track = optionalTrack.get();
    if (!track.doesExist())
        return FADER_OFF;
    final String c = DAWColor.getColorIndex(track.getColor());
    final int color = this.colorManager.getColorIndex(c);
    switch(index) {
        case 0:
            final int value = this.model.getValueChanger().toMidiValue(track.getVolume());
            if (!this.model.getTransport().isPlaying())
                return new FaderConfig(FaderConfig.TYPE_SINGLE, color, value);
            final int vu = this.model.getValueChanger().toMidiValue(track.getVu());
            return new FaderConfig(FaderConfig.TYPE_DUAL, color, vu, value);
        case 1:
            final int panValue = this.model.getValueChanger().toMidiValue(track.getPan());
            return new FaderConfig(FaderConfig.TYPE_PAN, color, panValue);
        default:
            final ISendBank sendBank = track.getSendBank();
            if (!sendBank.hasExistingItems())
                return FADER_OFF;
            final int sendIndex = index - 2;
            final ISend send = sendBank.getItem(sendIndex);
            if (!send.doesExist())
                return FADER_OFF;
            final int sendValue = this.model.getValueChanger().toMidiValue(send.getValue());
            return new FaderConfig(FaderConfig.TYPE_SINGLE, MaschineColorManager.COLOR_DARK_GREY, sendValue);
    }
}
Also used : FaderConfig(de.mossgrabers.controller.ni.maschine.jam.controller.FaderConfig) ITrack(de.mossgrabers.framework.daw.data.ITrack) ISend(de.mossgrabers.framework.daw.data.ISend) ISendBank(de.mossgrabers.framework.daw.data.bank.ISendBank)

Example 25 with ISendBank

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

the class SendMode method getKnobValue.

/**
 * {@inheritDoc}
 */
@Override
public int getKnobValue(final int index) {
    // Note: Since we need multiple value (more than 8), index is the MIDI CC of the knob
    final IValueChanger valueChanger = this.model.getValueChanger();
    final Optional<ITrack> selectedTrack = this.bank.getSelectedItem();
    final ISendBank sendBank = selectedTrack.isEmpty() ? null : selectedTrack.get().getSendBank();
    if (index >= KontrolProtocolControlSurface.KONTROL_TRACK_VOLUME && index < KontrolProtocolControlSurface.KONTROL_TRACK_VOLUME + 8) {
        final ISend send = sendBank == null ? EmptySend.INSTANCE : sendBank.getItem(index - KontrolProtocolControlSurface.KONTROL_TRACK_VOLUME);
        return valueChanger.toMidiValue(send.getValue());
    }
    if (index >= KontrolProtocolControlSurface.KONTROL_TRACK_PAN && index < KontrolProtocolControlSurface.KONTROL_TRACK_PAN + 8) {
        final ISend send = sendBank == null ? EmptySend.INSTANCE : sendBank.getItem(index - KontrolProtocolControlSurface.KONTROL_TRACK_PAN);
        return valueChanger.toMidiValue(send.getValue());
    }
    final int scrollTracksState = (sendBank != null && sendBank.canScrollPageBackwards() ? 1 : 0) + (sendBank != null && sendBank.canScrollPageForwards() ? 2 : 0);
    final int scrollScenesState = 0;
    final KontrolProtocolConfiguration configuration = this.surface.getConfiguration();
    switch(index) {
        case KontrolProtocolControlSurface.KONTROL_NAVIGATE_BANKS:
            return scrollTracksState;
        case KontrolProtocolControlSurface.KONTROL_NAVIGATE_TRACKS:
            return configuration.isFlipTrackClipNavigation() ? scrollScenesState : scrollTracksState;
        case KontrolProtocolControlSurface.KONTROL_NAVIGATE_CLIPS:
            return configuration.isFlipTrackClipNavigation() ? scrollTracksState : scrollScenesState;
        default:
            return 0;
    }
}
Also used : ITrack(de.mossgrabers.framework.daw.data.ITrack) IValueChanger(de.mossgrabers.framework.controller.valuechanger.IValueChanger) ISend(de.mossgrabers.framework.daw.data.ISend) KontrolProtocolConfiguration(de.mossgrabers.controller.ni.kontrol.mkii.KontrolProtocolConfiguration) ISendBank(de.mossgrabers.framework.daw.data.bank.ISendBank)

Aggregations

ISendBank (de.mossgrabers.framework.daw.data.bank.ISendBank)31 ITrack (de.mossgrabers.framework.daw.data.ITrack)25 ISend (de.mossgrabers.framework.daw.data.ISend)17 ITrackBank (de.mossgrabers.framework.daw.data.bank.ITrackBank)8 IGraphicDisplay (de.mossgrabers.framework.controller.display.IGraphicDisplay)4 ITextDisplay (de.mossgrabers.framework.controller.display.ITextDisplay)4 IChannel (de.mossgrabers.framework.daw.data.IChannel)3 ILayer (de.mossgrabers.framework.daw.data.ILayer)3 TitleChannelsComponent (de.mossgrabers.controller.akai.fire.graphics.canvas.component.TitleChannelsComponent)2 TitleValueComponent (de.mossgrabers.controller.akai.fire.graphics.canvas.component.TitleValueComponent)2 IValueChanger (de.mossgrabers.framework.controller.valuechanger.IValueChanger)2 IMasterTrack (de.mossgrabers.framework.daw.data.IMasterTrack)2 ISpecificDevice (de.mossgrabers.framework.daw.data.ISpecificDevice)2 IParameterBank (de.mossgrabers.framework.daw.data.bank.IParameterBank)2 ModeManager (de.mossgrabers.framework.featuregroup.ModeManager)2 Modes (de.mossgrabers.framework.mode.Modes)2 PushConfiguration (de.mossgrabers.controller.ableton.push.PushConfiguration)1 BeatstepControlSurface (de.mossgrabers.controller.arturia.beatstep.controller.BeatstepControlSurface)1 FlexiCommand (de.mossgrabers.controller.generic.controller.FlexiCommand)1 Kontrol1Display (de.mossgrabers.controller.ni.kontrol.mki.controller.Kontrol1Display)1