Search in sources :

Example 1 with MCUConfiguration

use of de.mossgrabers.mcu.MCUConfiguration in project DrivenByMoss by git-moss.

the class TrackMode method onValueKnob.

/**
 * {@inheritDoc}
 */
@Override
public void onValueKnob(final int index, final int value) {
    final IChannelBank tb = this.model.getCurrentTrackBank();
    final ITrack selectedTrack = tb.getSelectedTrack();
    if (selectedTrack == null)
        return;
    final boolean effectTrackBankActive = this.model.isEffectTrackBankActive();
    switch(index) {
        case 0:
            selectedTrack.changeVolume(value);
            return;
        case 1:
            selectedTrack.changePan(value);
            return;
    }
    final MCUConfiguration config = this.surface.getConfiguration();
    if (index == 2) {
        if (config.isDisplayCrossfader())
            selectedTrack.changeCrossfadeModeAsNumber(value);
        else if (!effectTrackBankActive)
            selectedTrack.getSend(0).changeValue(value);
    } else if (!effectTrackBankActive)
        selectedTrack.getSend(index - (config.isDisplayCrossfader() ? 3 : 2)).changeValue(value);
}
Also used : ITrack(de.mossgrabers.framework.daw.data.ITrack) MCUConfiguration(de.mossgrabers.mcu.MCUConfiguration) IChannelBank(de.mossgrabers.framework.daw.IChannelBank)

Example 2 with MCUConfiguration

use of de.mossgrabers.mcu.MCUConfiguration in project DrivenByMoss by git-moss.

the class TrackMode method updateDisplay.

/**
 * {@inheritDoc}
 */
@Override
public void updateDisplay() {
    if (!this.surface.getConfiguration().hasDisplay1())
        return;
    this.drawDisplay2();
    if (!this.drawTrackHeader())
        return;
    final Display d = this.surface.getDisplay().clear();
    final IChannelBank currentTrackBank = this.model.getCurrentTrackBank();
    final ITrack selectedTrack = currentTrackBank.getSelectedTrack();
    if (selectedTrack == null) {
        d.notify("Please select a track...", true, false);
        return;
    }
    final MCUConfiguration config = this.surface.getConfiguration();
    final boolean displayTrackNames = this.surface.getConfiguration().isDisplayTrackNames();
    if (!displayTrackNames) {
        d.setCell(0, 0, "Volume");
        d.setCell(0, 1, "Pan");
    }
    d.setCell(1, 0, selectedTrack.getVolumeStr(6));
    d.setCell(1, 1, selectedTrack.getPanStr(6));
    int sendStart = 2;
    int sendCount = 6;
    if (config.isDisplayCrossfader()) {
        sendStart = 3;
        sendCount = 5;
        final String crossfadeMode = selectedTrack.getCrossfadeMode();
        if (!displayTrackNames)
            d.setCell(0, 2, "Crossfade");
        d.setCell(1, 2, "A".equals(crossfadeMode) ? "A" : "B".equals(crossfadeMode) ? "     B" : "  <>  ");
    }
    final boolean isEffectTrackBankActive = this.model.isEffectTrackBankActive();
    for (int i = 0; i < sendCount; i++) {
        final int pos = sendStart + i;
        if (!isEffectTrackBankActive) {
            final ISend send = selectedTrack.getSend(i);
            if (send.doesExist()) {
                if (!displayTrackNames)
                    d.setCell(0, pos, StringUtils.fixASCII(send.getName()));
                d.setCell(1, pos, send.getDisplayedValue(6));
            }
        }
    }
    if (!displayTrackNames)
        d.done(0);
    d.done(1);
}
Also used : ITrack(de.mossgrabers.framework.daw.data.ITrack) MCUConfiguration(de.mossgrabers.mcu.MCUConfiguration) IChannelBank(de.mossgrabers.framework.daw.IChannelBank) ISend(de.mossgrabers.framework.daw.data.ISend) Display(de.mossgrabers.framework.controller.display.Display)

Example 3 with MCUConfiguration

use of de.mossgrabers.mcu.MCUConfiguration in project DrivenByMoss by git-moss.

