Search in sources :

Example 6 with IEnumSetting

use of de.mossgrabers.framework.configuration.IEnumSetting in project DrivenByMoss by git-moss.

the class PushConfiguration method activateDefaultNoteViewSetting.

/**
 * Activate the default note view setting.
 *
 * @param settingsUI The settings
 */
private void activateDefaultNoteViewSetting(final ISettingsUI settingsUI) {
    final String[] noteViewNames = Views.getNoteViewNames();
    final IEnumSetting defaultNoteViewSetting = settingsUI.getEnumSetting("Default note view", CATEGORY_PLAY_AND_SEQUENCE, noteViewNames, Views.NAME_PLAY);
    defaultNoteViewSetting.addValueObserver(value -> {
        this.defaultNoteView = Views.getNoteView(value);
        this.notifyObservers(DEFAULT_NOTE_VIEW);
    });
}
Also used : IEnumSetting(de.mossgrabers.framework.configuration.IEnumSetting)

Example 7 with IEnumSetting

use of de.mossgrabers.framework.configuration.IEnumSetting in project DrivenByMoss by git-moss.

the class GenericFlexiConfiguration method init.

/**
 * {@inheritDoc}
 */
@Override
public void init(final ISettingsUI globalSettings, final ISettingsUI documentSettings) {
    String category = "Slot";
    final String[] slotEntries = new String[NUM_SLOTS];
    for (int i = 0; i < NUM_SLOTS; i++) {
        this.commandSlots[i] = new CommandSlot();
        slotEntries[i] = Integer.toString(i + 1);
    }
    this.slotSelectionSetting = globalSettings.getEnumSetting("Selected:", category, slotEntries, slotEntries[0]);
    // /////////////////////////////////////////////
    // The MIDI learn section
    category = "Use a knob/fader/button then click Set...";
    this.learnTypeSetting = globalSettings.getEnumSetting("Type:", category, OPTIONS_TYPE, OPTIONS_TYPE.get(0));
    this.learnNumberSetting = globalSettings.getEnumSetting("Number:", category, NUMBER_NAMES, NUMBER_NAMES.get(0));
    this.learnMidiChannelSetting = globalSettings.getEnumSetting("Midi Channel:", category, OPTIONS_MIDI_CHANNEL, OPTIONS_MIDI_CHANNEL[0]);
    this.learnResolutionSetting = globalSettings.getEnumSetting("Resolution:", category, OPTIONS_RESOLUTION, OPTIONS_RESOLUTION.get(0));
    this.learnTypeSetting.setEnabled(false);
    this.learnNumberSetting.setEnabled(false);
    this.learnMidiChannelSetting.setEnabled(false);
    this.learnResolutionSetting.setEnabled(false);
    globalSettings.getSignalSetting(" ", category, "Set").addSignalObserver(value -> {
        if (this.learnTypeValue == null)
            return;
        this.typeSetting.set(this.learnTypeValue);
        this.midiChannelSetting.set(this.learnMidiChannelValue);
        // CC? For 14-bit values only set CCs below 32
        if (OPTIONS_TYPE.get(1).equals(this.learnTypeValue) && this.learnResolution) {
            final int number = AbstractConfiguration.lookupIndex(NUMBER_NAMES, this.learnNumberValue);
            if (number >= 32 && number < 64)
                this.learnNumberValue = NUMBER_NAMES.get(number - 32);
            else if (number >= 64)
                this.learnResolution = false;
        }
        this.resolutionSetting.set(OPTIONS_RESOLUTION.get(this.learnResolution ? 1 : 0));
        this.numberSetting.set(this.learnNumberValue);
    });
    // /////////////////////////////////////////////
    // Selected Slot - MIDI trigger
    category = "Selected Slot - MIDI trigger";
    this.typeSetting = globalSettings.getEnumSetting("Type:", category, OPTIONS_TYPE, OPTIONS_TYPE.get(0));
    this.numberSetting = globalSettings.getEnumSetting("Number:", category, NUMBER_NAMES, NUMBER_NAMES.get(0));
    this.midiChannelSetting = globalSettings.getEnumSetting("Midi Channel:", category, CONTROLLER_CHANNELS, CONTROLLER_CHANNELS.get(0));
    this.resolutionSetting = globalSettings.getEnumSetting("Resolution:", category, OPTIONS_RESOLUTION, OPTIONS_RESOLUTION.get(0));
    final String[] knobModeLabels = KnobMode.getLabels();
    this.knobModeSetting = globalSettings.getEnumSetting("Knob Mode:", category, knobModeLabels, knobModeLabels[0]);
    // /////////////////////////////////////////////
    // Selected Slot - MIDI device update
    category = "Selected Slot - MIDI device update";
    this.sendValueSetting = globalSettings.getEnumSetting("Send value to device:", category, AbstractConfiguration.ON_OFF_OPTIONS, AbstractConfiguration.ON_OFF_OPTIONS[1]);
    this.sendValueWhenReceivedSetting = globalSettings.getEnumSetting("Send value to device when received (only buttons):", category, AbstractConfiguration.ON_OFF_OPTIONS, AbstractConfiguration.ON_OFF_OPTIONS[1]);
    // /////////////////////////////////////////////
    // Selected Slot - Function
    category = "Selected Slot - Function";
    final CommandCategory[] values = CommandCategory.values();
    for (final CommandCategory value : values) {
        final IEnumSetting fs = createFunctionSetting(value.getName(), category, globalSettings);
        this.functionSettings.add(fs);
        this.functionSettingsMap.put(value, fs);
        fs.addValueObserver(this::handleFunctionChange);
    }
    // /////////////////////////////////////////////
    // Export/Import section
    category = "Load / Save";
    // The Setlist file to auto-load
    this.fileSetting = globalSettings.getStringSetting("Filename", category, -1, "");
    this.filename = this.fileSetting.get();
    this.fileSetting.addValueObserver(value -> this.filename = value);
    // The different blank labels are necessary to distinguish the widgets!
    globalSettings.getSignalSetting("  ", category, "Save").addSignalObserver(value -> this.notifyObservers(BUTTON_SAVE));
    globalSettings.getSignalSetting("   ", category, "Load").addSignalObserver(value -> this.notifyObservers(BUTTON_LOAD));
    this.learnTypeSetting.set(OPTIONS_TYPE.get(0));
    this.typeSetting.addValueObserver(value -> {
        final int type = AbstractConfiguration.lookupIndex(OPTIONS_TYPE, value) - 1;
        this.getSelectedSlot().setType(type);
        // High resolution is only true for pitchbend as the default
        final int number = AbstractConfiguration.lookupIndex(NUMBER_NAMES, this.numberSetting.get());
        if (type != CommandSlot.TYPE_PITCH_BEND && (type != CommandSlot.TYPE_CC || number >= 32))
            this.resolutionSetting.set(OPTIONS_RESOLUTION.get(0));
        this.clearNoteMap();
        this.updateVisibility(!OPTIONS_TYPE.get(0).equals(value));
    });
    this.numberSetting.addValueObserver(value -> {
        final int numberIndex = AbstractConfiguration.lookupIndex(NUMBER_NAMES, value);
        this.getSelectedSlot().setNumber(numberIndex);
        // Switch resolution setting to low for CC >= 32
        final int type = AbstractConfiguration.lookupIndex(OPTIONS_TYPE, this.typeSetting.get()) - 1;
        if (type == CommandSlot.TYPE_CC && numberIndex >= 32)
            this.resolutionSetting.set(OPTIONS_RESOLUTION.get(0));
        this.clearNoteMap();
    });
    this.midiChannelSetting.addValueObserver(value -> {
        this.getSelectedSlot().setMidiChannel(AbstractConfiguration.lookupIndex(CONTROLLER_CHANNELS, value));
        this.clearNoteMap();
    });
    this.resolutionSetting.addValueObserver(value -> {
        final boolean isHighRes = OPTIONS_RESOLUTION.get(1).equals(value);
        this.getSelectedSlot().setResolution(OPTIONS_RESOLUTION.get(1).equals(value));
        // High resolution can only be set for CC < 32 and pitchbend (fixed to high res)
        final int type = AbstractConfiguration.lookupIndex(OPTIONS_TYPE, this.typeSetting.get()) - 1;
        if (isHighRes) {
            final int number = AbstractConfiguration.lookupIndex(NUMBER_NAMES, this.numberSetting.get());
            if ((type != CommandSlot.TYPE_CC || number >= 32) && type != CommandSlot.TYPE_PITCH_BEND)
                this.resolutionSetting.set(OPTIONS_RESOLUTION.get(0));
        } else {
            if (type == CommandSlot.TYPE_PITCH_BEND)
                this.resolutionSetting.set(OPTIONS_RESOLUTION.get(1));
        }
    });
    this.knobModeSetting.addValueObserver(value -> {
        this.getSelectedSlot().setKnobMode(KnobMode.lookupByLabel(value));
        this.fixKnobMode();
    });
    this.sendValueSetting.addValueObserver(value -> this.getSelectedSlot().setSendValue(AbstractConfiguration.lookupIndex(AbstractConfiguration.ON_OFF_OPTIONS, value) > 0));
    this.sendValueWhenReceivedSetting.addValueObserver(value -> this.getSelectedSlot().setSendValueWhenReceived(AbstractConfiguration.lookupIndex(AbstractConfiguration.ON_OFF_OPTIONS, value) > 0));
    // /////////////////////////////////////////////
    // Keyboard / Pads
    final IEnumSetting enableMPESetting = globalSettings.getEnumSetting("MIDI Polyphonic Expression (MPE)", CATEGORY_KEYBOARD, ON_OFF_OPTIONS, ON_OFF_OPTIONS[0]);
    this.isMPEEnabled = ON_OFF_OPTIONS[1].equals(enableMPESetting.get());
    final IIntegerSetting pitchBendRangeSetting = globalSettings.getRangeSetting("MPE Pitch Bend Sensitivity", CATEGORY_KEYBOARD, 1, 96, 1, "", 48);
    this.mpePitchBendRange = pitchBendRangeSetting.get().intValue();
    final IEnumSetting keyboardMidiChannelSetting = globalSettings.getEnumSetting("Midi Channel", CATEGORY_KEYBOARD, KEYBOARD_CHANNELS, KEYBOARD_CHANNELS.get(1));
    this.keyboardChannel = AbstractConfiguration.lookupIndex(KEYBOARD_CHANNELS, keyboardMidiChannelSetting.get()) - 1;
    final IEnumSetting routeTimbreSetting = globalSettings.getEnumSetting("Route Timbre (CC74)", CATEGORY_KEYBOARD, AbstractConfiguration.ON_OFF_OPTIONS, AbstractConfiguration.ON_OFF_OPTIONS[0]);
    this.keyboardRouteTimbre = "On".equals(routeTimbreSetting.get());
    final IEnumSetting routeModulationSetting = globalSettings.getEnumSetting("Route Modulation (CC01)", CATEGORY_KEYBOARD, AbstractConfiguration.ON_OFF_OPTIONS, AbstractConfiguration.ON_OFF_OPTIONS[1]);
    this.keyboardRouteModulation = "On".equals(routeModulationSetting.get());
    final IEnumSetting routeSustainSetting = globalSettings.getEnumSetting("Route Sustain (CC64)", CATEGORY_KEYBOARD, AbstractConfiguration.ON_OFF_OPTIONS, AbstractConfiguration.ON_OFF_OPTIONS[1]);
    this.keyboardRouteSustain = "On".equals(routeSustainSetting.get());
    final IEnumSetting routePitchbendSetting = globalSettings.getEnumSetting("Route Pitchbend", CATEGORY_KEYBOARD, AbstractConfiguration.ON_OFF_OPTIONS, AbstractConfiguration.ON_OFF_OPTIONS[1]);
    this.keyboardRoutePitchbend = "On".equals(routePitchbendSetting.get());
    enableMPESetting.addValueObserver(value -> {
        this.isMPEEnabled = ON_OFF_OPTIONS[1].equals(value);
        this.notifyObservers(ENABLED_MPE_ZONES);
        pitchBendRangeSetting.setEnabled(this.isMPEEnabled);
        keyboardMidiChannelSetting.setEnabled(!this.isMPEEnabled);
        routePitchbendSetting.setEnabled(!this.isMPEEnabled);
    });
    pitchBendRangeSetting.addValueObserver(value -> {
        this.mpePitchBendRange = value.intValue();
        this.notifyObservers(MPE_PITCHBEND_RANGE);
    });
    // /////////////////////////////////////////////
    // Options
    this.selectedModeSetting = globalSettings.getEnumSetting("Selected Mode", CATEGORY_OPTIONS, MODES, MODES.get(0));
    this.selectedModeSetting.addValueObserver(value -> {
        this.selectedMode = value;
        this.notifyObservers(SELECTED_MODE);
    });
    for (int i = 0; i < this.assignableFunctionActions.length; i++) {
        final int pos = i;
        final IActionSetting actionSetting = globalSettings.getActionSetting("Action " + (i + 1), CATEGORY_OPTIONS);
        actionSetting.addValueObserver(value -> this.assignableFunctionActions[pos] = actionSetting.get());
    }
    // /////////////////////////////////////////////
    // Workflow
    this.activateKnobSpeedSetting(globalSettings);
    this.activateExcludeDeactivatedItemsSetting(globalSettings);
    this.activateNoteRepeatSetting(documentSettings);
    this.slotSelectionSetting.addValueObserver(this::selectSlot);
}
Also used : IIntegerSetting(de.mossgrabers.framework.configuration.IIntegerSetting) CommandSlot(de.mossgrabers.controller.generic.flexihandler.utils.CommandSlot) CommandCategory(de.mossgrabers.controller.generic.controller.CommandCategory) IActionSetting(de.mossgrabers.framework.configuration.IActionSetting) IEnumSetting(de.mossgrabers.framework.configuration.IEnumSetting)

