Search in sources :

Example 1 with ICursorTrack

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

the class MasterMode method updateDisplay2.

/**
 * {@inheritDoc}
 */
@Override
public void updateDisplay2(final IGraphicDisplay display) {
    final IMasterTrack master = this.model.getMasterTrack();
    final IProject project = this.model.getProject();
    final IValueChanger valueChanger = this.model.getValueChanger();
    final boolean enableVUMeters = this.surface.getConfiguration().isEnableVUMeters();
    final int vuR = valueChanger.toDisplayValue(enableVUMeters ? master.getVuRight() : 0);
    final int vuL = valueChanger.toDisplayValue(enableVUMeters ? master.getVuLeft() : 0);
    final ICursorTrack cursorTrack = this.model.getCursorTrack();
    display.addChannelElement(TAG_VOLUME, false, master.getName(), ChannelType.MASTER, master.getColor(), master.isSelected(), valueChanger.toDisplayValue(master.getVolume()), valueChanger.toDisplayValue(master.getModulatedVolume()), this.isKnobTouched[0] ? master.getVolumeStr(8) : "", valueChanger.toDisplayValue(master.getPan()), valueChanger.toDisplayValue(master.getModulatedPan()), this.isKnobTouched[1] ? master.getPanStr(8) : "", vuL, vuR, master.isMute(), master.isSolo(), master.isRecArm(), master.isActivated(), 0, master.isSelected() && cursorTrack.isPinned());
    display.addChannelSelectorElement("Pan", false, "", null, ColorEx.BLACK, false, master.isActivated());
    if (this.model.getHost().supports(Capability.CUE_VOLUME)) {
        display.addChannelElement("Cue Volume", false, "Cue", ChannelType.MASTER, ColorEx.GRAY, false, valueChanger.toDisplayValue(project.getCueVolume()), -1, this.isKnobTouched[2] ? project.getCueVolumeStr(8) : "", valueChanger.toDisplayValue(project.getCueMix()), -1, this.isKnobTouched[3] ? project.getCueMixStr(8) : "", 0, 0, false, false, false, true, 0, false);
        display.addChannelSelectorElement("Cue Mix", false, "", null, ColorEx.BLACK, false, true);
    } else {
        display.addOptionElement("", "", false, "", "", false, false);
        display.addOptionElement("", "", false, "", "", false, false);
    }
    display.addOptionElement("", "", false, "Audio Engine", this.model.getApplication().isEngineActive() ? "Active" : "Off", false, false);
    display.addOptionElement("", "", false, "", "", false, false);
    display.addOptionElement("Project:", "", false, this.model.getProject().getName(), "Previous", false, false);
    display.addOptionElement("", "", false, "", "Next", false, false);
}
Also used : IValueChanger(de.mossgrabers.framework.controller.valuechanger.IValueChanger) ICursorTrack(de.mossgrabers.framework.daw.data.ICursorTrack) IMasterTrack(de.mossgrabers.framework.daw.data.IMasterTrack) IProject(de.mossgrabers.framework.daw.IProject)

Example 2 with ICursorTrack

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

the class LaunchkeyMk3SendMode method updateDisplay.

/**
 * {@inheritDoc}
 */
@Override
public void updateDisplay() {
    final ITextDisplay d = this.surface.getTextDisplay();
    final ICursorTrack cursorTrack = this.model.getCursorTrack();
    final String trackText = cursorTrack.doesExist() ? String.format("%d: %s", Integer.valueOf(cursorTrack.getPosition() + 1), cursorTrack.getName()) : "No sel. track";
    final ITrackBank tb = this.model.getCurrentTrackBank();
    if (this.areKnobs) {
        String sendName = tb.getEditSendName(this.sendIndex);
        sendName = StringUtils.optimizeName(sendName.isEmpty() ? "Send " + (this.sendIndex + 1) : sendName, 6);
        d.setCell(LaunchkeyMk3Display.SCREEN_ROW_BASE, 0, sendName + this.formatPageRange(" %d - %d"));
        d.setCell(LaunchkeyMk3Display.SCREEN_ROW_BASE + 1, 0, trackText);
    }
    final int row = this.areKnobs ? LaunchkeyMk3Display.SCREEN_ROW_POTS : LaunchkeyMk3Display.SCREEN_ROW_FADERS;
    // Format track names
    for (int i = 0; i < 8; i++) {
        final ITrack t = tb.getItem(i);
        final ISend s = t.getSendBank().getItem(this.sendIndex);
        final boolean exists = s.doesExist();
        final int offset = i * 2;
        d.setCell(row + offset, 0, exists ? String.format("%d: %s", Integer.valueOf(s.getPosition() + 1), s.getName()) : "No send");
        d.setCell(row + offset + 1, 0, exists ? "S-Vol: " + s.getDisplayedValue() : "");
    }
    // Add master fader
    if (!this.areKnobs) {
        final IMasterTrack masterTrack = this.model.getMasterTrack();
        d.setCell(row + 16, 0, "Master");
        d.setCell(row + 16 + 1, 0, "Vol: " + masterTrack.getVolumeStr());
    }
    d.allDone();
}
Also used : ITrack(de.mossgrabers.framework.daw.data.ITrack) ITrackBank(de.mossgrabers.framework.daw.data.bank.ITrackBank) ICursorTrack(de.mossgrabers.framework.daw.data.ICursorTrack) ITextDisplay(de.mossgrabers.framework.controller.display.ITextDisplay) ISend(de.mossgrabers.framework.daw.data.ISend) IMasterTrack(de.mossgrabers.framework.daw.data.IMasterTrack)

