Table of Contents

Class NoteActivity

Namespace
PluginUI
Assembly
PluginUI.dll

Notes currently sounding, written by the audio (or MIDI) thread and read by the UI without locks: assign it to ActivitySource to light the keys played by the host, a sequencer or an arpeggiator.

public sealed class NoteActivity
Inheritance
NoteActivity
Inherited Members

Examples

// Audio thread (processor):
activity.NoteOn(pitch); ... activity.NoteOff(pitch);
// UI (editor):
keyboard.ActivitySource = activity;

Remarks

Each note keeps a counter, so overlapping note-ons of the same pitch (several channels, note ids) only clear when the last one ends. Writers never allocate nor block; readers poll Version to skip unchanged frames.

Properties

Version

Incremented on every change (wraps around).

public int Version { get; }

Property Value

int

Methods

Clear()

Clears every note (any thread), e.g. on "all notes off" or when processing stops.

public void Clear()

IsOn(int)

true if the note is sounding.

public bool IsOn(int pitch)

Parameters

pitch int

MIDI note number.

Returns

bool

The state of the note.

NoteOff(int)

Ends one occurrence of a note (any thread); unmatched note-offs are ignored.

public void NoteOff(int pitch)

Parameters

pitch int

MIDI note number (out-of-range values are ignored).

NoteOn(int)

Marks a note as sounding (any thread).

public void NoteOn(int pitch)

Parameters

pitch int

MIDI note number (out-of-range values are ignored).