Search in sources :

Example 46 with ISend

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

the class MaschineJamTrackMode method setupFader.

/**
 * {@inheritDoc}
 */
@Override
public FaderConfig setupFader(final int index) {
    final Optional<ITrack> optionalTrack = this.model.getCurrentTrackBank().getSelectedItem();
    if (optionalTrack.isEmpty())
        return FADER_OFF;
    final ITrack track = optionalTrack.get();
    if (!track.doesExist())
        return FADER_OFF;
    final String c = DAWColor.getColorIndex(track.getColor());
    final int color = this.colorManager.getColorIndex(c);
    switch(index) {
        case 0:
            final int value = this.model.getValueChanger().toMidiValue(track.getVolume());
            if (!this.model.getTransport().isPlaying())
                return new FaderConfig(FaderConfig.TYPE_SINGLE, color, value);
            final int vu = this.model.getValueChanger().toMidiValue(track.getVu());
            return new FaderConfig(FaderConfig.TYPE_DUAL, color, vu, value);
        case 1:
            final int panValue = this.model.getValueChanger().toMidiValue(track.getPan());
            return new FaderConfig(FaderConfig.TYPE_PAN, color, panValue);
        default:
            final ISendBank sendBank = track.getSendBank();
            if (!sendBank.hasExistingItems())
                return FADER_OFF;
            final int sendIndex = index - 2;
            final ISend send = sendBank.getItem(sendIndex);
            if (!send.doesExist())
                return FADER_OFF;
            final int sendValue = this.model.getValueChanger().toMidiValue(send.getValue());
            return new FaderConfig(FaderConfig.TYPE_SINGLE, MaschineColorManager.COLOR_DARK_GREY, sendValue);
    }
}
Also used : FaderConfig(de.mossgrabers.controller.ni.maschine.jam.controller.FaderConfig) ITrack(de.mossgrabers.framework.daw.data.ITrack) ISend(de.mossgrabers.framework.daw.data.ISend) ISendBank(de.mossgrabers.framework.daw.data.bank.ISendBank)

Example 47 with ISend

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

the class MaschineJamSendMode method setupFader.

/**
 * {@inheritDoc}
 */
@Override
public FaderConfig setupFader(final int index) {
    if (this.model.isEffectTrackBankActive())
        return FADER_OFF;
    final Optional<ITrack> optionalTrack = this.getTrack(index);
    if (optionalTrack.isEmpty())
        return FADER_OFF;
    final ITrack track = optionalTrack.get();
    if (!track.doesExist())
        return FADER_OFF;
    final ISend send = track.getSendBank().getItem(this.sendIndex);
    if (!send.doesExist())
        return FADER_OFF;
    final int value = this.model.getValueChanger().toMidiValue(send.getValue());
    return new FaderConfig(FaderConfig.TYPE_SINGLE, MaschineColorManager.COLOR_DARK_GREY, value);
}
Also used : FaderConfig(de.mossgrabers.controller.ni.maschine.jam.controller.FaderConfig) ITrack(de.mossgrabers.framework.daw.data.ITrack) ISend(de.mossgrabers.framework.daw.data.ISend)

Example 48 with ISend

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

the class SendMode method onKnobValue.

/**
 * {@inheritDoc}
 */
@Override
public void onKnobValue(final int index, final int value) {
    final Optional<ITrack> track = this.model.getCurrentTrackBank().getSelectedItem();
    if (track.isEmpty())
        return;
    final ISend send = track.get().getSendBank().getItem(index);
    if (this.isAbsolute)
        send.setValue(value);
    else
        send.changeValue(value);
}
Also used : ITrack(de.mossgrabers.framework.daw.data.ITrack) ISend(de.mossgrabers.framework.daw.data.ISend)

Example 49 with ISend

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

the class SendMode method getKnobValue.

/**
 * {@inheritDoc}
 */
