Search in sources :

Example 6 with IValueChanger

use of de.mossgrabers.framework.controller.IValueChanger in project DrivenByMoss by git-moss.

the class AbstractTrackMode method updateChannelDisplay.

// Push 2
// Called from sub-classes
protected void updateChannelDisplay(final int selectedMenu, final boolean isVolume, final boolean isPan) {
    this.updateTrackMenu();
    final PushConfiguration config = this.surface.getConfiguration();
    final PushDisplay display = (PushDisplay) this.surface.getDisplay();
    final DisplayMessage message = display.createMessage();
    final IValueChanger valueChanger = this.model.getValueChanger();
    final IChannelBank tb = this.model.getCurrentTrackBank();
    final boolean displayCrossfader = config.isDisplayCrossfader();
    for (int i = 0; i < 8; i++) {
        final ITrack t = tb.getTrack(i);
        // The menu item
        String topMenu;
        boolean isTopMenuOn;
        if (this.surface.isPressed(PushControlSurface.PUSH_BUTTON_CLIP_STOP) && this.model.getHost().hasClips()) {
            topMenu = t.doesExist() ? "Stop Clip" : "";
            isTopMenuOn = t.isPlaying();
        } else if (config.isMuteLongPressed() || config.isMuteSoloLocked() && config.isMuteState()) {
            topMenu = t.doesExist() ? "Mute" : "";
            isTopMenuOn = t.isMute();
        } else if (config.isSoloLongPressed() || config.isMuteSoloLocked() && config.isSoloState()) {
            topMenu = t.doesExist() ? "Solo" : "";
            isTopMenuOn = t.isSolo();
        } else {
            topMenu = this.menu[i];
            isTopMenuOn = i == selectedMenu - 1 || i == 7 && tb instanceof ITrackBank && ((ITrackBank) tb).hasParent();
        }
        final int crossfadeMode = displayCrossfader ? t.getCrossfadeModeAsNumber() : -1;
        message.addChannelElement(selectedMenu, topMenu, isTopMenuOn, t.doesExist() ? t.getName(12) : "", t.getType(), 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() : "", valueChanger.toDisplayValue(config.isEnableVUMeters() ? t.getVu() : 0), t.isMute(), t.isSolo(), t.isRecArm(), crossfadeMode);
    }
    display.send(message);
}
Also used : PushConfiguration(de.mossgrabers.push.PushConfiguration) ITrack(de.mossgrabers.framework.daw.data.ITrack) IValueChanger(de.mossgrabers.framework.controller.IValueChanger) ITrackBank(de.mossgrabers.framework.daw.ITrackBank) PushDisplay(de.mossgrabers.push.controller.PushDisplay) IChannelBank(de.mossgrabers.framework.daw.IChannelBank) DisplayMessage(de.mossgrabers.push.controller.DisplayMessage)

Example 7 with IValueChanger

use of de.mossgrabers.framework.controller.IValueChanger in project DrivenByMoss by git-moss.

the class SendMode method updateDisplay2.

/**
 * {@inheritDoc}
 */
