audioeffects.panel_view
An effect as a control panel sees it, and the one call that puts it on screen.
EffectAdapter(effect) wraps an effect from audioeffects.create() in
the adapter the panel edits through: up to sixteen macros on the
MIDI scale, the patch names, bypass, reload, and a callback for changes that
come from somewhere else. It is the effects half of
audioinstruments.panel.PanelAdapter, with the same names.
import panel_view
adapter = panel_view.create(“RingMod”, source, 48000) adapter.set_macro(0, 96) # the effect’s macro 0, on the 0-127 scale adapter.set_patch(2) # what a pad press does
build(adapter, screen=...) puts the panel on a screen. The controls
come from controls (apps/lib/controlkit) and LVGL, imported inside a guard,
so this module loads without them; build() raises ImportError without.
Bypass: an effect has no bypass of its own. Some effects have a Mix macro,
and most do not, so set_bypass only records the flag the panel shows.
It does not change the sound. A bypass that routes around the effect is a
host’s job, and it is not in this file.
- audioeffects.panel_view.SHOW_MS = 1500
How long the display shows a value after the last turn, in milliseconds.
- class audioeffects.panel_view.Panel(adapter, screen=None, group=None, theme=None, title=None, subtitle=None, on_close=None, two_wheels=False)[source]
Bases:
objectThe built panel, and the few things that update it.
adapter is what it edits. screen is the object to build on (the active screen by default) and group the input group the encoders join (the default group). theme is a theme name or dict, title replaces the adapter’s name on the faceplate, subtitle the line under it, and on_close, when given, adds an EXIT button that calls it.
two_wheels is for a setup with a second wheel that moves focus between the controls (see
display_driver.set_wheel_mapping): the group stays in edit mode, so the other wheel always turns the control that has focus.
- audioeffects.panel_view.create(name, source, sample_rate, transport=None, **options)[source]
Create effect
nameand wrap it. A reload builds it with the same options.
- audioeffects.panel_view.build(adapter, screen=None, group=None, **options)[source]
Put the control panel for
adapteronscreen. Options arePanel’s keywords.adapteris anEffectAdapter, or an effect, which is wrapped first. A name is not accepted: a name needs a source and a sample rate, so usecreate()for that.
- class audioeffects.panel_view.EffectAdapter(effect, rebuild=None, name=None)[source]
Bases:
objectWhat a control panel needs from
effect, and nothing else.rebuildreturns a new effect;request_reload()uses it, and without one a reload fails and says so.create()always passes one.namereplaces the display name on the faceplate.- set_bypass(enabled)[source]
Record the bypass flag the panel shows. The effect is not told; see the module note.
- request_reload()[source]
Build the effect again and swap it in, keeping the patch and macros.
Returns True when the new effect is in place. On a failure the old one keeps running,
engine_erroris 1 andengine_messagesays why. The old effect is not deinitialised here: it may still be in a graph that pulls from it, so a reload listener decides when to let it go.
- on_external_change(callback)[source]
Register
callback(kind, index, value):("macro", i, v)or("patch", i, i).