Skip to content

Commit

Permalink
encoders: add two new encoding modes
Browse files Browse the repository at this point in the history
  • Loading branch information
paradajz committed Apr 15, 2024
1 parent ed668fa commit 518df7e
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/definitions/block/encoder/encoder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
ShowEncoderAccelerationOnTypes,
ShowEncoderRemoteSyncOnTypes,
ShowEncoderLimitsOnTypes,
ShowEncoderRepeatedValueOnTypes,
HideEncoderMidiIdOnTypes,
HideEncoderMidiChannelOnTypes,
} from "../../interface";
Expand Down Expand Up @@ -56,6 +57,15 @@ const sections: Dictionary<ISectionDefinition> = {
value: EncodingMode.SingleNoteWithVariableValue,
text: "Single note with variable value",
},
{
value: EncodingMode.SingleNoteWithFixedValueBothDirections,
text: "Single note with fixed value in both directions",
},
{
value: EncodingMode.SingleNoteWithFixedValueOneDirection0OtherDirection,
text:
"Single note with fixed value in one direction and 0 value in other",
},
{
value: EncodingMode.CC7bit,
text: "Control change - Continuous 7-bit",
Expand Down Expand Up @@ -172,6 +182,20 @@ const sections: Dictionary<ISectionDefinition> = {
If enabled, CC/pitch bend value received via MIDI IN will be applied internally to the encoder with same MIDI ID and MIDI channel,
so that next encoder turn increments or decrements received value instead of the last value it sent.`,
},
RepeatedValue: {
showIf: (formState: FormState): boolean =>
ShowEncoderRepeatedValueOnTypes.includes(formState.encodingMode) &&
formState.enabled,
block: Block.Encoder,
key: "repeatedValue",
type: SectionType.Value,
section: 11,
component: FormInputComponent.Input,
min: 0,
max: 16383,
label: "Repeated value",
helpText: `Specifies the constant note value to be sent when encoder is moved.`,
},
LowerLimit: {
showIf: (formState: FormState): boolean =>
ShowEncoderLimitsOnTypes.includes(formState.encodingMode) &&
Expand Down
7 changes: 7 additions & 0 deletions src/definitions/interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@ export enum EncodingMode {
CC14bit = 8,
Bpm = 10,
SingleNoteWithVariableValue = 11,
SingleNoteWithFixedValueBothDirections = 12,
SingleNoteWithFixedValueOneDirection0OtherDirection = 13,
}

export enum LedControlMode {
Expand Down Expand Up @@ -210,6 +212,11 @@ export const ShowEncoderLimitsOnTypes = [
EncodingMode.SingleNoteWithVariableValue,
];

export const ShowEncoderRepeatedValueOnTypes = [
EncodingMode.SingleNoteWithFixedValueBothDirections,
EncodingMode.SingleNoteWithFixedValueOneDirection0OtherDirection,
];

export const HideLedActivationValueOnControlTypes = [
LedControlMode.PresetChange,
LedControlMode.ProgramChange,
Expand Down

0 comments on commit 518df7e

Please sign in to comment.