Search in sources :

Example 16 with IEnumSetting

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

the class GenericFlexiControllerSetup method init.

/**
 * {@inheritDoc}
 */
@Override
public void init() {
    super.init();
    // Load program name file and create selection list if present
    final Optional<FileEx> programsFileOpt = this.configuration.getProgramsFile();
    if (programsFileOpt.isEmpty())
        return;
    try {
        final FileEx programsFile = programsFileOpt.get();
        final String nameWithoutType = programsFile.getNameWithoutType();
        this.banks.addAll(ProgramBank.parse(programsFile.readUTF8()));
        final IEnumSetting[] bankSettings = new IEnumSetting[this.banks.size()];
        for (int i = 0; i < this.banks.size(); i++) {
            final int bankPos = i;
            final ProgramBank pb = this.banks.get(bankPos);
            final String[] programs = pb.getPrograms();
            final String[] opts = new String[programs.length + 1];
            System.arraycopy(programs, 0, opts, 1, programs.length);
            opts[0] = PROGRAM_NONE;
            bankSettings[bankPos] = this.documentSettings.getEnumSetting(pb.getName(), nameWithoutType + " Program Banks", opts, opts[0]);
            bankSettings[bankPos].addValueObserver(value -> {
                final int program = pb.lookupProgram(value);
                if (program < 0)
                    return;
                final GenericFlexiControlSurface surface = this.getSurface();
                if (surface == null)
                    return;
                final IMidiOutput midiOutput = surface.getMidiOutput();
                if (midiOutput != null)
                    midiOutput.sendProgramChange(pb.getMidiChannel(), pb.getMSB(), pb.getLSB(), program);
                final int channel = pb.getMidiChannel();
                for (int b = 0; b < bankSettings.length; b++) {
                    if (bankPos != b && this.banks.get(b).getMidiChannel() == channel)
                        bankSettings[b].set(PROGRAM_NONE);
                }
            });
        }
    } catch (final IOException ex) {
        this.host.error("Could not load programs file.", ex);
    } catch (final ParseException ex) {
        this.host.error("Could not parse programs file.", ex);
    }
}
Also used : GenericFlexiControlSurface(de.mossgrabers.controller.generic.controller.GenericFlexiControlSurface) FileEx(de.mossgrabers.framework.utils.FileEx) IMidiOutput(de.mossgrabers.framework.daw.midi.IMidiOutput) IOException(java.io.IOException) ParseException(java.text.ParseException) ProgramBank(de.mossgrabers.controller.generic.flexihandler.utils.ProgramBank) IEnumSetting(de.mossgrabers.framework.configuration.IEnumSetting)

Example 17 with IEnumSetting

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

the class AutoColorConfiguration method init.

/**
 * {@inheritDoc}
 */
@Override
public void init(final ISettingsUI globalSettings, final ISettingsUI documentSettings) {
    // /////////////////////////
    // Auto Color
    final IEnumSetting enableAutoColorSetting = globalSettings.getEnumSetting(CATEGORY_AUTO_COLOR, CATEGORY_AUTO_COLOR, ON_OFF_OPTIONS, ON_OFF_OPTIONS[1]);
    enableAutoColorSetting.addValueObserver(value -> {
        this.enableAutoColor = ON_OFF_OPTIONS[1].equals(value);
        this.notifyObservers(ENABLE_AUTO_COLOR);
    });
    this.isSettingActive.add(ENABLE_AUTO_COLOR);
    final DAWColor[] colors = DAWColor.values();
    for (int i = 0; i < colors.length; i++) {
        final DAWColor color = colors[i];
        final IStringSetting setting = globalSettings.getStringSetting(color.getName(), CATEGORY_AUTO_COLOR, 256, "");
        final int index = i;
        final Integer colorRegexIndex = Integer.valueOf(COLOR_REGEX.intValue() + index);
        setting.addValueObserver(value -> {
            this.colorRegEx.put(color, value);
            this.notifyObservers(colorRegexIndex);
        });
        this.isSettingActive.add(colorRegexIndex);
    }
}
Also used : IStringSetting(de.mossgrabers.framework.configuration.IStringSetting) DAWColor(de.mossgrabers.framework.daw.DAWColor) IEnumSetting(de.mossgrabers.framework.configuration.IEnumSetting)

Example 18 with IEnumSetting

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

the class MidiMonitorConfiguration method init.

/**
 * {@inheritDoc}
 */
@Override
public void init(final ISettingsUI globalSettings, final ISettingsUI documentSettings) {
    final IEnumSetting filterSystemRealtimeSetting = globalSettings.getEnumSetting("System Realtime", "Filter", ON_OFF_OPTIONS, ON_OFF_OPTIONS[0]);
    filterSystemRealtimeSetting.addValueObserver(value -> {
        this.isFilterSystemRealtimeOn = "On".equals(value);
        this.notifyObservers(FILTER_SYSTEM_REALTIME);
    });
    this.isSettingActive.add(FILTER_SYSTEM_REALTIME);
}
Also used : IEnumSetting(de.mossgrabers.framework.configuration.IEnumSetting)

Example 19 with IEnumSetting

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

the class MCUConfiguration 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)

Example 20 with IEnumSetting

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

the class MCUConfiguration method activateExtenderSettings.

private void activateExtenderSettings(final ISettingsUI settingsUI) {
    for (int i = 0; i < this.deviceTyes.length; i++) {
        final String label = MCU_DEVICE_DESCRIPTORS[this.deviceTyes.length - 1][i];
        final IEnumSetting setting = settingsUI.getEnumSetting(label, CATEGORY_EXTENDER_SETUP, MCU_DEVICE_TYPE_OPTIONS, MCU_DEVICE_TYPE_OPTIONS[i == this.deviceTyes.length - 1 ? 0 : 1]);
        final String value = setting.get();
        if (MCU_DEVICE_TYPE_OPTIONS[0].equals(value))
            this.deviceTyes[i] = MCUDeviceType.MAIN;
        else if (MCU_DEVICE_TYPE_OPTIONS[1].equals(value))
            this.deviceTyes[i] = MCUDeviceType.EXTENDER;
        else if (MCU_DEVICE_TYPE_OPTIONS[2].equals(value))
            this.deviceTyes[i] = MCUDeviceType.MACKIE_EXTENDER;
    }
}
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