Search guides and the APICtrl K
  1. API reference
  2. Native GUI

gfx/value_tree_state_attachments.h

AudioProcessorValueTreeState's widget attachments: SliderAttachment, ButtonAttachment and ComboBoxAttachment, as the reference nests them.

#include <sonore/gfx/value_tree_state_attachments.h>
On this page

Design notes

Built on the SDK's own attachments

gfx/plugin_editor.h already binds a Slider, a Button and a ComboBox to a parameter: the right curve, a gesture around every edit, value names on a switch, read-only parameters shown and never set. Those rules were each learnt the hard way and are tested there. These classes do not repeat them. Each one builds the SDK's attachment over an EditorHost whose four calls land in the APVTS, and adds the one thing an APVTS needs that an EditorHost polling on a tick does not: it LISTENS, so a change made in code, by undo, or by the host through syncFromHost() moves the widget at once.

Kept out of value_tree_state.h

So a DSP that includes the APVTS for its parameters compiles no GUI. The classes are declared inside AudioProcessorValueTreeState, as the reference declares them, and defined here.

Lifetime

As in the reference: the APVTS and the widget must outlive the attachment. Destroying an attachment unhooks the widget's callbacks, so a widget that outlives its attachment is inert rather than calling into freed memory.

Types 3

class AudioProcessorValueTreeState::SliderAttachment : private AudioProcessorValueTreeState::Listener

A Slider bound to one parameter of an APVTS.

class AudioProcessorValueTreeState::ButtonAttachment : private AudioProcessorValueTreeState::Listener

A toggle Button bound to a two-position parameter.

class AudioProcessorValueTreeState::ComboBoxAttachment : private AudioProcessorValueTreeState::Listener

A ComboBox bound to a stepped parameter. The items are the parameter's value names -- a choice parameter's choices -- filled in by the attachment, so the list and the parameter cannot disagree about order.

Functions 2

↑↓ to move↵ to openEvery public name in the headers, and every guide