@Override
public void updateDisplay2() {
    this.updateTrackMenu();
    final int sendIndex = this.getCurrentSendIndex();
    final IChannelBank tb = this.model.getCurrentTrackBank();
    final IChannelBank fxTrackBank = this.model.getEffectTrackBank();
    final PushConfiguration config = this.surface.getConfiguration();
    final PushDisplay display = (PushDisplay) this.surface.getDisplay();
    final DisplayMessage message = display.createMessage();
    final int sendOffset = config.isSendsAreToggled() ? 4 : 0;
    for (int i = 0; i < 8; i++) {
        final ITrack t = tb.getTrack(i);
        // The menu item
        String topMenu;
        boolean topMenuSelected;
        if (this.surface.isPressed(PushControlSurface.PUSH_BUTTON_CLIP_STOP)) {
            topMenu = t.doesExist() ? "Stop Clip" : "";
            topMenuSelected = t.isPlaying();
        } else if (config.isMuteLongPressed() || config.isMuteSoloLocked() && config.isMuteState()) {
            topMenu = t.doesExist() ? "Mute" : "";
            topMenuSelected = t.isMute();
        } else if (config.isSoloLongPressed() || config.isMuteSoloLocked() && config.isSoloState()) {
            topMenu = t.doesExist() ? "Solo" : "";
            topMenuSelected = t.isSolo();
        } else {
            topMenu = this.menu[i];
            topMenuSelected = i > 3 && i - 4 + sendOffset == sendIndex || i == 7 && tb instanceof ITrackBank && ((ITrackBank) tb).hasParent();
        }
        final IValueChanger valueChanger = this.model.getValueChanger();
        final String[] sendName = new String[4];
        final String[] valueStr = new String[4];
        final int[] value = new int[4];
        final int[] modulatedValue = new int[4];
        final boolean[] selected = new boolean[4];
        for (int j = 0; j < 4; j++) {
            final int sendPos = sendOffset + j;
            final ISend send = t.getSend(sendPos);
            sendName[j] = fxTrackBank == null ? send.getName() : fxTrackBank.getTrack(sendPos).getName();
            valueStr[j] = send != null && sendIndex == sendPos && this.isKnobTouched[i] ? send.getDisplayedValue(8) : "";
            value[j] = valueChanger.toDisplayValue(send != null ? send.getValue() : -1);
            modulatedValue[j] = valueChanger.toDisplayValue(send != null ? send.getModulatedValue() : -1);
            selected[j] = sendIndex == sendPos;
        }
        message.addSendsElement(topMenu, topMenuSelected, t.doesExist() ? t.getName() : "", t.getType(), t.getColor(), t.isSelected(), sendName, valueStr, value, modulatedValue, selected, false);
    }
    display.send(message);
}
Also used : PushConfiguration(de.mossgrabers.push.PushConfiguration) ITrack(de.mossgrabers.framework.daw.data.ITrack) ITrackBank(de.mossgrabers.framework.daw.ITrackBank) IValueChanger(de.mossgrabers.framework.controller.IValueChanger) IChannelBank(de.mossgrabers.framework.daw.IChannelBank) PushDisplay(de.mossgrabers.push.controller.PushDisplay) ISend(de.mossgrabers.framework.daw.data.ISend) DisplayMessage(de.mossgrabers.push.controller.DisplayMessage)

Example 8 with IValueChanger

use of de.mossgrabers.framework.controller.IValueChanger in project DrivenByMoss by git-moss.

the class TrackMode method updateDisplay2.

/**
 * {@inheritDoc}
 */
@Override
public void updateDisplay2() {
    final IChannelBank tb = this.model.getCurrentTrackBank();
    final ITrack selectedTrack = tb.getSelectedTrack();
    // Get the index at which to draw the Sends element
    final int selectedIndex = selectedTrack == null ? -1 : selectedTrack.getIndex();
    int sendsIndex = selectedTrack == null || this.model.isEffectTrackBankActive() ? -1 : selectedTrack.getIndex() + 1;
    if (sendsIndex == 8)
        sendsIndex = 6;
    this.updateTrackMenu();
    final PushConfiguration config = this.surface.getConfiguration();
    final PushDisplay display = (PushDisplay) this.surface.getDisplay();
    final DisplayMessage message = display.createMessage();
    final boolean displayCrossfader = config.isDisplayCrossfader();
    for (int i = 0; i < 8; i++) {
        final ITrack t = tb.getTrack(i);
        // The menu item
        String topMenu;
        boolean topMenuSelected;
        if (this.surface.isPressed(PushControlSurface.PUSH_BUTTON_CLIP_STOP) && this.model.getHost().hasClips()) {
            topMenu = t.doesExist() ? "Stop Clip" : "";
            topMenuSelected = t.isPlaying();
        } else if (config.isMuteLongPressed() || config.isMuteSoloLocked() && config.isMuteState()) {
            topMenu = t.doesExist() ? "Mute" : "";
            topMenuSelected = t.isMute();
        } else if (config.isSoloLongPressed() || config.isMuteSoloLocked() && config.isSoloState()) {
            topMenu = t.doesExist() ? "Solo" : "";
            topMenuSelected = t.isSolo();
        } else {
            topMenu = this.menu[i];
            topMenuSelected = i == 7 && tb instanceof ITrackBank && ((ITrackBank) tb).hasParent();
        }
        // Channel info
        final String bottomMenu = t.doesExist() ? t.getName() : "";
        final double[] bottomMenuColor = t.getColor();
        final boolean isBottomMenuOn = t.isSelected();
        final IValueChanger valueChanger = this.model.getValueChanger();
        if (t.isSelected()) {
            final int crossfadeMode = displayCrossfader ? t.getCrossfadeModeAsNumber() : -1;
            message.addChannelElement(topMenu, topMenuSelected, bottomMenu, t.getType(), 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) : "", valueChanger.toDisplayValue(config.isEnableVUMeters() ? t.getVu() : 0), t.isMute(), t.isSolo(), t.isRecArm(), crossfadeMode);
        } else if (sendsIndex == i) {
            final IChannelBank fxTrackBank = this.model.getEffectTrackBank();
            final ITrack selTrack = tb.getTrack(selectedIndex);
            final String[] sendName = new String[4];
            final String[] valueStr = new String[4];
            final int[] value = new int[4];
            final int[] modulatedValue = new int[4];
            final boolean[] selected = new boolean[4];
            for (int j = 0; j < 4; j++) {
                final int sendOffset = config.isSendsAreToggled() ? 4 : 0;
                final int sendPos = sendOffset + j;
                selected[j] = true;
                sendName[j] = "";
                valueStr[j] = "";
                value[j] = 0;
                if (selTrack == null)
                    continue;
                final ISend send = selTrack.getSend(sendPos);
                if (send == null)
                    continue;
                sendName[j] = fxTrackBank == null ? send.getName() : fxTrackBank.getTrack(sendPos).getName();
                valueStr[j] = send.doesExist() && this.isKnobTouched[4 + j] ? send.getDisplayedValue(8) : "";
                value[j] = valueChanger.toDisplayValue(send.doesExist() ? send.getValue() : 0);
                modulatedValue[j] = valueChanger.toDisplayValue(send.doesExist() ? send.getModulatedValue() : 0);
            }
            message.addSendsElement(topMenu, topMenuSelected, bottomMenu, t.getType(), bottomMenuColor, isBottomMenuOn, sendName, valueStr, value, modulatedValue, selected, true);
        } else
            message.addChannelSelectorElement(topMenu, topMenuSelected, bottomMenu, t.getType(), bottomMenuColor, isBottomMenuOn);
    }
    display.send(message);
}
Also used : PushConfiguration(de.mossgrabers.push.PushConfiguration) ITrack(de.mossgrabers.framework.daw.data.ITrack) ITrackBank(de.mossgrabers.framework.daw.ITrackBank) IValueChanger(de.mossgrabers.framework.controller.IValueChanger) IChannelBank(de.mossgrabers.framework.daw.IChannelBank) PushDisplay(de.mossgrabers.push.controller.PushDisplay) ISend(de.mossgrabers.framework.daw.data.ISend) DisplayMessage(de.mossgrabers.push.controller.DisplayMessage)

