Search in sources :

Example 21 with PushConfiguration

use of de.mossgrabers.controller.ableton.push.PushConfiguration in project DrivenByMoss by git-moss.

the class AbstractTrackMode method onSecondRow.

/**
 * {@inheritDoc}
 */
@Override
public void onSecondRow(final int index, final ButtonEvent event) {
    if (event != ButtonEvent.DOWN)
        return;
    final ITrackBank tb = this.model.getCurrentTrackBank();
    final ITrack track = tb.getItem(index);
    if (this.surface.isPressed(ButtonID.STOP_CLIP)) {
        track.stop();
        return;
    }
    final PushConfiguration config = this.surface.getConfiguration();
    if (!this.isPush2 || config.isMuteLongPressed() || config.isSoloLongPressed() || config.isMuteSoloLocked()) {
        if (config.isMuteState())
            track.toggleMute();
        else
            track.toggleSolo();
        return;
    }
    final ModeManager modeManager = this.surface.getModeManager();
    switch(index) {
        case 0:
            if (modeManager.isActive(Modes.VOLUME))
                modeManager.setActive(Modes.TRACK);
            else
                modeManager.setActive(Modes.VOLUME);
            break;
        case 1:
            if (modeManager.isActive(Modes.PAN))
                modeManager.setActive(Modes.TRACK);
            else
                modeManager.setActive(Modes.PAN);
            break;
        case 2:
            if (modeManager.isActive(Modes.CROSSFADER))
                modeManager.setActive(Modes.TRACK);
            else
                modeManager.setActive(Modes.CROSSFADER);
            break;
        case 3:
            if (!this.model.isEffectTrackBankActive()) {
                config.setSendsAreToggled(!config.isSendsAreToggled());
                if (!modeManager.isActive(Modes.TRACK))
                    modeManager.setActive(Modes.get(Modes.SEND1, config.isSendsAreToggled() ? 4 : 0));
            }
            break;
        case 7:
            if (!this.model.isEffectTrackBankActive()) {
                if (this.lastSendIsAccessible())
                    this.handleSendEffect(config.isSendsAreToggled() ? 7 : 3);
                else
                    this.model.getTrackBank().selectParent();
            }
            break;
        default:
            this.handleSendEffect(index - (config.isSendsAreToggled() ? 0 : 4));
            break;
    }
    config.setDebugMode(modeManager.getActiveID());
}
Also used : PushConfiguration(de.mossgrabers.controller.ableton.push.PushConfiguration) ITrack(de.mossgrabers.framework.daw.data.ITrack) ITrackBank(de.mossgrabers.framework.daw.data.bank.ITrackBank) ModeManager(de.mossgrabers.framework.featuregroup.ModeManager)

Example 22 with PushConfiguration

use of de.mossgrabers.controller.ableton.push.PushConfiguration in project DrivenByMoss by git-moss.

the class AccentMode method onKnobValue.

/**
 * {@inheritDoc}
 */
@Override
public void onKnobValue(final int index, final int value) {
    // Will never need fine increments on accent velocity since they are integers
    final IValueChanger valueChanger = this.model.getValueChanger();
    final PushConfiguration config = this.surface.getConfiguration();
    final int fixedAccentValue = config.getFixedAccentValue();
    config.setFixedAccentValue(Math.max(1, valueChanger.changeValue(value, fixedAccentValue, -100, 128)));
}
Also used : PushConfiguration(de.mossgrabers.controller.ableton.push.PushConfiguration) IValueChanger(de.mossgrabers.framework.controller.valuechanger.IValueChanger)

Example 23 with PushConfiguration

use of de.mossgrabers.controller.ableton.push.PushConfiguration in project DrivenByMoss by git-moss.

the class SetupMode method onKnobTouch.

/**
 * {@inheritDoc}
 */
@Override
public void onKnobTouch(final int index, final boolean isTouched) {
    this.isKnobTouched[index] = isTouched;
    if (!isTouched || !this.surface.isDeletePressed())
        return;
    this.surface.setTriggerConsumed(ButtonID.DELETE);
    final PushConfiguration config = this.surface.getConfiguration();
    switch(index) {
        case 2:
            config.setDisplayBrightness(100);
            break;
        case 3:
            config.setLEDBrightness(100);
            break;
        case 5:
            config.setPadSensitivity(5);
            break;
        case 6:
            config.setPadGain(5);
            break;
        case 7:
            config.setPadDynamics(5);
            break;
        default:
            // Not used
            break;
    }
}
Also used : PushConfiguration(de.mossgrabers.controller.ableton.push.PushConfiguration)

