Search in sources :

Example 16 with IChannelBank

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

the class SendsView method drawGrid.

/**
 * {@inheritDoc}
 */
@Override
public void drawGrid() {
    final ColorManager cm = this.model.getColorManager();
    final IChannelBank tb = this.model.getCurrentTrackBank();
    final IMidiOutput output = this.surface.getOutput();
    for (int i = 0; i < 8; i++) {
        final ITrack track = tb.getTrack(i);
        final ISend send = track.getSend(this.selectedSend);
        final int color = cm.getColor(BitwigColors.getColorIndex(track.getColor()));
        if (this.trackColors[i] != color || !track.doesExist() || send.getName().isEmpty())
            this.setupFader(i);
        this.trackColors[i] = color;
        output.sendCC(LaunchpadControlSurface.LAUNCHPAD_FADER_1 + i, send.getValue());
    }
}
Also used : IMidiOutput(de.mossgrabers.framework.daw.midi.IMidiOutput) ITrack(de.mossgrabers.framework.daw.data.ITrack) IChannelBank(de.mossgrabers.framework.daw.IChannelBank) ISend(de.mossgrabers.framework.daw.data.ISend) ColorManager(de.mossgrabers.framework.controller.color.ColorManager)

Example 17 with IChannelBank

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

the class VolumeView method drawGrid.

/**
 * {@inheritDoc}
 */
@Override
public void drawGrid() {
    final ColorManager cm = this.model.getColorManager();
    final IChannelBank tb = this.model.getCurrentTrackBank();
    final IMidiOutput output = this.surface.getOutput();
    for (int i = 0; i < 8; i++) {
        final ITrack track = tb.getTrack(i);
        final int color = cm.getColor(BitwigColors.getColorIndex(track.getColor()));
        if (this.trackColors[i] != color || !track.doesExist())
            this.setupFader(i);
        this.trackColors[i] = color;
        output.sendCC(LaunchpadControlSurface.LAUNCHPAD_FADER_1 + i, track.getVolume());
    }
}
Also used : IMidiOutput(de.mossgrabers.framework.daw.midi.IMidiOutput) ITrack(de.mossgrabers.framework.daw.data.ITrack) IChannelBank(de.mossgrabers.framework.daw.IChannelBank) ColorManager(de.mossgrabers.framework.controller.color.ColorManager)

Example 18 with IChannelBank

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

the class MCUControllerSetup method updateFaders.

private void updateFaders(final IMidiOutput output, final int index, final int channel, final ITrack track) {
    int value = track.getVolume();
    if (this.configuration.useFadersAsKnobs()) {
        final ModeManager modeManager = this.getSurface().getModeManager();
        if (modeManager.isActiveMode(Modes.MODE_VOLUME))
            value = track.getVolume();
        else if (modeManager.isActiveMode(Modes.MODE_PAN))
            value = track.getPan();
        else if (modeManager.isActiveMode(Modes.MODE_TRACK)) {
            final IChannelBank tb = this.model.getCurrentTrackBank();
            final ITrack selectedTrack = tb.getSelectedTrack();
            if (selectedTrack == null)
                value = 0;
            else {
                final ITrack selTrack = tb.getTrack(selectedTrack.getIndex());
                switch(index) {
                    case 0:
                        value = selTrack.getVolume();
                        break;
                    case 1:
                        value = selTrack.getPan();
                        break;
                    default:
                        final boolean effectTrackBankActive = this.model.isEffectTrackBankActive();
                        if (index == 2) {
                            if (this.configuration.isDisplayCrossfader()) {
                                final int crossfadeMode = selectedTrack.getCrossfadeModeAsNumber();
                                value = crossfadeMode == 2 ? this.valueChanger.getUpperBound() : crossfadeMode == 1 ? this.valueChanger.getUpperBound() / 2 : 0;
                            } else if (!effectTrackBankActive)
                                value = selTrack.getSend(0).getValue();
                        } else if (!effectTrackBankActive)
                            value = selTrack.getSend(index - (this.configuration.isDisplayCrossfader() ? 3 : 2)).getValue();
                        break;
                }
            }
        } else if (modeManager.isActiveMode(Modes.MODE_SEND1))
            value = track.getSend(0).getValue();
        else if (modeManager.isActiveMode(Modes.MODE_SEND2))
            value = track.getSend(1).getValue();
        else if (modeManager.isActiveMode(Modes.MODE_SEND3))
            value = track.getSend(2).getValue();
        else if (modeManager.isActiveMode(Modes.MODE_SEND4))
            value = track.getSend(3).getValue();
        else if (modeManager.isActiveMode(Modes.MODE_SEND5))
            value = track.getSend(4).getValue();
        else if (modeManager.isActiveMode(Modes.MODE_SEND6))
            value = track.getSend(5).getValue();
        else if (modeManager.isActiveMode(Modes.MODE_SEND7))
            value = track.getSend(6).getValue();
        else if (modeManager.isActiveMode(Modes.MODE_SEND8))
            value = track.getSend(7).getValue();
        else if (modeManager.isActiveMode(Modes.MODE_DEVICE_PARAMS))
            value = this.model.getCursorDevice().getFXParam(channel).getValue();
    }
    if (value != this.faderValues[channel]) {
        this.faderValues[channel] = value;
        output.sendPitchbend(index, value % 127, value / 127);
    }
}
Also used : ITrack(de.mossgrabers.framework.daw.data.ITrack) IChannelBank(de.mossgrabers.framework.daw.IChannelBank) ModeManager(de.mossgrabers.framework.mode.ModeManager)

Example 19 with IChannelBank

use of de.mossgrabers.framework.daw.IChannelBank 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 20 with IChannelBank

use of de.mossgrabers.framework.daw.IChannelBank 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)

Aggregations

IChannelBank (de.mossgrabers.framework.daw.IChannelBank)114 ITrack (de.mossgrabers.framework.daw.data.ITrack)92 ICursorDevice (de.mossgrabers.framework.daw.ICursorDevice)22 ITrackBank (de.mossgrabers.framework.daw.ITrackBank)20 ModeManager (de.mossgrabers.framework.mode.ModeManager)20 PushConfiguration (de.mossgrabers.push.PushConfiguration)19 Display (de.mossgrabers.framework.controller.display.Display)18 ISend (de.mossgrabers.framework.daw.data.ISend)11 ViewManager (de.mossgrabers.framework.view.ViewManager)10 PushDisplay (de.mossgrabers.push.controller.PushDisplay)10 IChannel (de.mossgrabers.framework.daw.data.IChannel)9 IMasterTrack (de.mossgrabers.framework.daw.data.IMasterTrack)7 ISlot (de.mossgrabers.framework.daw.data.ISlot)7 IValueChanger (de.mossgrabers.framework.controller.IValueChanger)5 View (de.mossgrabers.framework.view.View)5 DisplayMessage (de.mossgrabers.push.controller.DisplayMessage)5 ITransport (de.mossgrabers.framework.daw.ITransport)4 IMidiOutput (de.mossgrabers.framework.daw.midi.IMidiOutput)4 ColorManager (de.mossgrabers.framework.controller.color.ColorManager)3 PadGrid (de.mossgrabers.framework.controller.grid.PadGrid)3