Search in sources :

Example 1 with GenericFlexiControlSurface

use of de.mossgrabers.controller.generic.controller.GenericFlexiControlSurface in project DrivenByMoss by git-moss.

the class GenericFlexiControllerSetup method createObservers.

/**
 * {@inheritDoc}
 */
@Override
protected void createObservers() {
    super.createObservers();
    final GenericFlexiControlSurface surface = this.getSurface();
    this.configuration.addSettingObserver(GenericFlexiConfiguration.SLOT_CHANGE, surface::updateKeyTranslation);
    this.configuration.addSettingObserver(GenericFlexiConfiguration.SELECTED_MODE, this::selectMode);
    final ITrackBank trackBank = this.model.getTrackBank();
    trackBank.addSelectionObserver((index, selected) -> this.handleTrackChange(selected));
    final ITrackBank effectTrackBank = this.model.getEffectTrackBank();
    if (effectTrackBank != null)
        effectTrackBank.addSelectionObserver((index, selected) -> this.handleTrackChange(selected));
    surface.getModeManager().addChangeListener((oldMode, newMode) -> this.updateIndication());
    // Handle configuration changes
    this.createNoteRepeatObservers(this.configuration, surface);
    this.configuration.registerDeactivatedItemsHandler(this.model);
    this.configuration.addSettingObserver(GenericFlexiConfiguration.ENABLED_MPE_ZONES, () -> surface.scheduleTask(() -> {
        final INoteInput input = surface.getMidiInput().getDefaultNoteInput();
        final IMidiOutput output = surface.getMidiOutput();
        final boolean mpeEnabled = this.configuration.isMPEEndabled();
        input.enableMPE(mpeEnabled);
        // Enable MPE zone 1 with all 15 channels
        output.configureMPE(AbstractMidiOutput.ZONE_1, mpeEnabled ? 15 : 0);
        // Disable MPE zone
        output.configureMPE(AbstractMidiOutput.ZONE_2, 0);
    }, 2000));
    this.configuration.addSettingObserver(GenericFlexiConfiguration.MPE_PITCHBEND_RANGE, () -> surface.scheduleTask(() -> {
        final INoteInput input = surface.getMidiInput().getDefaultNoteInput();
        final IMidiOutput output = surface.getMidiOutput();
        final int mpePitchBendRange = this.configuration.getMPEPitchBendRange();
        input.setMPEPitchBendSensitivity(mpePitchBendRange);
        output.sendMPEPitchbendRange(AbstractMidiOutput.ZONE_1, mpePitchBendRange);
    }, 2000));
    this.activateBrowserObserver(Modes.BROWSER);
}
Also used : GenericFlexiControlSurface(de.mossgrabers.controller.generic.controller.GenericFlexiControlSurface) ModesHandler(de.mossgrabers.controller.generic.flexihandler.ModesHandler) SignedBitRelativeValueChanger(de.mossgrabers.framework.controller.valuechanger.SignedBitRelativeValueChanger) TwosComplementValueChanger(de.mossgrabers.framework.controller.valuechanger.TwosComplementValueChanger) ITrack(de.mossgrabers.framework.daw.data.ITrack) TrackSendMode(de.mossgrabers.framework.mode.track.TrackSendMode) DeviceID(de.mossgrabers.framework.daw.constants.DeviceID) AbstractControllerSetup(de.mossgrabers.framework.controller.AbstractControllerSetup) IEnumSetting(de.mossgrabers.framework.configuration.IEnumSetting) INoteInput(de.mossgrabers.framework.daw.midi.INoteInput) BrowserMode(de.mossgrabers.framework.mode.device.BrowserMode) GenericFlexiControlSurface(de.mossgrabers.controller.generic.controller.GenericFlexiControlSurface) Locale(java.util.Locale) MasterHandler(de.mossgrabers.controller.generic.flexihandler.MasterHandler) ProgramBank(de.mossgrabers.controller.generic.flexihandler.utils.ProgramBank) ParseException(java.text.ParseException) IValueObserver(de.mossgrabers.framework.observer.IValueObserver) FxTrackHandler(de.mossgrabers.controller.generic.flexihandler.FxTrackHandler) DeviceHandler(de.mossgrabers.controller.generic.flexihandler.DeviceHandler) Modes(de.mossgrabers.framework.mode.Modes) ModeManager(de.mossgrabers.framework.featuregroup.ModeManager) TrackHandler(de.mossgrabers.controller.generic.flexihandler.TrackHandler) Set(java.util.Set) IValueChanger(de.mossgrabers.framework.controller.valuechanger.IValueChanger) EqHandler(de.mossgrabers.controller.generic.flexihandler.EqHandler) ClipHandler(de.mossgrabers.controller.generic.flexihandler.ClipHandler) ISettingsUI(de.mossgrabers.framework.configuration.ISettingsUI) List(java.util.List) ActionHandler(de.mossgrabers.controller.generic.flexihandler.ActionHandler) UserHandler(de.mossgrabers.controller.generic.flexihandler.UserHandler) IMidiInput(de.mossgrabers.framework.daw.midi.IMidiInput) Optional(java.util.Optional) FileEx(de.mossgrabers.framework.utils.FileEx) TransportHandler(de.mossgrabers.controller.generic.flexihandler.TransportHandler) ITrackBank(de.mossgrabers.framework.daw.data.bank.ITrackBank) FlexiCommand(de.mossgrabers.controller.generic.controller.FlexiCommand) MidiCCHandler(de.mossgrabers.controller.generic.flexihandler.MidiCCHandler) ISetupFactory(de.mossgrabers.framework.controller.ISetupFactory) OffsetBinaryRelativeValueChanger(de.mossgrabers.framework.controller.valuechanger.OffsetBinaryRelativeValueChanger) TrackVolumeMode(de.mossgrabers.framework.mode.track.TrackVolumeMode) ModelSetup(de.mossgrabers.framework.daw.ModelSetup) TrackPanMode(de.mossgrabers.framework.mode.track.TrackPanMode) Scales(de.mossgrabers.framework.scale.Scales) AbstractMidiOutput(de.mossgrabers.framework.daw.midi.AbstractMidiOutput) ArrayList(java.util.ArrayList) MarkerHandler(de.mossgrabers.controller.generic.flexihandler.MarkerHandler) LayoutHandler(de.mossgrabers.controller.generic.flexihandler.LayoutHandler) IMasterTrack(de.mossgrabers.framework.daw.data.IMasterTrack) IHost(de.mossgrabers.framework.daw.IHost) ParameterMode(de.mossgrabers.framework.mode.device.ParameterMode) IMidiOutput(de.mossgrabers.framework.daw.midi.IMidiOutput) IMidiAccess(de.mossgrabers.framework.daw.midi.IMidiAccess) IOException(java.io.IOException) NoteInputHandler(de.mossgrabers.controller.generic.flexihandler.NoteInputHandler) ISendBank(de.mossgrabers.framework.daw.data.bank.ISendBank) IParameterBank(de.mossgrabers.framework.daw.data.bank.IParameterBank) BrowserHandler(de.mossgrabers.controller.generic.flexihandler.BrowserHandler) SceneHandler(de.mossgrabers.controller.generic.flexihandler.SceneHandler) ColorManager(de.mossgrabers.framework.controller.color.ColorManager) TrackMode(de.mossgrabers.framework.mode.track.TrackMode) Collections(java.util.Collections) GlobalHandler(de.mossgrabers.controller.generic.flexihandler.GlobalHandler) IMidiOutput(de.mossgrabers.framework.daw.midi.IMidiOutput) ITrackBank(de.mossgrabers.framework.daw.data.bank.ITrackBank) INoteInput(de.mossgrabers.framework.daw.midi.INoteInput)

