Search in sources :

Example 16 with ITrack

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

the class MCUControllerSetup method updateVUandFaders.

private void updateVUandFaders() {
    final double upperBound = this.valueChanger.getUpperBound();
    final boolean enableVUMeters = this.configuration.isEnableVUMeters();
    final boolean hasMotorFaders = this.configuration.hasMotorFaders();
    final IChannelBank tb = this.model.getCurrentTrackBank();
    IMidiOutput output;
    for (int index = 0; index < this.numMCUDevices; index++) {
        final MCUControlSurface surface = this.getSurface(index);
        output = surface.getOutput();
        final int extenderOffset = surface.getExtenderOffset();
        for (int i = 0; i < 8; i++) {
            final int channel = extenderOffset + i;
            final ITrack track = tb.getTrack(channel);
            // Update VU LEDs of channel
            if (enableVUMeters) {
                final int vu = track.getVu();
                if (vu != this.vuValues[channel]) {
                    this.vuValues[channel] = vu;
                    final int scaledValue = (int) Math.round(vu * 12 / upperBound);
                    output.sendChannelAftertouch(0x10 * i + scaledValue, 0);
                }
            }
            // Update motor fader of channel
            if (hasMotorFaders)
                this.updateFaders(output, i, channel, track);
        }
    }
    final IMasterTrack masterTrack = this.model.getMasterTrack();
    final MCUControlSurface surface = this.getSurface();
    output = surface.getOutput();
    // Stereo VU of master channel
    if (enableVUMeters) {
        int vu = masterTrack.getVuLeft();
        if (vu != this.masterVuValues[0]) {
            this.masterVuValues[0] = vu;
            final int scaledValue = (int) Math.round(vu * 12 / upperBound);
            output.sendChannelAftertouch(1, scaledValue, 0);
        }
        vu = masterTrack.getVuRight();
        if (vu != this.masterVuValues[1]) {
            this.masterVuValues[1] = vu;
            final int scaledValue = (int) Math.round(vu * 12 / upperBound);
            output.sendChannelAftertouch(1, 0x10 + scaledValue, 0);
        }
    }
    // Update motor fader of master channel
    if (hasMotorFaders) {
        final int volume = surface.isShiftPressed() ? this.model.getTransport().getMetronomeVolume() : masterTrack.getVolume();
        if (volume != this.masterFaderValue) {
            this.masterFaderValue = volume;
            output.sendPitchbend(8, volume % 127, volume / 127);
        }
    }
}
Also used : IMidiOutput(de.mossgrabers.framework.daw.midi.IMidiOutput) ITrack(de.mossgrabers.framework.daw.data.ITrack) IChannelBank(de.mossgrabers.framework.daw.IChannelBank) MCUControlSurface(de.mossgrabers.mcu.controller.MCUControlSurface) IMasterTrack(de.mossgrabers.framework.daw.data.IMasterTrack)

Example 17 with ITrack

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

the class MCUControllerSetup method updateIndication.

private void updateIndication(final Integer mode) {
    final ITrackBank tb = this.model.getTrackBank();
    final IChannelBank tbe = this.model.getEffectTrackBank();
    final boolean isEffect = this.model.isEffectTrackBankActive();
    final boolean isPan = Modes.MODE_PAN.equals(mode);
    final boolean isTrack = Modes.MODE_TRACK.equals(mode);
    final boolean isDevice = Modes.MODE_DEVICE_PARAMS.equals(mode);
    tb.setIndication(!isEffect);
    tbe.setIndication(isEffect);
    final ICursorDevice cursorDevice = this.model.getCursorDevice();
    final ITrack selectedTrack = tb.getSelectedTrack();
    for (int i = 0; i < tb.getNumTracks(); i++) {
        final boolean hasTrackSel = selectedTrack != null && selectedTrack.getIndex() == i && isTrack;
        final ITrack track = tb.getTrack(i);
        track.setVolumeIndication(!isEffect && (isTrack || hasTrackSel));
        track.setPanIndication(!isEffect && (isPan || hasTrackSel));
        for (int j = 0; j < tb.getNumSends(); j++) track.getSend(j).setIndication(!isEffect && (mode.intValue() - Modes.MODE_SEND1.intValue() == j || hasTrackSel));
        final ITrack fxTrack = tbe.getTrack(i);
        fxTrack.setVolumeIndication(isEffect);
        fxTrack.setPanIndication(isEffect && isPan);
    }
    for (int i = 0; i < cursorDevice.getNumParameters(); i++) cursorDevice.indicateParameter(i, isDevice);
}
Also used : ITrack(de.mossgrabers.framework.daw.data.ITrack) ITrackBank(de.mossgrabers.framework.daw.ITrackBank) IChannelBank(de.mossgrabers.framework.daw.IChannelBank) ICursorDevice(de.mossgrabers.framework.daw.ICursorDevice)

