Search in sources :

Example 16 with PushConfiguration

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

the class TouchstripCommand method updateValue.

/**
 * {@inheritDoc}
 */
@Override
public void updateValue() {
    if (this.surface.getViewManager().isActive(Views.SESSION)) {
        this.surface.setRibbonValue(this.model.getValueChanger().toMidiValue(this.model.getTransport().getCrossfade()));
        return;
    }
    final PushConfiguration config = this.surface.getConfiguration();
    // Check if Note Repeat is active and its settings should be changed
    final int ribbonNoteRepeat = config.getRibbonNoteRepeat();
    if (config.isNoteRepeatActive() && ribbonNoteRepeat > PushConfiguration.NOTE_REPEAT_OFF) {
        final Resolution[] values = Resolution.values();
        final INoteRepeat noteRepeat = this.surface.getMidiInput().getDefaultNoteInput().getNoteRepeat();
        final double value = ribbonNoteRepeat == PushConfiguration.NOTE_REPEAT_PERIOD ? noteRepeat.getPeriod() : noteRepeat.getNoteLength();
        final int index = Resolution.getMatch(value);
        this.surface.setRibbonValue(127 - (int) Math.round(index * 127.0 / (values.length - 1)));
        return;
    }
    switch(config.getRibbonMode()) {
        case PushConfiguration.RIBBON_MODE_CC:
            this.surface.setRibbonValue(this.pitchValue);
            break;
        case PushConfiguration.RIBBON_MODE_FADER:
            final ITrack t = this.model.getCursorTrack();
            this.surface.setRibbonValue(this.model.getValueChanger().toMidiValue(t.getVolume()));
            break;
        default:
            this.surface.setRibbonValue(64);
            break;
    }
}
Also used : PushConfiguration(de.mossgrabers.controller.ableton.push.PushConfiguration) INoteRepeat(de.mossgrabers.framework.daw.midi.INoteRepeat) ITrack(de.mossgrabers.framework.daw.data.ITrack) Resolution(de.mossgrabers.framework.daw.constants.Resolution)

Example 17 with PushConfiguration

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

the class TrackMode method updateDisplay2.

/**
 * {@inheritDoc}
 */
@Override
public void updateDisplay2(final IGraphicDisplay display) {
    final ITrackBank tb = this.model.getCurrentTrackBank();
    final Optional<ITrack> selectedTrack = tb.getSelectedItem();
    // Get the index at which to draw the Sends element
    final int selectedIndex = selectedTrack.isEmpty() ? -1 : selectedTrack.get().getIndex();
    int sendsIndex = selectedTrack.isEmpty() || this.model.isEffectTrackBankActive() ? -1 : selectedTrack.get().getIndex() + 1;
    if (sendsIndex == 8)
        sendsIndex = 6;
    this.updateMenuItems(0);
    final ICursorTrack cursorTrack = this.model.getCursorTrack();
    final PushConfiguration config = this.surface.getConfiguration();
    for (int i = 0; i < 8; i++) {
        final ITrack t = tb.getItem(i);
        // The menu item
        final Pair<String, Boolean> pair = this.menu.get(i);
        final String topMenu = pair.getKey();
        final boolean topMenuSelected = pair.getValue().booleanValue();
        // Channel info
        final String bottomMenu = t.doesExist() ? t.getName() : "";
        final ColorEx bottomMenuColor = t.getColor();
        final boolean isBottomMenuOn = t.isSelected();
        final IValueChanger valueChanger = this.model.getValueChanger();
        if (t.isSelected()) {
            final int crossfadeMode = this.getCrossfadeModeAsNumber(t);
            final boolean enableVUMeters = config.isEnableVUMeters();
            final int vuR = valueChanger.toDisplayValue(enableVUMeters ? t.getVuRight() : 0);
            final int vuL = valueChanger.toDisplayValue(enableVUMeters ? t.getVuLeft() : 0);
            display.addChannelElement(topMenu, topMenuSelected, bottomMenu, this.updateType(t), bottomMenuColor, isBottomMenuOn, valueChanger.toDisplayValue(t.getVolume()), valueChanger.toDisplayValue(t.getModulatedVolume()), this.isKnobTouched[0] ? t.getVolumeStr(8) : "", valueChanger.toDisplayValue(t.getPan()), valueChanger.toDisplayValue(t.getModulatedPan()), this.isKnobTouched[1] ? t.getPanStr(8) : "", vuL, vuR, t.isMute(), t.isSolo(), t.isRecArm(), t.isActivated(), crossfadeMode, cursorTrack.isPinned());
        } else if (sendsIndex == i) {
            final ITrack selTrack = tb.getItem(selectedIndex);
            final SendData[] sendData = new SendData[4];
            for (int j = 0; j < 4; j++) {
                if (selTrack != null) {
                    final int sendOffset = config.isSendsAreToggled() ? 4 : 0;
                    final int sendPos = sendOffset + j;
                    final ISend send = selTrack.getSendBank().getItem(sendPos);
                    if (send != null) {
                        final boolean exists = send.doesExist();
                        sendData[j] = new SendData(send.getName(), exists && this.isKnobTouched[4 + j] ? send.getDisplayedValue(8) : "", valueChanger.toDisplayValue(exists ? send.getValue() : 0), valueChanger.toDisplayValue(exists ? send.getModulatedValue() : 0), true);
                        continue;
                    }
                }
                sendData[j] = new SendData("", "", 0, 0, true);
            }
            display.addSendsElement(topMenu, topMenuSelected, bottomMenu, this.updateType(t), bottomMenuColor, isBottomMenuOn, sendData, true, selTrack == null || selTrack.isActivated(), t.isActivated());
        } else
            display.addChannelSelectorElement(topMenu, topMenuSelected, bottomMenu, this.updateType(t), bottomMenuColor, isBottomMenuOn, t.isActivated());
    }
}
Also used : PushConfiguration(de.mossgrabers.controller.ableton.push.PushConfiguration) ITrack(de.mossgrabers.framework.daw.data.ITrack) ITrackBank(de.mossgrabers.framework.daw.data.bank.ITrackBank) ColorEx(de.mossgrabers.framework.controller.color.ColorEx) ICursorTrack(de.mossgrabers.framework.daw.data.ICursorTrack) IValueChanger(de.mossgrabers.framework.controller.valuechanger.IValueChanger) ISend(de.mossgrabers.framework.daw.data.ISend) SendData(de.mossgrabers.framework.graphics.canvas.utils.SendData)

