Search in sources :

Example 1 with ACVSConfiguration

use of de.mossgrabers.controller.akai.acvs.ACVSConfiguration in project DrivenByMoss by git-moss.

the class ControlMode method updateDisplay.

/**
 * {@inheritDoc}
 */
@Override
public void updateDisplay() {
    final ACVSDisplay d = (ACVSDisplay) this.surface.getDisplay();
    final ACVSConfiguration configuration = this.surface.getConfiguration();
    final boolean isForce = configuration.isActiveACVSDevice(ACVSDevice.FORCE);
    final boolean isMPC = !isForce;
    final boolean isMPC_X = configuration.isActiveACVSDevice(ACVSDevice.MPC_X);
    final ITrackBank tb = this.model.getCurrentTrackBank();
    final ICursorDevice device = this.model.getCursorDevice();
    final int maxScene = calcMaxScene(this.model.getSceneBank());
    d.setScreenItem(ScreenItem.TRACK_NUMBER_OF_SCENES, maxScene);
    // Maximum number of sends
    d.setScreenItem(ScreenItem.TRACK_SENDS_NO, calcNumberOfSends(tb));
    for (int i = 0; i < 8; i++) {
        // Send track data
        final ITrack track = tb.getItem(i);
        sendTrackData(d, i, track);
        this.sendClipData(d, isMPC, i, track.getSlotBank());
    }
    this.sendSceneData(d, isMPC);
    // Set device data
    final boolean exists = device.doesExist();
    final Optional<String> selectedPage = device.getParameterPageBank().getSelectedItem();
    d.setRow(ACVSDisplay.ITEM_ID_DEVICE_BANK_NAME, exists ? selectedPage.orElse("") : "");
    d.setRow(ACVSDisplay.ITEM_ID_DEVICE_NAME, exists ? device.getName() : "");
    d.setScreenItem(ScreenItem.DEVICE_COUNT, device.doesExist() ? device.getDeviceBank().getItemCount() : 0);
    final int devicePosition = device.getPosition();
    d.setScreenItem(ScreenItem.CURRENT_DEVICE_INDEX, devicePosition >= 0 ? devicePosition : 0);
    d.setScreenItem(ScreenItem.CURRENT_DEVICE_ACTIVE, device.isEnabled() ? 127 : 0);
    final IParameterBank parameterBank = device.getParameterBank();
    for (int i = 0; i < 8; i++) {
        final IParameter param = parameterBank.getItem(i);
        d.setRow(ACVSDisplay.ITEM_ID_DEVICE_PARAMETER_NAME_FIRST + i, param.getName());
        d.setRow(ACVSDisplay.ITEM_ID_DEVICE_PARAMETER_VALUE_FIRST + i, param.getDisplayedValue());
        d.setScreenItem(ScreenItem.get(ScreenItem.DEVICE_PARAM1_ENABLED, i), param.doesExist() ? 127 : 0);
        d.setScreenItem(ScreenItem.get(ScreenItem.DEVICE_PARAM1_VALUE, i), param.getValue());
        if (isForce || isMPC_X) {
            d.setScreenItem(ScreenItem.get(ScreenItem.KNOBSTYLE1_COLOR, 8 + i), param.doesExist() ? 1 : 0);
            d.setScreenItem(ScreenItem.get(ScreenItem.KNOB_VALUE1, 8 + i), param.getValue());
            d.setRow(ACVSDisplay.ITEM_ID_DEVICE_PARAM_NAME1 + 8 + i, param.getName());
            d.setRow(ACVSDisplay.ITEM_ID_DEVICE_PARAM_VALUE1 + 8 + i, param.getDisplayedValue());
            final ITrack track = tb.getItem(i);
            d.setScreenItem(ScreenItem.get(ScreenItem.KNOBSTYLE1_COLOR, i), track.doesExist() ? 1 : 0);
            d.setScreenItem(ScreenItem.get(ScreenItem.KNOB_VALUE1, i), track.getVolume());
            d.setRow(ACVSDisplay.ITEM_ID_DEVICE_PARAM_NAME1 + i, track.getName());
            d.setRow(ACVSDisplay.ITEM_ID_DEVICE_PARAM_VALUE1 + i, track.getVolumeStr());
        }
    }
    // Set transport data
    final ITransport transport = this.model.getTransport();
    d.setRow(ACVSDisplay.ITEM_ID_TEMPO, transport.getTempoParameter().getDisplayedValue());
    d.setRow(ACVSDisplay.ITEM_ID_ARRANGEMENT_POSITION, transport.getBeatText().split(":")[0].replace('.', ':'));
    d.setRow(ACVSDisplay.ITEM_ID_LOOP_START, transport.getLoopStartBeatText().split(":")[0].replace('.', ':'));
    d.setRow(ACVSDisplay.ITEM_ID_LOOP_LENGTH, transport.getLoopLengthBeatText().split(":")[0].replace('.', ':'));
    this.sendAdditionalMPCParameters(d);
    if (!isMPC)
        this.sendAdditionalForceParameters(d);
    d.allDone();
    if (this.currentMaxScene != maxScene) {
        this.currentMaxScene = maxScene;
        this.surface.forceFlush();
    }
}
Also used : IParameter(de.mossgrabers.framework.daw.data.IParameter) ITrack(de.mossgrabers.framework.daw.data.ITrack) ACVSDisplay(de.mossgrabers.controller.akai.acvs.controller.ACVSDisplay) ITrackBank(de.mossgrabers.framework.daw.data.bank.ITrackBank) ITransport(de.mossgrabers.framework.daw.ITransport) ACVSConfiguration(de.mossgrabers.controller.akai.acvs.ACVSConfiguration) IParameterBank(de.mossgrabers.framework.daw.data.bank.IParameterBank) ICursorDevice(de.mossgrabers.framework.daw.data.ICursorDevice)

Aggregations

ACVSConfiguration (de.mossgrabers.controller.akai.acvs.ACVSConfiguration)1 ACVSDisplay (de.mossgrabers.controller.akai.acvs.controller.ACVSDisplay)1 ITransport (de.mossgrabers.framework.daw.ITransport)1 ICursorDevice (de.mossgrabers.framework.daw.data.ICursorDevice)1 IParameter (de.mossgrabers.framework.daw.data.IParameter)1 ITrack (de.mossgrabers.framework.daw.data.ITrack)1 IParameterBank (de.mossgrabers.framework.daw.data.bank.IParameterBank)1 ITrackBank (de.mossgrabers.framework.daw.data.bank.ITrackBank)1