Skip to content

Action Mapper Modal ​

Overview ​

This section contains all components and utilities for Action Mapper Modal.

Components ​

ItemTypeDescription
Action MapperClassBuilder for configuring the Action Mapper modal.
System Utility ButtonClassCreates a new System Utilities action button.

Action Mapper ​

Builder for configuring the Action Mapper modal.

The action mapper modal is the modal where the user can configure the behavior and map a channel/slider to an action.

Action Mapper Modal

The action mapper can be accessed via the this.actionmapper property in the plugin class.

Example ​

typescript
// Create a simple action button
this.actionmapper
  .addSystemUtilButton('toggleMic')
  .setTitle('Mic Mute')
  .setIcon('fas fa-microphone fa-lg')
  .onClick(({ selected, channel }) => {
    console.log(`Mic ${selected ? 'muted' : 'unmuted'} on channel ${channel}`);
    // Call your MIDI/API to toggle mic
  });

Methods ​

MethodParametersDescription
addSystemUtilButton()id: stringAdds a system utility button to the action mapper..

addSystemUtilButton() ​

typescript
addSystemUtilButton(id: string): SystemUtilButtonHandle

Adds a system utility button to the action mapper.

Parameters:

NameTypeRequiredDescription
idstringYesThe id of the button

Returns:

SystemUtilButtonHandle - The SystemUtilButtonHandle for method chaining


System Utility Button ​

Creates a new System Utilities action button.

System Utility buttons appear in the action selector modal and can be assigned to device channels. Each button maintains its own selected state per channel.

Example ​

typescript
// Basic action button
this.actionmapper
  .addSystemUtilButton('mute')
  .setTitle('Mute')
  .setIcon('fas fa-volume-mute fa-lg')
  .onClick(({ selected, channel }) => {
    console.log(`Channel ${channel} mute ${selected ? 'ON' : 'OFF'}`);
    // Implement mute logic
  });

// Button with settings
const volumeButton = this.actionmapper
  .addSystemUtilButton('volume')
  .setTitle('Volume Control')
  .setIcon('fas fa-volume-up fa-lg');

volumeButton.addSettings((settings) => {
  settings.addSection('volume').setName('Volume Settings');
  
  settings.addInput('maxVolume')
    .setType('number')
    .setLabel('Maximum Volume')
    .setValue(100)
    .setMin(0)
    .setMax(100);
  
  settings.addSwitch('smoothing')
    .setLabel('Volume Smoothing')
    .setValue(true)
    .setDesc('Smoothly transition between volume levels');
});

Methods ​

MethodParametersDescription
addSettings()build: (b: SettingsBuilder) => voidUsed to add settings to a system utility button..
getSelectedMap()-Gets the selected state map for the system utility button..
isSelected()channel: string | numberChecks if the button is selected on a specific channel..
onClick()handler: (evt: any) => voidSets the click handler of the system utility button..
setAutoPersist()flag: booleanSets the auto persist flag for the system utility button..
setDisabled()disabled: booleanSets the disabled state of the system utility button.
setHidden()hidden: booleanSets the hidden state of the system utility button.
setIcon()icon: stringSets the icon of the system utility button..
setTitle()title: stringSets the title of the system utility button..

addSettings() ​

typescript
addSettings(build: (b: SettingsBuilder) => void): this

Used to add settings to a system utility button.

See also:

Parameters:

NameTypeRequiredDescription
build(b: SettingsBuilder) => voidYesThe function to build the settings.

Returns:

this - The SystemUtilButtonHandle for method chaining

Example:

  • typescript
    * this.actionmapper
    *   .addSystemUtilButton('mute')
    *   .setTitle('Mute')
    *   .setIcon('fas fa-volume-mute fa-lg')
    *   .onClick(({ selected, channel }) => {
    *     console.log(`Channel ${channel} mute ${selected ? 'ON' : 'OFF'}`);
    *     // Implement mute logic
    *   })
    *   .addSettings((settings) => {
    *     settings.addSection('mute').setName('Mute Settings');
    *     settings.addSwitch('mute').setLabel('Mute').setValue(true);
    *   });
    * ```

getSelectedMap() ​

typescript
getSelectedMap(): Record

Gets the selected state map for the system utility button.

Returns:

Record - The selected state map for the system utility button

Example:

typescript
const selectedMap = this.actionmapper.addSystemUtilButton('mute').getSelectedMap();
console.log('Selected map:', selectedMap);

isSelected() ​

typescript
isSelected(channel: string \| number): boolean

Checks if the button is selected on a specific channel.

Parameters:

NameTypeRequiredDescription
channelstring \| numberYesThe channel to check

Returns:

boolean - True if the button is selected on the channel, false otherwise

onClick() ​

typescript
onClick(handler: (evt: any) => void): this

Sets the click handler of the system utility button.

Parameters:

NameTypeRequiredDescription
handler(evt: any) => voidYesThe click handler of the system utility button

Returns:

this - The SystemUtilButtonHandle for method chaining

Example:

typescript
this.actionmapper.addSystemUtilButton('mute').onClick(({ selected, channel }) => {
  console.log(`Channel ${channel} mute ${selected ? 'ON' : 'OFF'}`);
  // Implement mute logic
});

setAutoPersist() ​

typescript
setAutoPersist(flag: boolean): this

Sets the auto persist flag for the system utility button.

Parameters:

NameTypeRequiredDescription
flagbooleanYesThe auto persist flag

Returns:

this - The SystemUtilButtonHandle for method chaining

Example:

typescript
this.actionmapper.addSystemUtilButton('mute').setAutoPersist(true);

setDisabled() ​

typescript
setDisabled(disabled: boolean): this

Sets the disabled state of the system utility button. When disabled, the button appears but cannot be clicked.

Parameters:

NameTypeRequiredDescription
disabledbooleanYesWhether the button should be disabled

Returns:

this - The SystemUtilButtonHandle for method chaining

Example:

typescript
const button = this.actionmapper.addSystemUtilButton('feature')
  .setTitle('Feature')
  .setDisabled(true); // Initially disabled

// Enable it when ready
button.setDisabled(false);

setHidden() ​

typescript
setHidden(hidden: boolean): this

Sets the hidden state of the system utility button. When hidden, the button will not appear in the System Utilities selector.

Parameters:

NameTypeRequiredDescription
hiddenbooleanYesWhether the button should be hidden

Returns:

this - The SystemUtilButtonHandle for method chaining

Example:

typescript
const button = this.actionmapper.addSystemUtilButton('feature')
  .setTitle('Advanced Feature')
  .setHidden(true); // Initially hidden

// Show it later when conditions are met
button.setHidden(false);

setIcon() ​

typescript
setIcon(icon: string): this

Sets the icon of the system utility button.

Parameters:

NameTypeRequiredDescription
iconstringYesThe icon of the system utility button

Returns:

this - The SystemUtilButtonHandle for method chaining

Example:

typescript
this.actionmapper.addSystemUtilButton('mute').setIcon('fas fa-volume-mute fa-lg');

setTitle() ​

typescript
setTitle(title: string): this

Sets the title of the system utility button.

Parameters:

NameTypeRequiredDescription
titlestringYesThe title of the system utility button

Returns:

this - The SystemUtilButtonHandle for method chaining

Example:

typescript
this.actionmapper.addSystemUtilButton('mute').setTitle('Mute');