Example 18 with ITrack

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

the class LaunchpadControllerSetup method handleTrackChange.

/**
 * Handle a track selection change.
 *
 * @param index The index of the track
 * @param isSelected Has the track been selected?
 */
private void handleTrackChange(final int index, final boolean isSelected) {
    if (!isSelected)
        return;
    // Recall last used view (if we are not in session mode)
    final ViewManager viewManager = this.getSurface().getViewManager();
    if (!viewManager.isActiveView(Views.VIEW_SESSION)) {
        final ITrack selectedTrack = this.model.getCurrentTrackBank().getSelectedTrack();
        if (selectedTrack != null) {
            final Integer preferredView = viewManager.getPreferredView(selectedTrack.getPosition());
            viewManager.setActiveView(preferredView == null ? Views.VIEW_PLAY : preferredView);
        }
    }
    if (viewManager.isActiveView(Views.VIEW_PLAY))
        viewManager.getActiveView().updateNoteMapping();
    // Reset drum octave because the drum pad bank is also reset
    this.scales.setDrumOctave(0);
    if (viewManager.isActiveView(Views.VIEW_DRUM))
        viewManager.getView(Views.VIEW_DRUM).updateNoteMapping();
}
Also used : ITrack(de.mossgrabers.framework.daw.data.ITrack) ViewManager(de.mossgrabers.framework.view.ViewManager)

Example 19 with ITrack

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

the class LaunchpadControllerSetup method updateButtons.

