Search in sources :

Example 26 with ICursorDevice

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

the class SelectedDeviceMode method onKnobTouch.

/**
 * {@inheritDoc}
 */
@Override
public void onKnobTouch(final int index, final boolean isTouched) {
    final ICursorDevice cursorDevice = this.model.getCursorDevice();
    if (cursorDevice == null)
        return;
    final IParameter item = cursorDevice.getParameterBank().getItem(index < 0 ? this.selParam : index);
    if (!item.doesExist())
        return;
    if (isTouched && this.surface.isDeletePressed()) {
        this.surface.setTriggerConsumed(ButtonID.DELETE);
        item.resetValue();
    }
    item.touchValue(isTouched);
}
Also used : IParameter(de.mossgrabers.framework.daw.data.IParameter) ICursorDevice(de.mossgrabers.framework.daw.data.ICursorDevice)

Example 27 with ICursorDevice

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

the class FireParameterMode method updateDisplay.

/**
 * {@inheritDoc}
 */
@Override
public void updateDisplay() {
    final IGraphicDisplay display = this.surface.getGraphicsDisplay();
    String desc = "Select";
    String paramLine = "a device";
    int value = -1;
    if (this.model.hasSelectedDevice()) {
        paramLine = "";
        final ICursorDevice cursorDevice = this.model.getCursorDevice();
        final Optional<String> pageName = cursorDevice.getParameterPageBank().getSelectedItem();
        desc = cursorDevice.getName(5) + ": " + (pageName.isPresent() ? StringUtils.optimizeName(pageName.get(), 5) : "None");
        int touchedKnob = this.getTouchedKnob();
        touchedKnob = this.surface.isPressed(ButtonID.ALT) ? 4 + touchedKnob : touchedKnob;
        if (touchedKnob > -1) {
            final IParameter p = this.bank.getItem(touchedKnob);
            paramLine = p.getName(5);
            if (!paramLine.isEmpty()) {
                value = p.getValue();
                paramLine += ": " + p.getDisplayedValue(6);
            }
        }
    }
    display.addElement(new TitleValueComponent(desc, paramLine, value, false));
    display.send();
}
Also used : IParameter(de.mossgrabers.framework.daw.data.IParameter) IGraphicDisplay(de.mossgrabers.framework.controller.display.IGraphicDisplay) ICursorDevice(de.mossgrabers.framework.daw.data.ICursorDevice) TitleValueComponent(de.mossgrabers.controller.akai.fire.graphics.canvas.component.TitleValueComponent)

Example 28 with ICursorDevice

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

the class FireSelectButtonCommand method execute.

/**
 * {@inheritDoc}
 */
@Override
public void execute(final ButtonEvent event, final int velocity) {
    if (velocity > 0)
        return;
    final ModeManager modeManager = this.surface.getModeManager();
    if (modeManager.isActive(Modes.NOTE)) {
        ((NoteMode) modeManager.get(Modes.NOTE)).resetTranspose();
        return;
    }
    if (modeManager.isActive(Modes.BROWSER)) {
        ((FireBrowserCommand) this.surface.getButton(ButtonID.BROWSE).getCommand()).discardBrowser(true);
        return;
    }
    final FireConfiguration configuration = this.surface.getConfiguration();
    final ICursorDevice cursorDevice = this.model.getCursorDevice();
    if (modeManager.isActive(Modes.DEVICE_PARAMS) && configuration.isDeleteModeActive()) {
        cursorDevice.remove();
        configuration.toggleDeleteModeActive();
        return;
    }
    cursorDevice.toggleWindowOpen();
}
Also used : NoteMode(de.mossgrabers.controller.akai.fire.mode.NoteMode) ICursorDevice(de.mossgrabers.framework.daw.data.ICursorDevice) ModeManager(de.mossgrabers.framework.featuregroup.ModeManager) FireConfiguration(de.mossgrabers.controller.akai.fire.FireConfiguration)

Example 29 with ICursorDevice

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

the class DeviceParamsMode method updateKnobLEDs.

/**
 * {@inheritDoc}
 */
@Override
public void updateKnobLEDs() {
    final int upperBound = this.model.getValueChanger().getUpperBound();
    final ICursorDevice cd = this.model.getCursorDevice();
    final int extenderOffset = this.surface.getExtenderOffset();
    final IParameterBank parameterBank = cd.getParameterBank();
    for (int i = 0; i < 8; i++) {
        final IParameter param = parameterBank.getItem(extenderOffset + i);
        this.surface.setKnobLED(i, MCUControlSurface.KNOB_LED_MODE_SINGLE_DOT, param.doesExist() ? Math.max(1, param.getValue()) : 0, upperBound);
    }
}
Also used : IParameter(de.mossgrabers.framework.daw.data.IParameter) IParameterBank(de.mossgrabers.framework.daw.data.bank.IParameterBank) ICursorDevice(de.mossgrabers.framework.daw.data.ICursorDevice)

Example 30 with ICursorDevice

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

the class DeviceParamsMode method onKnobTouch.

/**
 * {@inheritDoc}
 */
@Override
public void onKnobTouch(final int index, final boolean isTouched) {
    this.isKnobTouched[index] = isTouched;
    final ICursorDevice cd = this.model.getCursorDevice();
    final IParameter param = cd.getParameterBank().getItem(index);
    if (param.doesExist())
        param.touchValue(isTouched);
}
Also used : IParameter(de.mossgrabers.framework.daw.data.IParameter) ICursorDevice(de.mossgrabers.framework.daw.data.ICursorDevice)

Aggregations

ICursorDevice (de.mossgrabers.framework.daw.data.ICursorDevice)67 IParameter (de.mossgrabers.framework.daw.data.IParameter)17 IParameterBank (de.mossgrabers.framework.daw.data.bank.IParameterBank)14 ModeManager (de.mossgrabers.framework.featuregroup.ModeManager)10 ITextDisplay (de.mossgrabers.framework.controller.display.ITextDisplay)8 ILayer (de.mossgrabers.framework.daw.data.ILayer)8 IParameterPageBank (de.mossgrabers.framework.daw.data.bank.IParameterPageBank)8 ITrack (de.mossgrabers.framework.daw.data.ITrack)7 ITrackBank (de.mossgrabers.framework.daw.data.bank.ITrackBank)7 IBrowser (de.mossgrabers.framework.daw.IBrowser)5 IDeviceBank (de.mossgrabers.framework.daw.data.bank.IDeviceBank)5 Modes (de.mossgrabers.framework.mode.Modes)5 IPadGrid (de.mossgrabers.framework.controller.grid.IPadGrid)3 ITransport (de.mossgrabers.framework.daw.ITransport)3 IDevice (de.mossgrabers.framework.daw.data.IDevice)3 IMasterTrack (de.mossgrabers.framework.daw.data.IMasterTrack)3 IDrumPadBank (de.mossgrabers.framework.daw.data.bank.IDrumPadBank)3 ViewManager (de.mossgrabers.framework.featuregroup.ViewManager)3 PushConfiguration (de.mossgrabers.controller.ableton.push.PushConfiguration)2 ColorEx (de.mossgrabers.framework.controller.color.ColorEx)2