Search in sources :

Example 41 with IParameter

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

the class NoteRepeatMode method updateDisplay1.

/**
 * {@inheritDoc}
 */
@Override
public void updateDisplay1(final ITextDisplay display) {
    display.setCell(0, 0, "Period:");
    final int selPeriodIndex = this.getSelectedPeriodIndex();
    int pos = 0;
    for (final Pair<String, Boolean> p : Push1Display.createMenuList(4, Resolution.getNames(), selPeriodIndex)) {
        display.setCell(pos, 1, (p.getValue().booleanValue() ? Push1Display.SELECT_ARROW : " ") + p.getKey());
        pos++;
    }
    if (this.host.supports(Capability.NOTE_REPEAT_LENGTH)) {
        display.setCell(0, 2, "Length:");
        final int selLengthIndex = this.getSelectedNoteLengthIndex();
        pos = 0;
        for (final Pair<String, Boolean> p : Push1Display.createMenuList(4, Resolution.getNames(), selLengthIndex)) {
            display.setCell(pos, 3, (p.getValue().booleanValue() ? Push1Display.SELECT_ARROW : " ") + p.getKey());
            pos++;
        }
    }
    final int upperBound = this.model.getValueChanger().getUpperBound();
    if (this.host.supports(Capability.NOTE_REPEAT_MODE)) {
        final String bottomMenu = this.host.supports(Capability.NOTE_REPEAT_USE_PRESSURE_TO_VELOCITY) ? "Use Pressure" : "";
        final ArpeggiatorMode mode = this.noteRepeat.getMode();
        final Configuration configuration = this.surface.getConfiguration();
        final List<ArpeggiatorMode> arpeggiatorModes = configuration.getArpeggiatorModes();
        final int modeIndex = configuration.lookupArpeggiatorModeIndex(mode);
        final int value = modeIndex * upperBound / (arpeggiatorModes.size() - 1);
        display.setCell(0, 5, "Mode");
        display.setCell(1, 5, StringUtils.optimizeName(mode.getName(), 8));
        display.setCell(2, 5, value, Format.FORMAT_VALUE);
        display.setCell(3, 5, bottomMenu);
    }
    if (this.host.supports(Capability.NOTE_REPEAT_OCTAVES)) {
        final String bottomMenu = this.host.supports(Capability.NOTE_REPEAT_IS_FREE_RUNNING) ? "Sync" : "";
        final int octaves = this.noteRepeat.getOctaves();
        final int value = octaves * upperBound / 8;
        display.setCell(0, 6, "Octaves");
        display.setCell(1, 6, Integer.toString(octaves));
        display.setCell(2, 6, value, Format.FORMAT_VALUE);
        display.setCell(3, 6, bottomMenu);
    }
    if (this.host.supports(Capability.NOTE_REPEAT_SWING)) {
        final IParameter shuffleParam = this.model.getGroove().getParameter(GrooveParameterID.SHUFFLE_AMOUNT);
        display.setCell(0, 7, shuffleParam.getName(10));
        display.setCell(1, 7, shuffleParam.getDisplayedValue(8));
        display.setCell(2, 7, shuffleParam.getValue(), Format.FORMAT_VALUE);
        display.setCell(3, 7, "Shuffle");
    }
}
Also used : ArpeggiatorMode(de.mossgrabers.framework.daw.midi.ArpeggiatorMode) IParameter(de.mossgrabers.framework.daw.data.IParameter) Configuration(de.mossgrabers.framework.configuration.Configuration) PushConfiguration(de.mossgrabers.controller.ableton.push.PushConfiguration)

Example 42 with IParameter

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

the class DeviceParamsMode method updateDisplay2.

/**
 * {@inheritDoc}
 */