private void updateButtons() {
    final LaunchpadControlSurface surface = this.getSurface();
    final ViewManager viewManager = surface.getViewManager();
    final View activeView = viewManager.getActiveView();
    if (activeView != null) {
        ((LaunchpadCursorCommand) activeView.getTriggerCommand(Commands.COMMAND_ARROW_DOWN)).updateArrows();
        ((SceneView) activeView).updateSceneButtons();
    }
    if (!this.isPro) {
        surface.setButton(LaunchpadControlSurface.LAUNCHPAD_MKII_BUTTON_USER, surface.isUserPressed() ? LaunchpadColors.LAUNCHPAD_COLOR_WHITE : LaunchpadColors.LAUNCHPAD_COLOR_GREY_LO);
        return;
    }
    surface.setButton(LaunchpadControlSurface.LAUNCHPAD_PRO_BUTTON_USER, LaunchpadColors.LAUNCHPAD_COLOR_BLACK);
    final boolean isShift = surface.isShiftPressed();
    final ITrack selTrack = this.model.getCurrentTrackBank().getSelectedTrack();
    final int index = selTrack == null ? -1 : selTrack.getIndex();
    final ModeManager modeManager = surface.getModeManager();
    final ITransport transport = this.model.getTransport();
    surface.setButton(LaunchpadControlSurface.LAUNCHPAD_BUTTON_SHIFT, isShift ? LaunchpadColors.LAUNCHPAD_COLOR_WHITE : LaunchpadColors.LAUNCHPAD_COLOR_GREY_LO);
    surface.setButton(LaunchpadControlSurface.LAUNCHPAD_BUTTON_CLICK, isShift ? LaunchpadColors.LAUNCHPAD_COLOR_GREEN_SPRING : transport.isMetronomeOn() ? LaunchpadColors.LAUNCHPAD_COLOR_GREEN_HI : LaunchpadColors.LAUNCHPAD_COLOR_GREEN_LO);
    surface.setButton(LaunchpadControlSurface.LAUNCHPAD_BUTTON_UNDO, isShift ? LaunchpadColors.LAUNCHPAD_COLOR_GREEN_SPRING : LaunchpadColors.LAUNCHPAD_COLOR_GREEN_LO);
    surface.setButton(LaunchpadControlSurface.LAUNCHPAD_BUTTON_DELETE, isShift ? LaunchpadColors.LAUNCHPAD_COLOR_BLACK : LaunchpadColors.LAUNCHPAD_COLOR_GREEN_LO);
    surface.setButton(LaunchpadControlSurface.LAUNCHPAD_BUTTON_QUANTIZE, isShift ? LaunchpadColors.LAUNCHPAD_COLOR_BLACK : LaunchpadColors.LAUNCHPAD_COLOR_GREEN_LO);
    surface.setButton(LaunchpadControlSurface.LAUNCHPAD_BUTTON_DUPLICATE, isShift ? LaunchpadColors.LAUNCHPAD_COLOR_GREEN_SPRING : LaunchpadColors.LAUNCHPAD_COLOR_GREEN_LO);
    surface.setButton(LaunchpadControlSurface.LAUNCHPAD_BUTTON_DOUBLE, isShift ? LaunchpadColors.LAUNCHPAD_COLOR_GREEN_SPRING : LaunchpadColors.LAUNCHPAD_COLOR_GREEN_LO);
    final boolean flipRecord = surface.getConfiguration().isFlipRecord();
    surface.setButton(LaunchpadControlSurface.LAUNCHPAD_BUTTON_RECORD, isShift && !flipRecord || !isShift && flipRecord ? transport.isLauncherOverdub() ? LaunchpadColors.LAUNCHPAD_COLOR_ROSE : LaunchpadColors.LAUNCHPAD_COLOR_RED_AMBER : transport.isRecording() ? LaunchpadColors.LAUNCHPAD_COLOR_RED_HI : LaunchpadColors.LAUNCHPAD_COLOR_RED_LO);
    surface.setButton(LaunchpadControlSurface.LAUNCHPAD_BUTTON_REC_ARM, modeManager.isActiveMode(Modes.MODE_REC_ARM) ? LaunchpadColors.LAUNCHPAD_COLOR_RED : index == 0 ? LaunchpadColors.LAUNCHPAD_COLOR_WHITE : LaunchpadColors.LAUNCHPAD_COLOR_GREY_LO);
    surface.setButton(LaunchpadControlSurface.LAUNCHPAD_BUTTON_TRACK, modeManager.isActiveMode(Modes.MODE_TRACK_SELECT) ? LaunchpadColors.LAUNCHPAD_COLOR_GREEN : index == 1 ? LaunchpadColors.LAUNCHPAD_COLOR_WHITE : LaunchpadColors.LAUNCHPAD_COLOR_GREY_LO);
    surface.setButton(LaunchpadControlSurface.LAUNCHPAD_BUTTON_MUTE, modeManager.isActiveMode(Modes.MODE_MUTE) ? LaunchpadColors.LAUNCHPAD_COLOR_YELLOW : index == 2 ? LaunchpadColors.LAUNCHPAD_COLOR_WHITE : LaunchpadColors.LAUNCHPAD_COLOR_GREY_LO);
    surface.setButton(LaunchpadControlSurface.LAUNCHPAD_BUTTON_SOLO, modeManager.isActiveMode(Modes.MODE_SOLO) ? LaunchpadColors.LAUNCHPAD_COLOR_BLUE : index == 3 ? LaunchpadColors.LAUNCHPAD_COLOR_WHITE : LaunchpadColors.LAUNCHPAD_COLOR_GREY_LO);
    surface.setButton(LaunchpadControlSurface.LAUNCHPAD_BUTTON_VOLUME, viewManager.isActiveView(Views.VIEW_VOLUME) ? LaunchpadColors.LAUNCHPAD_COLOR_CYAN : index == 4 ? LaunchpadColors.LAUNCHPAD_COLOR_WHITE : LaunchpadColors.LAUNCHPAD_COLOR_GREY_LO);
    surface.setButton(LaunchpadControlSurface.LAUNCHPAD_BUTTON_PAN, viewManager.isActiveView(Views.VIEW_PAN) ? LaunchpadColors.LAUNCHPAD_COLOR_SKY : index == 5 ? LaunchpadColors.LAUNCHPAD_COLOR_WHITE : LaunchpadColors.LAUNCHPAD_COLOR_GREY_LO);
    surface.setButton(LaunchpadControlSurface.LAUNCHPAD_BUTTON_SENDS, viewManager.isActiveView(Views.VIEW_SENDS) ? LaunchpadColors.LAUNCHPAD_COLOR_ORCHID : index == 6 ? LaunchpadColors.LAUNCHPAD_COLOR_WHITE : LaunchpadColors.LAUNCHPAD_COLOR_GREY_LO);
    surface.setButton(LaunchpadControlSurface.LAUNCHPAD_BUTTON_STOP_CLIP, modeManager.isActiveMode(Modes.MODE_STOP_CLIP) ? LaunchpadColors.LAUNCHPAD_COLOR_ROSE : index == 7 ? LaunchpadColors.LAUNCHPAD_COLOR_WHITE : LaunchpadColors.LAUNCHPAD_COLOR_GREY_LO);
    // Update the front LED with the color of the current track
    final ITrack track = index == -1 ? null : this.model.getCurrentTrackBank().getTrack(index);
    final int color = track != null && track.doesExist() ? this.colorManager.getColor(BitwigColors.getColorIndex(track.getColor())) : 0;
    surface.sendLaunchpadSysEx("0A 63 " + StringUtils.toHexStr(color));
}
Also used : ITrack(de.mossgrabers.framework.daw.data.ITrack) ITransport(de.mossgrabers.framework.daw.ITransport) SceneView(de.mossgrabers.framework.view.SceneView) ViewManager(de.mossgrabers.framework.view.ViewManager) VolumeView(de.mossgrabers.launchpad.view.VolumeView) SessionView(de.mossgrabers.launchpad.view.SessionView) SequencerView(de.mossgrabers.launchpad.view.SequencerView) SceneView(de.mossgrabers.framework.view.SceneView) DeviceView(de.mossgrabers.launchpad.view.DeviceView) View(de.mossgrabers.framework.view.View) PanView(de.mossgrabers.launchpad.view.PanView) RaindropsView(de.mossgrabers.launchpad.view.RaindropsView) BrowserView(de.mossgrabers.launchpad.view.BrowserView) DrumView(de.mossgrabers.launchpad.view.DrumView) SendsView(de.mossgrabers.launchpad.view.SendsView) ShiftView(de.mossgrabers.launchpad.view.ShiftView) PlayView(de.mossgrabers.launchpad.view.PlayView) LaunchpadControlSurface(de.mossgrabers.launchpad.controller.LaunchpadControlSurface) LaunchpadCursorCommand(de.mossgrabers.launchpad.command.trigger.LaunchpadCursorCommand) ModeManager(de.mossgrabers.framework.mode.ModeManager)