@Override
public int getKnobValue(final int index) {
    // Note: Since we need multiple value (more than 8), index is the MIDI CC of the knob
    final IValueChanger valueChanger = this.model.getValueChanger();
    final Optional<ITrack> selectedTrack = this.bank.getSelectedItem();
    final ISendBank sendBank = selectedTrack.isEmpty() ? null : selectedTrack.get().getSendBank();
    if (index >= KontrolProtocolControlSurface.KONTROL_TRACK_VOLUME && index < KontrolProtocolControlSurface.KONTROL_TRACK_VOLUME + 8) {
        final ISend send = sendBank == null ? EmptySend.INSTANCE : sendBank.getItem(index - KontrolProtocolControlSurface.KONTROL_TRACK_VOLUME);
        return valueChanger.toMidiValue(send.getValue());
    }
    if (index >= KontrolProtocolControlSurface.KONTROL_TRACK_PAN && index < KontrolProtocolControlSurface.KONTROL_TRACK_PAN + 8) {
        final ISend send = sendBank == null ? EmptySend.INSTANCE : sendBank.getItem(index - KontrolProtocolControlSurface.KONTROL_TRACK_PAN);
        return valueChanger.toMidiValue(send.getValue());
    }
    final int scrollTracksState = (sendBank != null && sendBank.canScrollPageBackwards() ? 1 : 0) + (sendBank != null && sendBank.canScrollPageForwards() ? 2 : 0);
    final int scrollScenesState = 0;
    final KontrolProtocolConfiguration configuration = this.surface.getConfiguration();
    switch(index) {
        case KontrolProtocolControlSurface.KONTROL_NAVIGATE_BANKS:
            return scrollTracksState;
        case KontrolProtocolControlSurface.KONTROL_NAVIGATE_TRACKS:
            return configuration.isFlipTrackClipNavigation() ? scrollScenesState : scrollTracksState;
        case KontrolProtocolControlSurface.KONTROL_NAVIGATE_CLIPS:
            return configuration.isFlipTrackClipNavigation() ? scrollTracksState : scrollScenesState;
        default:
            return 0;
    }
}
Also used : ITrack(de.mossgrabers.framework.daw.data.ITrack) IValueChanger(de.mossgrabers.framework.controller.valuechanger.IValueChanger) ISend(de.mossgrabers.framework.daw.data.ISend) KontrolProtocolConfiguration(de.mossgrabers.controller.ni.kontrol.mkii.KontrolProtocolConfiguration) ISendBank(de.mossgrabers.framework.daw.data.bank.ISendBank)

Example 50 with ISend

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

the class MixView method onGridNote.

/**
 * {@inheritDoc}
 */
@Override
public void onGridNote(final int note, final int velocity) {
    if (velocity == 0)
        return;
    final int n = note - 36;
    final int index = n % 8;
    final int what = n / 8;
    final ITrack track = this.model.getCurrentTrackBank().getItem(index);
    final IDisplay display = this.surface.getDisplay();
    switch(what) {
        case 7:
            this.faderMode = FaderMode.VOLUME;
            display.notify("Volume");
            this.selectTrack(track);
            break;
        case 6:
            this.faderMode = FaderMode.PAN;
            display.notify("Panorama");
            this.selectTrack(track);
            break;
        case 5:
            this.faderMode = FaderMode.SEND1;
            final ISend send1 = track.getSendBank().getItem(0);
            display.notify("Send 1: " + (send1.doesExist() ? send1.getName() : "None"));
            this.selectTrack(track);
            break;
        case 4:
            this.faderMode = FaderMode.SEND2;
            final ISend send2 = track.getSendBank().getItem(1);
            display.notify("Send 2: " + (send2.doesExist() ? send2.getName() : "None"));
            this.selectTrack(track);
            break;
        case 3:
            track.stop();
            display.notify("Stop clip");
            break;
        case 2:
            track.toggleMute();
            display.notify("Mute");
            break;
        case 1:
            track.toggleSolo();
            display.notify("Solo");
            break;
        case 0:
            track.toggleRecArm();
            display.notify("Rec Arm");
            break;
        default:
            // Not used
            break;
    }
}
Also used : ITrack(de.mossgrabers.framework.daw.data.ITrack) IDisplay(de.mossgrabers.framework.controller.display.IDisplay) ISend(de.mossgrabers.framework.daw.data.ISend)

Aggregations

ISend (de.mossgrabers.framework.daw.data.ISend)52 ITrack (de.mossgrabers.framework.daw.data.ITrack)40 ISendBank (de.mossgrabers.framework.daw.data.bank.ISendBank)17 IChannelBank (de.mossgrabers.framework.daw.IChannelBank)11 ITrackBank (de.mossgrabers.framework.daw.data.bank.ITrackBank)10 IChannel (de.mossgrabers.framework.daw.data.IChannel)9 Display (de.mossgrabers.framework.controller.display.Display)6 IValueChanger (de.mossgrabers.framework.controller.valuechanger.IValueChanger)5 PushConfiguration (de.mossgrabers.push.PushConfiguration)5 PushDisplay (de.mossgrabers.push.controller.PushDisplay)5 PushConfiguration (de.mossgrabers.controller.ableton.push.PushConfiguration)4 ITextDisplay (de.mossgrabers.framework.controller.display.ITextDisplay)4 SendData (de.mossgrabers.framework.graphics.canvas.utils.SendData)4 IValueChanger (de.mossgrabers.framework.controller.IValueChanger)3 TitleChannelsComponent (de.mossgrabers.controller.akai.fire.graphics.canvas.component.TitleChannelsComponent)2 FaderConfig (de.mossgrabers.controller.ni.maschine.jam.controller.FaderConfig)2 SLMkIIIDisplay (de.mossgrabers.controller.novation.slmkiii.controller.SLMkIIIDisplay)2 ColorEx (de.mossgrabers.framework.controller.color.ColorEx)2 IGraphicDisplay (de.mossgrabers.framework.controller.display.IGraphicDisplay)2 ICursorDevice (de.mossgrabers.framework.daw.ICursorDevice)2