Example 24 with PushConfiguration

use of de.mossgrabers.controller.ableton.push.PushConfiguration in project DrivenByMoss by git-moss.

the class DeviceLayerMode method updateDisplayElements.

/**
 * Update all 8 elements.
 *
 * @param display The display
 * @param l The channel data
 */
protected void updateDisplayElements(final IGraphicDisplay display, final Optional<ILayer> l) {
    // Drum Pad Bank has size of 16, layers only 8
    final int offset = this.getDrumPadIndex();
    // Get the index at which to draw the Sends element
    int sendsIndex = l.isEmpty() ? -1 : l.get().getIndex() - offset + 1;
    if (sendsIndex == 8)
        sendsIndex = 6;
    this.updateMenuItems(-1);
    final PushConfiguration config = this.surface.getConfiguration();
    for (int i = 0; i < 8; i++) {
        final IChannel layer = this.bank.getItem(offset + i);
        final Pair<String, Boolean> pair = this.menu.get(i);
        final String topMenu = pair.getKey();
        final boolean isTopMenuOn = pair.getValue().booleanValue();
        // Channel info
        final String bottomMenu = layer.doesExist() ? layer.getName(12) : "";
        final ColorEx bottomMenuColor = layer.getColor();
        final boolean isBottomMenuOn = layer.isSelected();
        if (layer.isSelected()) {
            final IValueChanger valueChanger = this.model.getValueChanger();
            final boolean enableVUMeters = config.isEnableVUMeters();
            final int vuR = valueChanger.toDisplayValue(enableVUMeters ? layer.getVuRight() : 0);
            final int vuL = valueChanger.toDisplayValue(enableVUMeters ? layer.getVuLeft() : 0);
            display.addChannelElement(topMenu, isTopMenuOn, bottomMenu, ChannelType.LAYER, bottomMenuColor, isBottomMenuOn, valueChanger.toDisplayValue(layer.getVolume()), valueChanger.toDisplayValue(layer.getModulatedVolume()), this.isKnobTouched[0] ? layer.getVolumeStr(8) : "", valueChanger.toDisplayValue(layer.getPan()), valueChanger.toDisplayValue(layer.getModulatedPan()), this.isKnobTouched[1] ? layer.getPanStr(8) : "", vuL, vuR, layer.isMute(), layer.isSolo(), false, layer.isActivated(), 0, false);
        } else if (sendsIndex == i && l.isPresent()) {
            final ITrackBank fxTrackBank = this.model.getEffectTrackBank();
            final SendData[] sendData = new SendData[4];
            for (int j = 0; j < 4; j++) {
                final int sendOffset = config.isSendsAreToggled() ? 4 : 0;
                final int sendPos = sendOffset + j;
                final ISend send = l.get().getSendBank().getItem(sendPos);
                final boolean doesExist = send.doesExist();
                sendData[j] = new SendData(fxTrackBank == null ? send.getName() : fxTrackBank.getItem(sendPos).getName(), doesExist && this.isKnobTouched[4 + j] ? send.getDisplayedValue() : "", doesExist ? send.getValue() : 0, doesExist ? send.getModulatedValue() : 0, true);
            }
            display.addSendsElement(topMenu, isTopMenuOn, layer.doesExist() ? layer.getName() : "", ChannelType.LAYER, this.bank.getItem(offset + i).getColor(), layer.isSelected(), sendData, true, l.get().isActivated(), layer.isActivated());
        } else
            display.addChannelSelectorElement(topMenu, isTopMenuOn, bottomMenu, ChannelType.LAYER, bottomMenuColor, isBottomMenuOn, layer.isActivated());
    }
}
Also used : PushConfiguration(de.mossgrabers.controller.ableton.push.PushConfiguration) IChannel(de.mossgrabers.framework.daw.data.IChannel) IValueChanger(de.mossgrabers.framework.controller.valuechanger.IValueChanger) ITrackBank(de.mossgrabers.framework.daw.data.bank.ITrackBank) ColorEx(de.mossgrabers.framework.controller.color.ColorEx) ISend(de.mossgrabers.framework.daw.data.ISend) SendData(de.mossgrabers.framework.graphics.canvas.utils.SendData)

Example 25 with PushConfiguration

