Search in sources :

Example 1 with Kontrol1Display

use of de.mossgrabers.controller.ni.kontrol.mki.controller.Kontrol1Display in project DrivenByMoss by git-moss.

the class ScaleMode method updateDisplay.

/**
 * {@inheritDoc}
 */
@Override
public void updateDisplay() {
    final Kontrol1Display d = (Kontrol1Display) this.surface.getDisplay();
    d.clear();
    d.setCell(0, 0, "SCALE");
    d.setCell(0, 1, "SCALE").setCell(1, 1, this.scales.getScale().getName().toUpperCase(Locale.US));
    d.setCell(0, 2, "BASE").setCell(1, 2, Scales.BASES.get(this.scales.getScaleOffset()));
    d.allDone();
}
Also used : Kontrol1Display(de.mossgrabers.controller.ni.kontrol.mki.controller.Kontrol1Display)

Example 2 with Kontrol1Display

use of de.mossgrabers.controller.ni.kontrol.mki.controller.Kontrol1Display in project DrivenByMoss by git-moss.

the class VolumeMode method updateDisplay.

/**
 * {@inheritDoc}
 */
@Override
public void updateDisplay() {
    final Kontrol1Display d = (Kontrol1Display) this.surface.getDisplay();
    d.clear();
    d.setCell(0, 0, this.model.isEffectTrackBankActive() ? "VOL-FX" : "VOLUME").setCell(1, 0, this.formatPageRange("%d - %d"));
    final ITrackBank tb = this.model.getCurrentTrackBank();
    final Optional<ITrack> selTrack = tb.getSelectedItem();
    final int selIndex = selTrack.isEmpty() ? -1 : selTrack.get().getIndex();
    for (int i = 0; i < 8; i++) {
        final boolean isSel = i == selIndex;
        final ITrack t = tb.getItem(i);
        final String n = StringUtils.shortenAndFixASCII(t.getName(), isSel ? 7 : 8).toUpperCase(Locale.US);
        d.setCell(0, 1 + i, isSel ? ">" + n : n).setCell(1, 1 + i, getSecondLineText(t));
        d.setBar(1 + i, this.surface.getContinuous(ContinuousID.get(ContinuousID.KNOB1, i)).isTouched() && t.doesExist(), t.getVolume());
    }
    d.allDone();
}
Also used : Kontrol1Display(de.mossgrabers.controller.ni.kontrol.mki.controller.Kontrol1Display) ITrack(de.mossgrabers.framework.daw.data.ITrack) ITrackBank(de.mossgrabers.framework.daw.data.bank.ITrackBank)

Example 3 with Kontrol1Display

use of de.mossgrabers.controller.ni.kontrol.mki.controller.Kontrol1Display in project DrivenByMoss by git-moss.

the class TrackMode method updateDisplay.

/**
 * {@inheritDoc}
 */
@Override
public void updateDisplay() {
    final ITrackBank currentTrackBank = this.model.getCurrentTrackBank();
    final Optional<ITrack> t = currentTrackBank.getSelectedItem();
    final Kontrol1Display d = (Kontrol1Display) this.surface.getDisplay();
    d.clear();
    if (t.isEmpty()) {
        d.setCell(0, 3, "  PLEASE").setCell(0, 4, "SELECT A").setCell(0, 5, "TRACK").allDone();
        return;
    }
    final boolean isEffectTrackBankActive = this.model.isEffectTrackBankActive();
    final ITrack track = t.get();
    d.setCell(0, 0, (isEffectTrackBankActive ? "TR-FX " : "TRACK ") + (track.getPosition() + 1)).setCell(1, 0, StringUtils.shortenAndFixASCII(track.getName(), 8).toUpperCase(Locale.US));
    d.setCell(0, 1, "VOLUME").setCell(1, 1, getSecondLineText(track)).setCell(0, 2, "PAN").setCell(1, 2, track.getPanStr(8));
    d.setBar(1, this.surface.getContinuous(ContinuousID.KNOB1).isTouched(), track.getVolume());
    d.setPanBar(2, this.surface.getContinuous(ContinuousID.KNOB2).isTouched(), track.getPan());
    if (!isEffectTrackBankActive) {
        final ISendBank sendBank = track.getSendBank();
        for (int i = 0; i < 6; i++) {
            final int pos = 3 + i;
            final ISend sendData = sendBank.getItem(i);
            d.setCell(0, pos, StringUtils.shortenAndFixASCII(sendData.getName(8), 8).toUpperCase(Locale.US)).setCell(1, pos, sendData.getDisplayedValue(8));
            d.setBar(pos, this.surface.getContinuous(ContinuousID.get(ContinuousID.KNOB3, i)).isTouched() && sendData.doesExist(), sendData.getValue());
        }
    }
    d.allDone();
}
Also used : Kontrol1Display(de.mossgrabers.controller.ni.kontrol.mki.controller.Kontrol1Display) ITrack(de.mossgrabers.framework.daw.data.ITrack) ITrackBank(de.mossgrabers.framework.daw.data.bank.ITrackBank) ISend(de.mossgrabers.framework.daw.data.ISend) ISendBank(de.mossgrabers.framework.daw.data.bank.ISendBank)