Example 2 with GenericFlexiControlSurface

use of de.mossgrabers.controller.generic.controller.GenericFlexiControlSurface in project DrivenByMoss by git-moss.

the class GenericFlexiControllerSetup method selectMode.

private void selectMode() {
    final String selectedModeName = this.configuration.getSelectedModeName();
    if (selectedModeName == null)
        return;
    final GenericFlexiControlSurface surface = this.getSurface();
    final Modes modeID = surface.getModeManager().get(selectedModeName);
    if (modeID != null)
        surface.activateMode(modeID);
}
Also used : GenericFlexiControlSurface(de.mossgrabers.controller.generic.controller.GenericFlexiControlSurface) Modes(de.mossgrabers.framework.mode.Modes)

Example 3 with GenericFlexiControlSurface

use of de.mossgrabers.controller.generic.controller.GenericFlexiControlSurface in project DrivenByMoss by git-moss.

the class GenericFlexiControllerSetup method startup.

/**
 * {@inheritDoc}
 */
@Override
public void startup() {
    this.configuration.clearNoteMap();
    final GenericFlexiControlSurface surface = this.getSurface();
    surface.getModeManager().setActive(Modes.TRACK);
    // Load last configuration
    this.host.scheduleTask(() -> this.host.println(surface.loadFile(this.configuration.getFilename())), 2000);
}
Also used : GenericFlexiControlSurface(de.mossgrabers.controller.generic.controller.GenericFlexiControlSurface)

Example 4 with GenericFlexiControlSurface