Example 9 with IValueChanger

use of de.mossgrabers.framework.controller.IValueChanger in project DrivenByMoss by git-moss.

the class AccentMode method updateDisplay2.

/**
 * {@inheritDoc}
 */
@Override
public void updateDisplay2() {
    final int fixedAccentValue = this.surface.getConfiguration().getFixedAccentValue();
    final IValueChanger valueChanger = this.model.getValueChanger();
    final PushDisplay display = (PushDisplay) this.surface.getDisplay();
    final DisplayMessage message = display.createMessage();
    for (int i = 0; i < 8; i++) message.addParameterElement(i == 7 ? "Accent" : "", i == 7 ? valueChanger.toDisplayValue(valueChanger.toDAWValue(fixedAccentValue)) : 0, i == 7 ? Integer.toString(fixedAccentValue) : "", this.isKnobTouched[i], -1);
    display.send(message);
}
Also used : IValueChanger(de.mossgrabers.framework.controller.IValueChanger) PushDisplay(de.mossgrabers.push.controller.PushDisplay) DisplayMessage(de.mossgrabers.push.controller.DisplayMessage)

Example 10 with IValueChanger

use of de.mossgrabers.framework.controller.IValueChanger in project DrivenByMoss by git-moss.

the class AccentMode method onValueKnob.

/**
 * {@inheritDoc}
 */
@Override
public void onValueKnob(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.setAccentValue(Math.max(1, valueChanger.changeValue(value, fixedAccentValue, 1, 128)));
}
Also used : PushConfiguration(de.mossgrabers.push.PushConfiguration) IValueChanger(de.mossgrabers.framework.controller.IValueChanger)

Aggregations

IValueChanger (de.mossgrabers.framework.controller.IValueChanger)11 PushDisplay (de.mossgrabers.push.controller.PushDisplay)7 PushConfiguration (de.mossgrabers.push.PushConfiguration)6 DisplayMessage (de.mossgrabers.push.controller.DisplayMessage)6 IChannelBank (de.mossgrabers.framework.daw.IChannelBank)5 ITrackBank (de.mossgrabers.framework.daw.ITrackBank)3 ISend (de.mossgrabers.framework.daw.data.ISend)3 ITrack (de.mossgrabers.framework.daw.data.ITrack)3 IChannel (de.mossgrabers.framework.daw.data.IChannel)2 Display (de.mossgrabers.framework.controller.display.Display)1 ICursorDevice (de.mossgrabers.framework.daw.ICursorDevice)1 IMasterTrack (de.mossgrabers.framework.daw.data.IMasterTrack)1 IParameter (de.mossgrabers.framework.daw.data.IParameter)1