Example 4 with Kontrol1Display

use of de.mossgrabers.controller.ni.kontrol.mki.controller.Kontrol1Display in project DrivenByMoss by git-moss.

the class Kontrol1ControllerSetup method createSurface.

/**
 * {@inheritDoc}
 */
@Override
protected void createSurface() {
    final Kontrol1UsbDevice usbDevice = new Kontrol1UsbDevice(this.modelIndex, this.host);
    usbDevice.init();
    final IMidiAccess midiAccess = this.factory.createMidiAccess();
    final IMidiInput input = midiAccess.createInput("Komplete Kontrol 1", "80????", /* Note off */
    "90????", /* Note on */
    "B040??", "B001??", /* Sustain pedal + Modulation */
    "D0????", /* Channel After-touch */
    "E0????");
    final Kontrol1ControlSurface surface = new Kontrol1ControlSurface(this.host, this.colorManager, this.configuration, input, usbDevice);
    usbDevice.setCallback(surface);
    this.surfaces.add(surface);
    final Kontrol1Display display = new Kontrol1Display(this.host, this.valueChanger.getUpperBound(), this.configuration, usbDevice);
    surface.addTextDisplay(display);
    surface.getModeManager().setDefaultID(Modes.TRACK);
}
Also used : IMidiAccess(de.mossgrabers.framework.daw.midi.IMidiAccess) Kontrol1Display(de.mossgrabers.controller.ni.kontrol.mki.controller.Kontrol1Display) Kontrol1ControlSurface(de.mossgrabers.controller.ni.kontrol.mki.controller.Kontrol1ControlSurface) IMidiInput(de.mossgrabers.framework.daw.midi.IMidiInput) Kontrol1UsbDevice(de.mossgrabers.controller.ni.kontrol.mki.controller.Kontrol1UsbDevice)

Example 5 with Kontrol1Display

use of de.mossgrabers.controller.ni.kontrol.mki.controller.Kontrol1Display in project DrivenByMoss by git-moss.

the class ParamsMode method updateDisplay.

/**
 * {@inheritDoc}
 */
@Override
public void updateDisplay() {
    final Kontrol1Display d = (Kontrol1Display) this.surface.getDisplay();
    d.clear();
    if (this.model.hasSelectedDevice()) {
        final ICursorDevice cursorDevice = this.model.getCursorDevice();
        d.setCell(0, 0, cursorDevice.getName(8).toUpperCase(Locale.US));
        final Optional<String> selectedItem = cursorDevice.getParameterPageBank().getSelectedItem();
        if (selectedItem.isPresent())
            d.setCell(1, 0, selectedItem.get().toUpperCase(Locale.US));
        for (int i = 0; i < 8; i++) {
            final IParameter p = this.bank.getItem(i);
            final String name = StringUtils.shortenAndFixASCII(p.getName(8), 8).toUpperCase(Locale.US);
            if (!name.isEmpty())
                d.setCell(0, 1 + i, name).setCell(1, 1 + i, checkForUpperCase(StringUtils.shortenAndFixASCII(p.getDisplayedValue(8), 8)));
            d.setBar(1 + i, this.surface.getContinuous(ContinuousID.get(ContinuousID.KNOB1, i)).isTouched() && p.doesExist(), p.getValue());
        }
    } else
        d.setCell(0, 3, "  PLEASE").setCell(0, 4, "SELECT A").setCell(0, 5, "DEVICE").allDone();
    d.allDone();
}
Also used : Kontrol1Display(de.mossgrabers.controller.ni.kontrol.mki.controller.Kontrol1Display) IParameter(de.mossgrabers.framework.daw.data.IParameter) ICursorDevice(de.mossgrabers.framework.daw.data.ICursorDevice)

Aggregations

Kontrol1Display (de.mossgrabers.controller.ni.kontrol.mki.controller.Kontrol1Display)5 ITrack (de.mossgrabers.framework.daw.data.ITrack)2 ITrackBank (de.mossgrabers.framework.daw.data.bank.ITrackBank)2 Kontrol1ControlSurface (de.mossgrabers.controller.ni.kontrol.mki.controller.Kontrol1ControlSurface)1 Kontrol1UsbDevice (de.mossgrabers.controller.ni.kontrol.mki.controller.Kontrol1UsbDevice)1 ICursorDevice (de.mossgrabers.framework.daw.data.ICursorDevice)1 IParameter (de.mossgrabers.framework.daw.data.IParameter)1 ISend (de.mossgrabers.framework.daw.data.ISend)1 ISendBank (de.mossgrabers.framework.daw.data.bank.ISendBank)1 IMidiAccess (de.mossgrabers.framework.daw.midi.IMidiAccess)1 IMidiInput (de.mossgrabers.framework.daw.midi.IMidiInput)1