Example 8 with IEnumSetting

use of de.mossgrabers.framework.configuration.IEnumSetting in project DrivenByMoss by git-moss.

the class GenericFlexiConfiguration method updateVisibility.

private void updateVisibility(final boolean visible) {
    this.numberSetting.setVisible(visible);
    this.midiChannelSetting.setVisible(visible);
    this.resolutionSetting.setVisible(visible);
    this.knobModeSetting.setVisible(visible);
    this.sendValueSetting.setVisible(visible);
    this.sendValueWhenReceivedSetting.setVisible(visible);
    for (final IEnumSetting fs : this.functionSettings) fs.setVisible(visible);
}
Also used : IEnumSetting(de.mossgrabers.framework.configuration.IEnumSetting)

Example 9 with IEnumSetting

use of de.mossgrabers.framework.configuration.IEnumSetting in project DrivenByMoss by git-moss.

the class HUIConfiguration method activateHardwareSettings.

private void activateHardwareSettings(final ISettingsUI settingsUI) {
    final IEnumSetting profileSetting = settingsUI.getEnumSetting("Profile", CATEGORY_HARDWARE_SETUP, DEVICE_OPTIONS, DEVICE_OPTIONS[0]);
    profileSetting.addValueObserver(value -> {
        switch(value) {
            case DEVICE_MACKIE_HUI:
            case DEVICE_ICON_QCON_PRO_X:
                this.hasDisplay1Setting.set(ON_OFF_OPTIONS[1]);
                this.hasSegmentDisplaySetting.set(ON_OFF_OPTIONS[1]);
                this.hasMotorFadersSetting.set(ON_OFF_OPTIONS[1]);
                this.setVUMetersEnabled(true);
                break;
            case DEVICE_NOVATION_SLMKIII:
                this.hasDisplay1Setting.set(ON_OFF_OPTIONS[1]);
                this.hasSegmentDisplaySetting.set(ON_OFF_OPTIONS[0]);
                this.hasMotorFadersSetting.set(ON_OFF_OPTIONS[0]);
                this.setVUMetersEnabled(false);
                break;
            default:
                return;
        }
        profileSetting.set(DEVICE_SELECT);
    });
    this.hasDisplay1Setting = settingsUI.getEnumSetting("Has a display", CATEGORY_HARDWARE_SETUP, ON_OFF_OPTIONS, ON_OFF_OPTIONS[1]);
    this.hasDisplay1Setting.addValueObserver(value -> {
        this.hasDisplay1 = "On".equals(value);
        this.notifyObservers(HAS_DISPLAY1);
    });
    this.hasSegmentDisplaySetting = settingsUI.getEnumSetting("Has a position/tempo display", CATEGORY_HARDWARE_SETUP, ON_OFF_OPTIONS, ON_OFF_OPTIONS[1]);
    this.hasSegmentDisplaySetting.addValueObserver(value -> {
        this.hasSegmentDisplay = "On".equals(value);
        this.notifyObservers(HAS_SEGMENT_DISPLAY);
    });
    this.hasMotorFadersSetting = settingsUI.getEnumSetting("Has motor faders", CATEGORY_HARDWARE_SETUP, ON_OFF_OPTIONS, ON_OFF_OPTIONS[1]);
    this.hasMotorFadersSetting.addValueObserver(value -> {
        this.hasMotorFaders = "On".equals(value);
        this.notifyObservers(HAS_MOTOR_FADERS);
    });
    final IEnumSetting sendPingSetting = settingsUI.getEnumSetting("Send ping", CATEGORY_HARDWARE_SETUP, ON_OFF_OPTIONS, ON_OFF_OPTIONS[1]);
    sendPingSetting.addValueObserver(value -> {
        this.sendPing = "On".equals(value);
        this.notifyObservers(HAS_MOTOR_FADERS);
    });
    this.isSettingActive.add(HAS_DISPLAY1);
    this.isSettingActive.add(HAS_SEGMENT_DISPLAY);
    this.isSettingActive.add(HAS_MOTOR_FADERS);
    this.isSettingActive.add(SEND_PING);
}
Also used : IEnumSetting(de.mossgrabers.framework.configuration.IEnumSetting)

