Table of Contents

Interface IMidiLearnService

Namespace
PluginUI
Assembly
PluginUI.dll

MIDI learn back-end used by the value controls: when MidiLearn is set, the right-click menu of a control bound to a parameter offers "MIDI Learn" and "Forget MIDI assignment", and the control is outlined while it waits for a MIDI controller.

public interface IMidiLearnService

Remarks

Implement it on top of your plugin's MIDI mapping (for VST3, IMidiMapping / IMidiLearn of the controller; PluginUI.NPlug provides one), or use MidiLearnService for standalone applications and tests. Members are called on the UI thread; raise Changed on the UI thread.

Methods

BeginLearn(IParameter)

Starts learning for a parameter (cancels any other learn in progress).

void BeginLearn(IParameter parameter)

Parameters

parameter IParameter

The parameter to assign to the next MIDI controller moved.

CancelLearn()

Cancels the learn in progress, if any.

void CancelLearn()

Forget(IParameter)

Removes the MIDI assignment of a parameter.

void Forget(IParameter parameter)

Parameters

parameter IParameter

A parameter.

GetAssignment(IParameter)

Short description of the assignment (e.g. "CC 74 · Ch 1"), or null if the parameter has none.

string? GetAssignment(IParameter parameter)

Parameters

parameter IParameter

A parameter.

Returns

string

The assignment text, or null.

IsLearning(IParameter)

true while parameter waits for a MIDI controller.

bool IsLearning(IParameter parameter)

Parameters

parameter IParameter

A parameter.

Returns

bool

true if learning for this parameter.

Events

Changed

Raised when a learn starts, ends, or an assignment changes.

event Action? Changed

Event Type

Action