Example 18 with PushConfiguration

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

the class DeviceLayerModeSend method updateDisplayElements.

/**
 * {@inheritDoc}
 */
@Override
public void updateDisplayElements(final IGraphicDisplay display, final Optional<ILayer> l) {
    this.updateMenuItems(5 + this.sendIndex % 4);
    final PushConfiguration config = this.surface.getConfiguration();
    // Drum Pad Bank has size of 16, layers only 8
    final int offset = this.getDrumPadIndex();
    final int sendOffset = config.isSendsAreToggled() ? 4 : 0;
    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 SendData[] sendData = new SendData[4];
        for (int j = 0; j < 4; j++) {
            final int sendPos = sendOffset + j;
            final ISend send = layer.getSendBank().getItem(sendPos);
            final boolean exists = send.doesExist();
            sendData[j] = new SendData(send.getName(), exists && this.sendIndex == sendPos && this.isKnobTouched[i] ? send.getDisplayedValue() : "", exists ? send.getValue() : 0, exists ? send.getModulatedValue() : 0, this.sendIndex == sendPos);
        }
        display.addSendsElement(topMenu, isTopMenuOn, layer.doesExist() ? layer.getName() : "", ChannelType.LAYER, this.bank.getItem(offset + i).getColor(), layer.isSelected(), sendData, false, layer.isActivated(), layer.isActivated());
    }
}
Also used : PushConfiguration(de.mossgrabers.controller.ableton.push.PushConfiguration) IChannel(de.mossgrabers.framework.daw.data.IChannel) ISend(de.mossgrabers.framework.daw.data.ISend) SendData(de.mossgrabers.framework.graphics.canvas.utils.SendData)

Example 19 with PushConfiguration

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

the class AbstractTrackMode method updateMenuItems.

protected void updateMenuItems(final int selectedMenu) {
    if (this.surface.isPressed(ButtonID.STOP_CLIP)) {
        this.updateStopMenu();
        return;
    }
    final PushConfiguration config = this.surface.getConfiguration();
    if (config.isMuteLongPressed() || config.isMuteSoloLocked() && config.isMuteState())
        this.updateMuteMenu();
    else if (config.isSoloLongPressed() || config.isMuteSoloLocked() && config.isSoloState())
        this.updateSoloMenu();
    else
        this.updateTrackMenu(selectedMenu);
}
Also used : PushConfiguration(de.mossgrabers.controller.ableton.push.PushConfiguration)

Example 20 with PushConfiguration

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

the class AbstractTrackMode method updateChannelDisplay.

// Push 2
// Called from sub-classes
protected void updateChannelDisplay(final IGraphicDisplay display, final int selectedMenu, final boolean isVolume, final boolean isPan) {
    this.updateMenuItems(selectedMenu);
    final IValueChanger valueChanger = this.model.getValueChanger();
    final ITrackBank tb = this.model.getCurrentTrackBank();
    final PushConfiguration config = this.surface.getConfiguration();
    final ICursorTrack cursorTrack = this.model.getCursorTrack();
    for (int i = 0; i < 8; i++) {
        final ITrack t = tb.getItem(i);
        final Pair<String, Boolean> pair = this.menu.get(i);
        final String topMenu = pair.getKey();
        final boolean isTopMenuOn = pair.getValue().booleanValue();
        final int crossfadeMode = this.getCrossfadeModeAsNumber(t);
        final boolean enableVUMeters = config.isEnableVUMeters();
        final int vuR = valueChanger.toDisplayValue(enableVUMeters ? t.getVuRight() : 0);
        final int vuL = valueChanger.toDisplayValue(enableVUMeters ? t.getVuLeft() : 0);
        display.addChannelElement(selectedMenu, topMenu, isTopMenuOn, t.doesExist() ? t.getName(12) : "", this.updateType(t), t.getColor(), t.isSelected(), valueChanger.toDisplayValue(t.getVolume()), valueChanger.toDisplayValue(t.getModulatedVolume()), isVolume && this.isKnobTouched[i] ? t.getVolumeStr(8) : "", valueChanger.toDisplayValue(t.getPan()), valueChanger.toDisplayValue(t.getModulatedPan()), isPan && this.isKnobTouched[i] ? t.getPanStr(8) : "", vuL, vuR, t.isMute(), t.isSolo(), t.isRecArm(), t.isActivated(), crossfadeMode, t.isSelected() && cursorTrack.isPinned());
    }
}
Also used : PushConfiguration(de.mossgrabers.controller.ableton.push.PushConfiguration) ITrack(de.mossgrabers.framework.daw.data.ITrack) IValueChanger(de.mossgrabers.framework.controller.valuechanger.IValueChanger) ITrackBank(de.mossgrabers.framework.daw.data.bank.ITrackBank) ICursorTrack(de.mossgrabers.framework.daw.data.ICursorTrack)

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