the class TempoTicksCommand method executeNormal.

/**
 * {@inheritDoc}
 */
@Override
public void executeNormal(final ButtonEvent event) {
    if (event != ButtonEvent.DOWN)
        return;
    final MCUConfiguration configuration = this.surface.getConfiguration();
    configuration.toggleDisplayTicks();
    this.surface.getDisplay().notify(configuration.isDisplayTicks() ? "BEATS" : "SMPTE");
}
Also used : MCUConfiguration(de.mossgrabers.mcu.MCUConfiguration)

Example 4 with MCUConfiguration

use of de.mossgrabers.mcu.MCUConfiguration in project DrivenByMoss by git-moss.

the class PitchbendVolumeCommand method handleTrack.

private void handleTrack(final int index, final double value) {
    final boolean effectTrackBankActive = this.model.isEffectTrackBankActive();
    final IChannelBank tb = this.model.getCurrentTrackBank();
    final ITrack selectedTrack = tb.getSelectedTrack();
    switch(index) {
        case 0:
            selectedTrack.setVolume(value);
            return;
        case 1:
            selectedTrack.setPan(value);
            return;
    }
    final MCUConfiguration config = this.surface.getConfiguration();
    if (index == 2) {
        if (config.isDisplayCrossfader()) {
            final double range = this.model.getValueChanger().getUpperBound() / 3.0;
            selectedTrack.setCrossfadeModeAsNumber((int) Math.round(value / range));
        } else if (!effectTrackBankActive)
            selectedTrack.getSend(0).setValue(value);
    } else if (!effectTrackBankActive)
        selectedTrack.getSend(index - (config.isDisplayCrossfader() ? 3 : 2)).setValue(value);
}
Also used : ITrack(de.mossgrabers.framework.daw.data.ITrack) MCUConfiguration(de.mossgrabers.mcu.MCUConfiguration) IChannelBank(de.mossgrabers.framework.daw.IChannelBank)

Example 5 with MCUConfiguration

use of de.mossgrabers.mcu.MCUConfiguration in project DrivenByMoss by git-moss.

the class SelectCommand method executeNormal.

/**
 * {@inheritDoc}
 */
@Override
public void executeNormal(final ButtonEvent event) {
    if (event != ButtonEvent.DOWN)
        return;
    if (this.index == 8) {
        this.model.getMasterTrack().select();
        return;
    }
    final Display display = this.surface.getDisplay();
    // Select Send channels when Send button is additionally pressed
    if (this.surface.isPressed(MCUControlSurface.MCU_MODE_SENDS)) {
        if (this.model.getEffectTrackBank().getTrack(this.channel).doesExist()) {
            this.surface.getModeManager().setActiveMode(Integer.valueOf(Modes.MODE_SEND1.intValue() + this.index));
            display.notify("Send channel " + (this.channel + 1) + " selected.");
        } else
            display.notify("Send channel " + (this.channel + 1) + " does not exist.");
        this.surface.setButtonConsumed(MCUControlSurface.MCU_MODE_SENDS);
        return;
    }
    if (this.surface.isShiftPressed()) {
        final MCUConfiguration configuration = this.surface.getConfiguration();
        configuration.setNewClipLength(this.index);
        display.notify("New clip length: " + AbstractConfiguration.NEW_CLIP_LENGTH_VALUES[configuration.getNewClipLength()]);
        return;
    }
    if (this.surface.isSelectPressed()) {
        this.model.getCurrentTrackBank().getTrack(this.channel).stop();
        return;
    }
    this.model.getCurrentTrackBank().getTrack(this.channel).selectAndMakeVisible();
}
Also used : MCUConfiguration(de.mossgrabers.mcu.MCUConfiguration) Display(de.mossgrabers.framework.controller.display.Display)

Aggregations

MCUConfiguration (de.mossgrabers.mcu.MCUConfiguration)5 IChannelBank (de.mossgrabers.framework.daw.IChannelBank)3 ITrack (de.mossgrabers.framework.daw.data.ITrack)3 Display (de.mossgrabers.framework.controller.display.Display)2 ISend (de.mossgrabers.framework.daw.data.ISend)1