use of de.mossgrabers.controller.generic.controller.GenericFlexiControlSurface in project DrivenByMoss by git-moss.

the class GenericFlexiControllerSetup method createSurface.

/**
 * {@inheritDoc}
 */
@Override
protected void createSurface() {
    final IMidiAccess midiAccess = this.factory.createMidiAccess();
    final IMidiOutput output = midiAccess.createOutput();
    final String inputName;
    if (this.configuration.isMPEEndabled())
        inputName = "Generic Flexi (MPE)";
    else
        inputName = this.configuration.getKeyboardChannel() < 0 ? null : "Generic Flexi";
    final List<String> filters = this.getMidiFilters();
    final IMidiInput input = midiAccess.createInput(inputName, filters.toArray(new String[filters.size()]));
    final GenericFlexiControlSurface surface = new GenericFlexiControlSurface(this.host, this.configuration, this.colorManager, output, input);
    this.surfaces.add(surface);
    this.registerHandlers(surface);
    this.configuration.setCommandObserver(this);
}
Also used : GenericFlexiControlSurface(de.mossgrabers.controller.generic.controller.GenericFlexiControlSurface) IMidiAccess(de.mossgrabers.framework.daw.midi.IMidiAccess) IMidiOutput(de.mossgrabers.framework.daw.midi.IMidiOutput) IMidiInput(de.mossgrabers.framework.daw.midi.IMidiInput)

Example 5 with GenericFlexiControlSurface

use of de.mossgrabers.controller.generic.controller.GenericFlexiControlSurface in project DrivenByMoss by git-moss.

the class GenericFlexiControllerSetup method createModes.

/**
 * {@inheritDoc}
 */
@Override
protected void createModes() {
    final GenericFlexiControlSurface surface = this.getSurface();
    final ModeManager modeManager = surface.getModeManager();
    modeManager.register(Modes.TRACK, new TrackMode<>(surface, this.model, true));
    modeManager.register(Modes.VOLUME, new TrackVolumeMode<>(surface, this.model, true));
    modeManager.register(Modes.PAN, new TrackPanMode<>(surface, this.model, true));
    for (int i = 0; i < 8; i++) modeManager.register(Modes.get(Modes.SEND1, i), new TrackSendMode<>(i, surface, this.model, true));
    modeManager.register(Modes.DEVICE_PARAMS, new ParameterMode<>(surface, this.model, true));
    modeManager.register(Modes.BROWSER, new BrowserMode<>(surface, this.model));
    modeManager.setDefaultID(Modes.VOLUME);
}
Also used : GenericFlexiControlSurface(de.mossgrabers.controller.generic.controller.GenericFlexiControlSurface) TrackSendMode(de.mossgrabers.framework.mode.track.TrackSendMode) ModeManager(de.mossgrabers.framework.featuregroup.ModeManager)

Aggregations

GenericFlexiControlSurface (de.mossgrabers.controller.generic.controller.GenericFlexiControlSurface)6 ProgramBank (de.mossgrabers.controller.generic.flexihandler.utils.ProgramBank)2 IEnumSetting (de.mossgrabers.framework.configuration.IEnumSetting)2 IMidiAccess (de.mossgrabers.framework.daw.midi.IMidiAccess)2 IMidiOutput (de.mossgrabers.framework.daw.midi.IMidiOutput)2 Modes (de.mossgrabers.framework.mode.Modes)2 FlexiCommand (de.mossgrabers.controller.generic.controller.FlexiCommand)1 ActionHandler (de.mossgrabers.controller.generic.flexihandler.ActionHandler)1 BrowserHandler (de.mossgrabers.controller.generic.flexihandler.BrowserHandler)1 ClipHandler (de.mossgrabers.controller.generic.flexihandler.ClipHandler)1 DeviceHandler (de.mossgrabers.controller.generic.flexihandler.DeviceHandler)1 EqHandler (de.mossgrabers.controller.generic.flexihandler.EqHandler)1 FxTrackHandler (de.mossgrabers.controller.generic.flexihandler.FxTrackHandler)1 GlobalHandler (de.mossgrabers.controller.generic.flexihandler.GlobalHandler)1 LayoutHandler (de.mossgrabers.controller.generic.flexihandler.LayoutHandler)1 MarkerHandler (de.mossgrabers.controller.generic.flexihandler.MarkerHandler)1 MasterHandler (de.mossgrabers.controller.generic.flexihandler.MasterHandler)1 MidiCCHandler (de.mossgrabers.controller.generic.flexihandler.MidiCCHandler)1 ModesHandler (de.mossgrabers.controller.generic.flexihandler.ModesHandler)1 NoteInputHandler (de.mossgrabers.controller.generic.flexihandler.NoteInputHandler)1