Search in sources :

Example 6 with CommandSlot

use of de.mossgrabers.controller.generic.flexihandler.utils.CommandSlot in project DrivenByMoss by git-moss.

the class GenericFlexiConfiguration method handleFunctionChange.

/**
 * Handles changing the function selection by the user.
 *
 * @param value The new value
 */
private void handleFunctionChange(final String value) {
    if (this.commandIsUpdating.get())
        return;
    if (this.doNotFire.get()) {
        this.doNotFire.set(false);
        return;
    }
    final CommandSlot slot = this.getSelectedSlot();
    final FlexiCommand oldCommand = slot.getCommand();
    final FlexiCommand newCommand = FlexiCommand.lookupByName(value);
    slot.setCommand(newCommand);
    this.fixKnobMode();
    this.notifyCommandObserver();
    final CommandCategory oldCategory = oldCommand.getCategory();
    if (oldCategory != null && oldCategory != newCommand.getCategory()) {
        this.doNotFire.set(true);
        this.functionSettingsMap.get(oldCategory).set(FlexiCommand.OFF.getName());
    }
}
Also used : CommandSlot(de.mossgrabers.controller.generic.flexihandler.utils.CommandSlot) CommandCategory(de.mossgrabers.controller.generic.controller.CommandCategory) FlexiCommand(de.mossgrabers.controller.generic.controller.FlexiCommand)

Example 7 with CommandSlot

use of de.mossgrabers.controller.generic.flexihandler.utils.CommandSlot in project DrivenByMoss by git-moss.

the class GenericFlexiConfiguration method selectSlot.

private void selectSlot(final String value) {
    this.selectedSlot = Integer.parseInt(value) - 1;
    final CommandSlot slot = this.commandSlots[this.selectedSlot];
    this.setType(slot.getType());
    this.setNumber(slot.getNumber());
    this.setMidiChannel(slot.getMidiChannel());
    this.setResolution(slot.getResolution());
    this.setKnobMode(slot.getKnobMode());
    this.setSendValue(slot.isSendValue());
    this.setSendValueWhenReceived(slot.isSendValueWhenReceived());
    this.setCommand(slot.getCommand());
}
Also used : CommandSlot(de.mossgrabers.controller.generic.flexihandler.utils.CommandSlot)

Example 8 with CommandSlot

use of de.mossgrabers.controller.generic.flexihandler.utils.CommandSlot in project DrivenByMoss by git-moss.

the class GenericFlexiControlSurface method handleProgramChange.

/**
 * Handle the reception of a program change message.
 *
 * @param channel The channel of the message
 * @param data1 The program change value
 */
private void handleProgramChange(final int channel, final int data1) {
    this.configuration.setLearnValues(GenericFlexiConfiguration.OPTIONS_TYPE.get(CommandSlot.TYPE_PROGRAM_CHANGE + 1), data1, channel, false);
    final int slotIndex = this.configuration.getSlotCommand(CommandSlot.TYPE_PROGRAM_CHANGE, data1, channel);
    if (slotIndex < 0)
        return;
    final CommandSlot commandSlot = this.configuration.getCommandSlots()[slotIndex];
    if (commandSlot.getCommand().isTrigger()) {
        this.handleCommand(slotIndex, MidiValue.get(127, false));
        this.handleCommand(slotIndex, MidiValue.get(0, false));
    } else {
        // Note: there is no data2 value for PC
        this.handleCommand(slotIndex, MidiValue.get(data1, false));
    }
}
Also used : CommandSlot(de.mossgrabers.controller.generic.flexihandler.utils.CommandSlot)

Aggregations

CommandSlot (de.mossgrabers.controller.generic.flexihandler.utils.CommandSlot)8 FlexiCommand (de.mossgrabers.controller.generic.controller.FlexiCommand)3 CommandCategory (de.mossgrabers.controller.generic.controller.CommandCategory)2 Properties (java.util.Properties)2 IActionSetting (de.mossgrabers.framework.configuration.IActionSetting)1 IEnumSetting (de.mossgrabers.framework.configuration.IEnumSetting)1 IIntegerSetting (de.mossgrabers.framework.configuration.IIntegerSetting)1 FileReader (java.io.FileReader)1 FileWriter (java.io.FileWriter)1 IOException (java.io.IOException)1 Reader (java.io.Reader)1 Writer (java.io.Writer)1