@Override
public void updateDisplay2(final IGraphicDisplay display) {
    final ICursorDevice cd = this.model.getCursorDevice();
    if (!this.checkExists2(display, cd))
        return;
    final String color = this.model.getCurrentTrackBank().getSelectedChannelColorEntry();
    final ColorEx bottomMenuColor = DAWColor.getColorEntry(color);
    final IDeviceBank deviceBank = cd.getDeviceBank();
    final IParameterBank parameterBank = cd.getParameterBank();
    final IParameterPageBank parameterPageBank = cd.getParameterPageBank();
    final int selectedPage = parameterPageBank.getSelectedItemIndex();
    final boolean hasPinning = this.model.getHost().supports(Capability.HAS_PINNING);
    final IValueChanger valueChanger = this.model.getValueChanger();
    for (int i = 0; i < parameterBank.getPageSize(); i++) {
        final boolean isTopMenuOn = this.getTopMenuEnablement(cd, hasPinning, i);
        String bottomMenu;
        final String bottomMenuIcon;
        boolean isBottomMenuOn;
        if (this.showDevices) {
            final IDevice item = deviceBank.getItem(i);
            bottomMenuIcon = item.getName();
            bottomMenu = item.doesExist() ? item.getName(12) : "";
            isBottomMenuOn = i == cd.getIndex();
        } else {
            bottomMenuIcon = cd.getName();
            bottomMenu = parameterPageBank.getItem(i);
            if (bottomMenu.length() > 12)
                bottomMenu = bottomMenu.substring(0, 12);
            isBottomMenuOn = i == selectedPage;
        }
        final IParameter param = parameterBank.getItem(i);
        final boolean exists = param.doesExist();
        final String parameterName = exists ? param.getName(9) : "";
        final int parameterValue = valueChanger.toDisplayValue(exists ? param.getValue() : 0);
        final String parameterValueStr = exists ? param.getDisplayedValue(8) : "";
        final boolean parameterIsActive = this.isKnobTouched[i];
        final int parameterModulatedValue = valueChanger.toDisplayValue(exists ? param.getModulatedValue() : -1);
        display.addParameterElement(this.hostMenu[i], isTopMenuOn, bottomMenu, bottomMenuIcon, bottomMenuColor, isBottomMenuOn, parameterName, parameterValue, parameterValueStr, parameterIsActive, parameterModulatedValue);
    }
}
Also used : IParameter(de.mossgrabers.framework.daw.data.IParameter) IValueChanger(de.mossgrabers.framework.controller.valuechanger.IValueChanger) ColorEx(de.mossgrabers.framework.controller.color.ColorEx) IParameterPageBank(de.mossgrabers.framework.daw.data.bank.IParameterPageBank) IDevice(de.mossgrabers.framework.daw.data.IDevice) IDeviceBank(de.mossgrabers.framework.daw.data.bank.IDeviceBank) IParameterBank(de.mossgrabers.framework.daw.data.bank.IParameterBank) ICursorDevice(de.mossgrabers.framework.daw.data.ICursorDevice)

Example 43 with IParameter

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

the class MaschineJamUserMode method setupFader.

/**
 * {@inheritDoc}
 */
@Override
public FaderConfig setupFader(final int index) {
    final IParameter parameter = this.model.getUserParameterBank().getItem(index);
    if (!parameter.doesExist())
        return FADER_OFF;
    final int value = this.model.getValueChanger().toMidiValue(parameter.getValue());
    return new FaderConfig(FaderConfig.TYPE_SINGLE, MaschineColorManager.COLOR_WHITE, value);
}
Also used : FaderConfig(de.mossgrabers.controller.ni.maschine.jam.controller.FaderConfig) IParameter(de.mossgrabers.framework.daw.data.IParameter)

Example 44 with IParameter

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

the class MaschineJamParameterMode method setupFader.

/**
 * {@inheritDoc}
 */
@Override
public FaderConfig setupFader(final int index) {
    final ICursorDevice cursorDevice = this.model.getCursorDevice();
    if (!cursorDevice.doesExist())
        return FADER_OFF;
    final IParameter parameter = cursorDevice.getParameterBank().getItem(index);
    if (!parameter.doesExist())
        return FADER_OFF;
    final int value = this.model.getValueChanger().toMidiValue(parameter.getValue());
    return new FaderConfig(FaderConfig.TYPE_SINGLE, MaschineColorManager.PARAM_COLORS.get(index).intValue(), value);
}
Also used : FaderConfig(de.mossgrabers.controller.ni.maschine.jam.controller.FaderConfig) IParameter(de.mossgrabers.framework.daw.data.IParameter) ICursorDevice(de.mossgrabers.framework.daw.data.ICursorDevice)

