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());
}
}
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());
}
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));
}
}
Aggregations