use of de.mossgrabers.controller.ableton.push.PushConfiguration in project DrivenByMoss by git-moss.

the class AddTrackMode method updateDisplay2.

/**
 * {@inheritDoc}
 */
@Override
public void updateDisplay2(final IGraphicDisplay display) {
    final PushConfiguration conf = this.surface.getConfiguration();
    display.addOptionElement("Instrument", STR_EMPTY, false, ColorEx.YELLOW, "Audio", STR_EMPTY, false, ColorEx.GREEN, false, false);
    Optional<IDeviceMetadata> instrFav = conf.getInstrumentFavorite(0);
    Optional<IDeviceMetadata> audioFav = conf.getAudioFavorite(0);
    display.addOptionElement("", instrFav.isEmpty() ? "" : instrFav.get().name(), false, "", audioFav.isEmpty() ? "" : audioFav.get().name(), false, false);
    instrFav = conf.getInstrumentFavorite(1);
    audioFav = conf.getAudioFavorite(1);
    display.addOptionElement("", instrFav.isEmpty() ? "" : instrFav.get().name(), false, "", audioFav.isEmpty() ? "" : audioFav.get().name(), false, false);
    instrFav = conf.getInstrumentFavorite(2);
    audioFav = conf.getAudioFavorite(2);
    display.addOptionElement("", instrFav.isEmpty() ? "" : instrFav.get().name(), false, "", audioFav.isEmpty() ? "" : audioFav.get().name(), false, false);
    instrFav = conf.getInstrumentFavorite(3);
    display.addOptionElement("", instrFav.isEmpty() ? "" : instrFav.get().name(), false, null, "Effect", STR_EMPTY, false, ColorEx.BLUE, false, false);
    instrFav = conf.getInstrumentFavorite(4);
    Optional<IDeviceMetadata> effectFavorite = conf.getEffectFavorite(0);
    display.addOptionElement("", instrFav.isEmpty() ? "" : instrFav.get().name(), false, "", effectFavorite.isEmpty() ? "" : effectFavorite.get().name(), false, false);
    instrFav = conf.getInstrumentFavorite(5);
    effectFavorite = conf.getEffectFavorite(1);
    display.addOptionElement("", instrFav.isEmpty() ? "" : instrFav.get().name(), false, "", effectFavorite.isEmpty() ? "" : effectFavorite.get().name(), false, false);
    instrFav = conf.getInstrumentFavorite(6);
    effectFavorite = conf.getEffectFavorite(2);
    display.addOptionElement("", instrFav.isEmpty() ? "" : instrFav.get().name(), false, "", effectFavorite.isEmpty() ? "" : effectFavorite.get().name(), false, false);
}
Also used : PushConfiguration(de.mossgrabers.controller.ableton.push.PushConfiguration) IDeviceMetadata(de.mossgrabers.framework.daw.data.IDeviceMetadata)

Aggregations

PushConfiguration (de.mossgrabers.controller.ableton.push.PushConfiguration)31 ITrackBank (de.mossgrabers.framework.daw.data.bank.ITrackBank)10 ITrack (de.mossgrabers.framework.daw.data.ITrack)8 ModeManager (de.mossgrabers.framework.featuregroup.ModeManager)6 Modes (de.mossgrabers.framework.mode.Modes)6 IValueChanger (de.mossgrabers.framework.controller.valuechanger.IValueChanger)5 IDeviceMetadata (de.mossgrabers.framework.daw.data.IDeviceMetadata)4 ISend (de.mossgrabers.framework.daw.data.ISend)4 SendData (de.mossgrabers.framework.graphics.canvas.utils.SendData)3 ColorEx (de.mossgrabers.framework.controller.color.ColorEx)2 Resolution (de.mossgrabers.framework.daw.constants.Resolution)2 IChannel (de.mossgrabers.framework.daw.data.IChannel)2 ICursorDevice (de.mossgrabers.framework.daw.data.ICursorDevice)2 ICursorTrack (de.mossgrabers.framework.daw.data.ICursorTrack)2 INoteRepeat (de.mossgrabers.framework.daw.midi.INoteRepeat)2 ArrayList (java.util.ArrayList)2 ISendBank (de.mossgrabers.framework.daw.data.bank.ISendBank)1 ChannelType (de.mossgrabers.framework.daw.resource.ChannelType)1 ViewManager (de.mossgrabers.framework.featuregroup.ViewManager)1