Example 45 with IParameter

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

the class ParamsMode 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();
    if (index >= KontrolProtocolControlSurface.KONTROL_TRACK_VOLUME && index < KontrolProtocolControlSurface.KONTROL_TRACK_VOLUME + 8) {
        final IParameter parameter = this.bank.getItem(index - KontrolProtocolControlSurface.KONTROL_TRACK_VOLUME);
        return valueChanger.toMidiValue(parameter.getValue());
    }
    if (index >= KontrolProtocolControlSurface.KONTROL_TRACK_PAN && index < KontrolProtocolControlSurface.KONTROL_TRACK_PAN + 8) {
        final IParameter parameter = this.bank.getItem(index - KontrolProtocolControlSurface.KONTROL_TRACK_PAN);
        return valueChanger.toMidiValue(parameter.getValue());
    }
    final int scrollTracksState = (this.bank.canScrollBackwards() ? 1 : 0) + (this.bank.canScrollForwards() ? 2 : 0);
    final IDeviceBank deviceBank = this.cursorDevice.getDeviceBank();
    final int scrollScenesState = (deviceBank.canScrollBackwards() ? 1 : 0) + (deviceBank.canScrollForwards() ? 2 : 0);
    final KontrolProtocolConfiguration configuration = this.surface.getConfiguration();
    switch(index) {
        case KontrolProtocolControlSurface.KONTROL_NAVIGATE_BANKS:
            return (this.cursorDevice.canSelectPreviousFX() ? 1 : 0) + (this.cursorDevice.canSelectNextFX() ? 2 : 0);
        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 : IParameter(de.mossgrabers.framework.daw.data.IParameter) IValueChanger(de.mossgrabers.framework.controller.valuechanger.IValueChanger) IDeviceBank(de.mossgrabers.framework.daw.data.bank.IDeviceBank) KontrolProtocolConfiguration(de.mossgrabers.controller.ni.kontrol.mkii.KontrolProtocolConfiguration)

Aggregations

IParameter (de.mossgrabers.framework.daw.data.IParameter)76 ICursorDevice (de.mossgrabers.framework.daw.data.ICursorDevice)17 IParameterBank (de.mossgrabers.framework.daw.data.bank.IParameterBank)14 ITrack (de.mossgrabers.framework.daw.data.ITrack)9 ITextDisplay (de.mossgrabers.framework.controller.display.ITextDisplay)6 ICursorDevice (de.mossgrabers.framework.daw.ICursorDevice)6 IGroove (de.mossgrabers.framework.daw.IGroove)5 Display (de.mossgrabers.framework.controller.display.Display)4 IValueChanger (de.mossgrabers.framework.controller.valuechanger.IValueChanger)4 IParameterPageBank (de.mossgrabers.framework.daw.data.bank.IParameterPageBank)4 PushDisplay (de.mossgrabers.push.controller.PushDisplay)4 ITransport (de.mossgrabers.framework.daw.ITransport)3 IDeviceBank (de.mossgrabers.framework.daw.data.bank.IDeviceBank)3 PushConfiguration (de.mossgrabers.controller.ableton.push.PushConfiguration)2 TitleValueComponent (de.mossgrabers.controller.akai.fire.graphics.canvas.component.TitleValueComponent)2 FlexiHandlerException (de.mossgrabers.controller.generic.flexihandler.utils.FlexiHandlerException)2 FaderConfig (de.mossgrabers.controller.ni.maschine.jam.controller.FaderConfig)2 SLMkIIIDisplay (de.mossgrabers.controller.novation.slmkiii.controller.SLMkIIIDisplay)2 Configuration (de.mossgrabers.framework.configuration.Configuration)2 IGraphicDisplay (de.mossgrabers.framework.controller.display.IGraphicDisplay)2