Example 3 with ICursorTrack

use of de.mossgrabers.framework.daw.data.ICursorTrack 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 4 with ICursorTrack

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

the class APCQuantizeCommand method executeShifted.

/**
 * {@inheritDoc}
 */
@Override
public void executeShifted(final ButtonEvent event) {
    if (event != ButtonEvent.UP)
        return;
    final ICursorTrack cursorTrack = this.model.getCursorTrack();
    final ICursorDevice cursorDevice = this.model.getCursorDevice();
    if (!cursorTrack.doesExist() || !cursorDevice.doesExist())
        return;
    final boolean pinned = cursorDevice.isPinned();
    cursorDevice.togglePinned();
    final boolean cursorTrackPinned = cursorTrack.isPinned();
    if (pinned == cursorTrackPinned)
        cursorTrack.togglePinned();
}
Also used : ICursorTrack(de.mossgrabers.framework.daw.data.ICursorTrack) ICursorDevice(de.mossgrabers.framework.daw.data.ICursorDevice)

Example 5 with ICursorTrack

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

the class ClipModule method execute.

/**
 * {@inheritDoc}
 */
@Override
public void execute(final String command, final LinkedList<String> path, final Object value) throws IllegalParameterException, UnknownCommandException, MissingCommandException {
    if (!"clip".equals(command))
        throw new UnknownCommandException(command);
    final String subCommand = getSubCommand(path);
    if ("stopall".equals(subCommand)) {
        this.model.getTrackBank().stop();
        return;
    }
    // Cursor clip related commands
    final INoteClip cursorClip = this.model.getCursorClip();
    switch(subCommand) {
        case "pinned":
            if (value == null)
                cursorClip.togglePinned();
            else
                cursorClip.setPinned(isTrigger(value));
            return;
        case "quantize":
            if (cursorClip.doesExist())
                cursorClip.quantize(1);
            return;
        default:
            // Fall through
            break;
    }
    // Slot bank related commands
    final ICursorTrack cursorTrack = this.model.getCursorTrack();
    if (!cursorTrack.doesExist())
        return;
    if ("stop".equals(subCommand)) {
        cursorTrack.stop();
        return;
    }
    final ISlotBank slotBank = cursorTrack.getSlotBank();
    switch(subCommand) {
        case "+":
            slotBank.selectNextItem();
            return;
        case "-":
            slotBank.selectPreviousItem();
            return;
        default:
            // Fall through
            break;
    }
    final Optional<ISlot> selectedSlotOptional = slotBank.getSelectedItem();
    if (selectedSlotOptional.isEmpty())
        return;
    final ISlot selectedSlot = selectedSlotOptional.get();
    switch(subCommand) {
        case "launch":
            selectedSlot.launch();
            return;
        case "record":
            this.model.recordNoteClip(cursorTrack, selectedSlot);
            return;
        case "create":
            this.model.createNoteClip(cursorTrack, selectedSlot, toInteger(value), true);
            return;
        default:
            throw new UnknownCommandException(command);
    }
}
Also used : ISlotBank(de.mossgrabers.framework.daw.data.bank.ISlotBank) ICursorTrack(de.mossgrabers.framework.daw.data.ICursorTrack) UnknownCommandException(de.mossgrabers.controller.osc.exception.UnknownCommandException) ISlot(de.mossgrabers.framework.daw.data.ISlot) INoteClip(de.mossgrabers.framework.daw.INoteClip)

Aggregations

ICursorTrack (de.mossgrabers.framework.daw.data.ICursorTrack)12 ITrackBank (de.mossgrabers.framework.daw.data.bank.ITrackBank)7 ITrack (de.mossgrabers.framework.daw.data.ITrack)5 ITextDisplay (de.mossgrabers.framework.controller.display.ITextDisplay)4 IMasterTrack (de.mossgrabers.framework.daw.data.IMasterTrack)4 IValueChanger (de.mossgrabers.framework.controller.valuechanger.IValueChanger)3 PushConfiguration (de.mossgrabers.controller.ableton.push.PushConfiguration)2 ISend (de.mossgrabers.framework.daw.data.ISend)2 FlexiHandlerException (de.mossgrabers.controller.generic.flexihandler.utils.FlexiHandlerException)1 UnknownCommandException (de.mossgrabers.controller.osc.exception.UnknownCommandException)1 ColorEx (de.mossgrabers.framework.controller.color.ColorEx)1 INoteClip (de.mossgrabers.framework.daw.INoteClip)1 IProject (de.mossgrabers.framework.daw.IProject)1 ICursorDevice (de.mossgrabers.framework.daw.data.ICursorDevice)1 IParameter (de.mossgrabers.framework.daw.data.IParameter)1 ISlot (de.mossgrabers.framework.daw.data.ISlot)1 IParameterBank (de.mossgrabers.framework.daw.data.bank.IParameterBank)1 ISlotBank (de.mossgrabers.framework.daw.data.bank.ISlotBank)1 SendData (de.mossgrabers.framework.graphics.canvas.utils.SendData)1