Example 20 with ITrack

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

the class PanMode method updateKnobLEDs.

/**
 * {@inheritDoc}
 */
@Override
protected void updateKnobLEDs() {
    final IChannelBank tb = this.model.getCurrentTrackBank();
    final int upperBound = this.model.getValueChanger().getUpperBound();
    final int extenderOffset = this.surface.getExtenderOffset();
    for (int i = 0; i < 8; i++) {
        final ITrack t = tb.getTrack(extenderOffset + i);
        this.surface.setKnobLED(i, MCUControlSurface.KNOB_LED_MODE_BOOST_CUT, t.doesExist() ? Math.max(t.getPan(), 1) : upperBound / 2, upperBound);
    }
}
Also used : ITrack(de.mossgrabers.framework.daw.data.ITrack) IChannelBank(de.mossgrabers.framework.daw.IChannelBank)

Aggregations

ITrack (de.mossgrabers.framework.daw.data.ITrack)312 IChannelBank (de.mossgrabers.framework.daw.IChannelBank)92 ITrackBank (de.mossgrabers.framework.daw.data.bank.ITrackBank)84 ISend (de.mossgrabers.framework.daw.data.ISend)40 ISendBank (de.mossgrabers.framework.daw.data.bank.ISendBank)25 ICursorDevice (de.mossgrabers.framework.daw.ICursorDevice)19 ISlot (de.mossgrabers.framework.daw.data.ISlot)19 Display (de.mossgrabers.framework.controller.display.Display)18 ITrackBank (de.mossgrabers.framework.daw.ITrackBank)18 ModeManager (de.mossgrabers.framework.mode.ModeManager)18 ITextDisplay (de.mossgrabers.framework.controller.display.ITextDisplay)16 ViewManager (de.mossgrabers.framework.view.ViewManager)16 IMasterTrack (de.mossgrabers.framework.daw.data.IMasterTrack)15 ModeManager (de.mossgrabers.framework.featuregroup.ModeManager)15 PushConfiguration (de.mossgrabers.push.PushConfiguration)14 ViewManager (de.mossgrabers.framework.featuregroup.ViewManager)12 IPadGrid (de.mossgrabers.framework.controller.grid.IPadGrid)11 PushDisplay (de.mossgrabers.push.controller.PushDisplay)11 ITransport (de.mossgrabers.framework.daw.ITransport)9 IParameter (de.mossgrabers.framework.daw.data.IParameter)9