Example 10 with IEnumSetting

use of de.mossgrabers.framework.configuration.IEnumSetting in project DrivenByMoss by git-moss.

the class HUIConfiguration method activateChannelTouchSetting.

/**
 * Activate the channel touch select setting.
 *
 * @param settingsUI The settings
 */
protected void activateChannelTouchSetting(final ISettingsUI settingsUI) {
    final IEnumSetting touchChannelSetting = settingsUI.getEnumSetting("Select Channel on Fader Touch", CATEGORY_WORKFLOW, ON_OFF_OPTIONS, ON_OFF_OPTIONS[1]);
    touchChannelSetting.addValueObserver(value -> {
        this.touchChannel = "On".equals(value);
        this.notifyObservers(TOUCH_CHANNEL);
    });
    this.isSettingActive.add(TOUCH_CHANNEL);
}
Also used : IEnumSetting(de.mossgrabers.framework.configuration.IEnumSetting)

Aggregations

IEnumSetting (de.mossgrabers.framework.configuration.IEnumSetting)26 IIntegerSetting (de.mossgrabers.framework.configuration.IIntegerSetting)4 IActionSetting (de.mossgrabers.framework.configuration.IActionSetting)3 IStringSetting (de.mossgrabers.framework.configuration.IStringSetting)3 CommandCategory (de.mossgrabers.controller.generic.controller.CommandCategory)1 GenericFlexiControlSurface (de.mossgrabers.controller.generic.controller.GenericFlexiControlSurface)1 CommandSlot (de.mossgrabers.controller.generic.flexihandler.utils.CommandSlot)1 ProgramBank (de.mossgrabers.controller.generic.flexihandler.utils.ProgramBank)1 DAWColor (de.mossgrabers.framework.daw.DAWColor)1 IMidiOutput (de.mossgrabers.framework.daw.midi.IMidiOutput)1 FileEx (de.mossgrabers.framework.utils.FileEx)1 IOException (java.io.IOException)1 ParseException (java.text.ParseException)1