omnipython-apps 0.1.4.dev8__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- apps/__init__.py +5 -0
- apps/about/__init__.py +257 -0
- apps/about/app.json +1 -0
- apps/about/credits.py +12 -0
- apps/about/facts.py +398 -0
- apps/about/fonts/OFL.txt +93 -0
- apps/about/fonts/latin1_14.bin +0 -0
- apps/about/fonts/latin1_16.bin +0 -0
- apps/about/fonts/latin1_24.bin +0 -0
- apps/about/fonts/latin1_32.bin +0 -0
- apps/about/fonts/latin1_40.bin +0 -0
- apps/backline/__init__.py +58 -0
- apps/backline/app.json +1 -0
- apps/backline/app.py +475 -0
- apps/backline/art.py +717 -0
- apps/backline/ask.py +781 -0
- apps/backline/box.py +502 -0
- apps/backline/cast.py +137 -0
- apps/backline/desk/__init__.py +329 -0
- apps/backline/desk/editor.py +331 -0
- apps/backline/desk/grid.py +154 -0
- apps/backline/desk/look.py +169 -0
- apps/backline/desk/pedals.py +102 -0
- apps/backline/desk/perform.py +157 -0
- apps/backline/desk/prompt.py +210 -0
- apps/backline/desk/strip.py +159 -0
- apps/backline/desk_main.py +226 -0
- apps/backline/engine.py +622 -0
- apps/backline/floor.py +509 -0
- apps/backline/footswitch.py +119 -0
- apps/backline/glyphs.py +82 -0
- apps/backline/kits.py +428 -0
- apps/backline/midipedal.py +362 -0
- apps/backline/page_data.py +413 -0
- apps/backline/parts.py +145 -0
- apps/backline/pedal.py +107 -0
- apps/backline/remote.py +134 -0
- apps/backline/songs/ballad_68.json +1 -0
- apps/backline/songs/bossa.json +1 -0
- apps/backline/songs/country_train.json +1 -0
- apps/backline/songs/funk.json +1 -0
- apps/backline/songs/metal.json +1 -0
- apps/backline/songs/pop.json +1 -0
- apps/backline/songs/rock.json +1 -0
- apps/backline/songs/shuffle.json +1 -0
- apps/battery/__init__.py +101 -0
- apps/battery/app.json +1 -0
- apps/bit_world/act_deck.py +683 -0
- apps/bit_world/act_game.py +762 -0
- apps/bit_world/act_pet.py +1032 -0
- apps/bit_world/app.json +1 -0
- apps/bit_world/bit_output.py +45 -0
- apps/bit_world/bit_palette.py +503 -0
- apps/bit_world/bit_sound.py +431 -0
- apps/bit_world/bit_sprites.py +632 -0
- apps/bit_world/bit_world.py +534 -0
- apps/btreceiver/__init__.py +690 -0
- apps/btreceiver/app.json +1 -0
- apps/btreceiver/chime.py +155 -0
- apps/btreceiver/demo.py +529 -0
- apps/btreceiver/screen.py +633 -0
- apps/camera/__init__.py +316 -0
- apps/camera/app.json +1 -0
- apps/card/__init__.py +113 -0
- apps/card/app.json +1 -0
- apps/cast/__init__.py +631 -0
- apps/cast/app.json +1 -0
- apps/cast/receivers.py +193 -0
- apps/chess/__init__.py +18 -0
- apps/chess/app.json +1 -0
- apps/chess/app.py +922 -0
- apps/chess/art.py +323 -0
- apps/chess/ble.py +411 -0
- apps/chess/engine.py +925 -0
- apps/chess/game.py +327 -0
- apps/chess/net.py +261 -0
- apps/clock/__init__.py +38 -0
- apps/clock/app.json +1 -0
- apps/detect/__init__.py +214 -0
- apps/detect/app.json +1 -0
- apps/fmsynth/__init__.py +41 -0
- apps/fmsynth/algorithms.py +61 -0
- apps/fmsynth/app.json +1 -0
- apps/fmsynth/app.py +355 -0
- apps/fmsynth/editor.py +206 -0
- apps/fmsynth/engine.py +257 -0
- apps/fmsynth/meters.py +262 -0
- apps/fmsynth/midi.py +375 -0
- apps/fmsynth/panel_view.py +1071 -0
- apps/fmsynth/patches/fmsynth-01.syx +0 -0
- apps/fmsynth/settings.py +138 -0
- apps/fmsynth/voice.py +398 -0
- apps/gamepad/__init__.py +685 -0
- apps/gamepad/app.json +1 -0
- apps/gamepad/pad.py +94 -0
- apps/gamepad/watch.py +352 -0
- apps/hidden/__init__.py +72 -0
- apps/hidden/app.json +1 -0
- apps/home/__init__.py +483 -0
- apps/home/app.json +1 -0
- apps/home/main.py +36 -0
- apps/homeassistant/__init__.py +213 -0
- apps/homeassistant/api.py +104 -0
- apps/homeassistant/app.json +1 -0
- apps/huey/__init__.py +287 -0
- apps/huey/acting.py +184 -0
- apps/huey/actor.py +194 -0
- apps/huey/app.json +1 -0
- apps/huey/client.py +125 -0
- apps/huey/servers.py +121 -0
- apps/huey/settings.example.json +8 -0
- apps/huey/settings.py +97 -0
- apps/huey/turn.py +504 -0
- apps/huey/voice.py +217 -0
- apps/info/__init__.py +810 -0
- apps/info/app.json +1 -0
- apps/lora/__init__.py +62 -0
- apps/lora/app.json +1 -0
- apps/manifest.py +71 -0
- apps/medialink_baby_monitor/__init__.py +222 -0
- apps/medialink_baby_monitor/app.json +1 -0
- apps/medialink_doorbell/__init__.py +251 -0
- apps/medialink_doorbell/app.json +1 -0
- apps/medialink_hands_free/__init__.py +217 -0
- apps/medialink_hands_free/app.json +1 -0
- apps/medialink_surveillance_camera/__init__.py +258 -0
- apps/medialink_surveillance_camera/app.json +1 -0
- apps/medialink_video_doorbell/__init__.py +289 -0
- apps/medialink_video_doorbell/app.json +1 -0
- apps/medialink_videophone/__init__.py +273 -0
- apps/medialink_videophone/app.json +1 -0
- apps/medialink_walkie_talkie/__init__.py +228 -0
- apps/medialink_walkie_talkie/app.json +1 -0
- apps/midicontroller/__init__.py +774 -0
- apps/midicontroller/app.json +1 -0
- apps/midicontroller/links.py +421 -0
- apps/midicontroller/surface.py +343 -0
- apps/midiengine/__init__.py +977 -0
- apps/midiengine/app.json +1 -0
- apps/midiengine/banks.py +85 -0
- apps/midiengine/midiin.py +165 -0
- apps/midiengine/player.py +392 -0
- apps/midiengine/umidiparser.py +1413 -0
- apps/mp3/__init__.py +240 -0
- apps/mp3/app.json +1 -0
- apps/perch/__init__.py +119 -0
- apps/perch/app.json +1 -0
- apps/perch/huey.py +481 -0
- apps/perch/huey_props.py +386 -0
- apps/perch/huey_shift.py +42 -0
- apps/perch/huey_views.py +296 -0
- apps/perch/scene_bench.py +680 -0
- apps/perch/scene_coast.py +479 -0
- apps/perch/scene_desk.py +492 -0
- apps/perch/stage.py +1274 -0
- apps/perch/vec.py +366 -0
- apps/repl/__init__.py +325 -0
- apps/repl/app.json +1 -0
- apps/roku/__init__.py +156 -0
- apps/roku/app.json +1 -0
- apps/rokucam/__init__.py +362 -0
- apps/rokucam/app.json +1 -0
- apps/security/__init__.py +261 -0
- apps/security/app.json +1 -0
- apps/settings/__init__.py +221 -0
- apps/settings/app.json +1 -0
- apps/shell/__init__.py +33 -0
- apps/shell/app.json +1 -0
- apps/spotify/__init__.py +669 -0
- apps/spotify/app.json +1 -0
- apps/spotify/screen.py +82 -0
- apps/steps/__init__.py +58 -0
- apps/steps/app.json +1 -0
- apps/stompbox/__init__.py +31 -0
- apps/stompbox/app.json +1 -0
- apps/stompbox/app.py +668 -0
- apps/stompbox/boards.json +20 -0
- apps/stompbox/effects.py +241 -0
- apps/stompbox/engine.py +340 -0
- apps/stompbox/footswitch.py +331 -0
- apps/stompbox/inputs.py +449 -0
- apps/stompbox/meter.py +72 -0
- apps/stompbox/outputs.py +135 -0
- apps/stompbox/pedals.txt +45 -0
- apps/stompbox/presets.py +106 -0
- apps/stompbox/styles.py +135 -0
- apps/stompbox/ui.py +817 -0
- apps/stompbox/wavfile.py +73 -0
- apps/synthstation/__init__.py +20 -0
- apps/synthstation/app.json +1 -0
- apps/synthstation/audio.py +397 -0
- apps/synthstation/catalog.py +50 -0
- apps/synthstation/meters.py +136 -0
- apps/synthstation/midi.py +380 -0
- apps/synthstation/pads.py +177 -0
- apps/synthstation/parts.py +128 -0
- apps/synthstation/station.py +1069 -0
- apps/system/__init__.py +11 -0
- apps/system/app.json +1 -0
- apps/touchcal/__init__.py +324 -0
- apps/touchcal/app.json +1 -0
- apps/touchcal/fit.py +262 -0
- apps/wake/__init__.py +268 -0
- apps/wake/app.json +1 -0
- apps/wake/feed.py +155 -0
- apps/watch/__init__.py +355 -0
- apps/watch/app.json +1 -0
- apps/watch/faces.py +35 -0
- apps/watch/wheel.py +157 -0
- apps/weather/__init__.py +278 -0
- apps/weather/app.json +1 -0
- apps/weather/icons.py +172 -0
- apps/weather/sizing.py +71 -0
- apps/weather/zippad.py +172 -0
- omnipython_apps-0.1.4.dev8.dist-info/METADATA +33 -0
- omnipython_apps-0.1.4.dev8.dist-info/RECORD +218 -0
- omnipython_apps-0.1.4.dev8.dist-info/WHEEL +5 -0
- omnipython_apps-0.1.4.dev8.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,1071 @@
|
|
|
1
|
+
# SPDX-FileCopyrightText: 2026 Brad Barnett
|
|
2
|
+
#
|
|
3
|
+
# SPDX-License-Identifier: MIT
|
|
4
|
+
"""The front panel: a header with the display, a row of page buttons, and the pages.
|
|
5
|
+
|
|
6
|
+
``build(editor, screen=...)`` puts the panel on a screen for an
|
|
7
|
+
``editor.Editor``. Every control is one of controlkit's:
|
|
8
|
+
|
|
9
|
+
- **BANK**: 32 pads, one per voice, and the buttons that load and save a
|
|
10
|
+
bank file, store the voice and start a new one;
|
|
11
|
+
- **ALGO**: the diagram of who modulates whom, the algorithm and feedback
|
|
12
|
+
encoders, and the six operators' output levels. Tap an operator's box to
|
|
13
|
+
open its page;
|
|
14
|
+
- **OP 1** to **OP 6**: an operator's envelope with its four rates and four
|
|
15
|
+
levels, its output level, pitch, keyboard scaling and sensitivities;
|
|
16
|
+
- **GLOBAL**: the pitch envelope, the LFO, transpose, the voice's name, and
|
|
17
|
+
the VOLUME, which belongs to the instrument and not to the voice.
|
|
18
|
+
|
|
19
|
+
The header also has what shows on every page: a meter of the level going to
|
|
20
|
+
the audio out, a MIDI button whose lamp flashes for each note that arrives
|
|
21
|
+
and whose cap names the channel listened to, and under the name the render
|
|
22
|
+
load and the underruns. The MIDI button opens 18 pads to choose the channel,
|
|
23
|
+
and on a board with Bluetooth three more: BT OFF and BT ON turn Bluetooth MIDI
|
|
24
|
+
off and on, and BT NEW lets a different controller in.
|
|
25
|
+
|
|
26
|
+
A page is built the first time it is opened. The six operators share one
|
|
27
|
+
page, which shows whichever operator is chosen.
|
|
28
|
+
|
|
29
|
+
controlkit and LVGL are imported inside a guard: without them this module
|
|
30
|
+
still loads, and ``build()`` raises ImportError.
|
|
31
|
+
"""
|
|
32
|
+
|
|
33
|
+
try:
|
|
34
|
+
import lvgl as lv
|
|
35
|
+
from controlkit import encoder as _encoder
|
|
36
|
+
from controlkit import sprites
|
|
37
|
+
from controlkit._draw import Lamp as _Lamp
|
|
38
|
+
from controlkit._draw import box as _box
|
|
39
|
+
from controlkit._draw import fill as _fill
|
|
40
|
+
from controlkit._draw import finish as _finish
|
|
41
|
+
from controlkit._draw import label as _label
|
|
42
|
+
from controlkit._safe import safe
|
|
43
|
+
from controlkit.dotmatrix import DotMatrix
|
|
44
|
+
from controlkit.envelope_view import EnvelopeView
|
|
45
|
+
from controlkit.lamp_button import LampButton
|
|
46
|
+
from controlkit.meter import LedMeter
|
|
47
|
+
from controlkit.pad_grid import PadGrid
|
|
48
|
+
from controlkit.routing_diagram import RoutingDiagram
|
|
49
|
+
from controlkit.theme import resolve
|
|
50
|
+
except ImportError: # the controls, or LVGL, aren't here: this file still loads
|
|
51
|
+
lv = None
|
|
52
|
+
|
|
53
|
+
from . import algorithms
|
|
54
|
+
from .voice import CURVES, LFO_WAVES, NAME_SIZE, VOICES, note_name, param_max
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
def _require():
|
|
58
|
+
if lv is None:
|
|
59
|
+
raise ImportError("this panel needs LVGL and controlkit (PyDevices/apps, lib/controlkit)")
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
PAGES = ("bank", "algo", "op1", "op2", "op3", "op4", "op5", "op6", "global")
|
|
63
|
+
TAB_LEGENDS = ("Bank", "Algo", "Op 1", "Op 2", "Op 3", "Op 4", "Op 5", "Op 6", "Global")
|
|
64
|
+
DISPLAY_COLUMNS = 16
|
|
65
|
+
#: How long the display shows a value after the last turn, in milliseconds.
|
|
66
|
+
SHOW_MS = 1800
|
|
67
|
+
_TICK_MS = 100
|
|
68
|
+
#: The stage of a four-stage envelope whose level holds while a key is down.
|
|
69
|
+
SUSTAIN_STAGE = 2
|
|
70
|
+
ENC_MAX = 127
|
|
71
|
+
#: The meter's segments, and the pads that choose a MIDI channel: all of them,
|
|
72
|
+
#: 1 to 16, and one that goes back.
|
|
73
|
+
METER_SEGMENTS = 10
|
|
74
|
+
CHANNELS = 16
|
|
75
|
+
CHANNEL_PADS = CHANNELS + 2
|
|
76
|
+
#: With Bluetooth there are three more pads, BT OFF, BT ON and BT NEW, before
|
|
77
|
+
#: the one that goes back, in rows of this many.
|
|
78
|
+
BLUETOOTH_PADS = 21
|
|
79
|
+
BLUETOOTH_COLS = 7
|
|
80
|
+
#: The Bluetooth pads, by where they are in the grid.
|
|
81
|
+
BT_OFF = CHANNELS + 1
|
|
82
|
+
BT_ON = CHANNELS + 2
|
|
83
|
+
BT_NEW = CHANNELS + 3
|
|
84
|
+
|
|
85
|
+
# What the encoders edit. Each row is (parameter, legend, name on the display,
|
|
86
|
+
# ring mode, how the value reads). The legend carries the value too, so it is
|
|
87
|
+
# kept short.
|
|
88
|
+
_EG = (
|
|
89
|
+
("rate1", "R1", "EG RATE 1", "fill", None),
|
|
90
|
+
("rate2", "R2", "EG RATE 2", "fill", None),
|
|
91
|
+
("rate3", "R3", "EG RATE 3", "fill", None),
|
|
92
|
+
("rate4", "R4", "EG RATE 4", "fill", None),
|
|
93
|
+
("level1", "L1", "EG LEVL 1", "fill", None),
|
|
94
|
+
("level2", "L2", "EG LEVL 2", "fill", None),
|
|
95
|
+
("level3", "L3", "EG LEVL 3", "fill", None),
|
|
96
|
+
("level4", "L4", "EG LEVL 4", "fill", None),
|
|
97
|
+
)
|
|
98
|
+
_PITCH_EG = (
|
|
99
|
+
("pitch_rate1", "R1", "PITCH RATE 1", "fill", None),
|
|
100
|
+
("pitch_rate2", "R2", "PITCH RATE 2", "fill", None),
|
|
101
|
+
("pitch_rate3", "R3", "PITCH RATE 3", "fill", None),
|
|
102
|
+
("pitch_rate4", "R4", "PITCH RATE 4", "fill", None),
|
|
103
|
+
("pitch_level1", "L1", "PITCH LEVEL 1", "bipolar", None),
|
|
104
|
+
("pitch_level2", "L2", "PITCH LEVEL 2", "bipolar", None),
|
|
105
|
+
("pitch_level3", "L3", "PITCH LEVEL 3", "bipolar", None),
|
|
106
|
+
("pitch_level4", "L4", "PITCH LEVEL 4", "bipolar", None),
|
|
107
|
+
)
|
|
108
|
+
# The operator page's right side, three rows of five cells. None is a cell
|
|
109
|
+
# something else takes: the routing diagram, or the FIXED button.
|
|
110
|
+
_OP_ROWS = (
|
|
111
|
+
(
|
|
112
|
+
("level", "Level", "OUT LEVEL", "fill", None),
|
|
113
|
+
("velocity", "Veloc", "VEL SENS", "dot", None),
|
|
114
|
+
("amp_mod", "A Mod", "AMP MOD", "dot", None),
|
|
115
|
+
None,
|
|
116
|
+
None,
|
|
117
|
+
),
|
|
118
|
+
(
|
|
119
|
+
("coarse", "Coarse", "COARSE", "dot", "coarse"),
|
|
120
|
+
("fine", "Fine", "FINE", "fill", None),
|
|
121
|
+
("detune", "Detune", "DETUNE", "bipolar", "detune"),
|
|
122
|
+
None,
|
|
123
|
+
("rate_scale", "R Scale", "RATE SCAL", "dot", None),
|
|
124
|
+
),
|
|
125
|
+
(
|
|
126
|
+
("break_point", "Break", "BREAK PT", "dot", "note"),
|
|
127
|
+
("left_depth", "L Dep", "L DEPTH", "fill", None),
|
|
128
|
+
("left_curve", "L", "L CURVE", "dot", "curve"),
|
|
129
|
+
("right_depth", "R Dep", "R DEPTH", "fill", None),
|
|
130
|
+
("right_curve", "R", "R CURVE", "dot", "curve"),
|
|
131
|
+
),
|
|
132
|
+
)
|
|
133
|
+
_GLOBAL_ROWS = (
|
|
134
|
+
(
|
|
135
|
+
("lfo_speed", "Speed", "LFO SPEED", "fill", None),
|
|
136
|
+
("lfo_delay", "Delay", "LFO DELAY", "fill", None),
|
|
137
|
+
("lfo_pitch_depth", "P Dep", "LFO PITCH DEP", "fill", None),
|
|
138
|
+
("lfo_amp_depth", "A Dep", "LFO AMP DEPTH", "fill", None),
|
|
139
|
+
("lfo_wave", "", "WAVE", "dot", "wave"),
|
|
140
|
+
),
|
|
141
|
+
(
|
|
142
|
+
("lfo_pitch_sens", "P Sens", "PITCH MOD SENS", "dot", None),
|
|
143
|
+
None,
|
|
144
|
+
None,
|
|
145
|
+
("transpose", "Trans", "TRANSPOSE", "bipolar", "transpose"),
|
|
146
|
+
None,
|
|
147
|
+
),
|
|
148
|
+
(
|
|
149
|
+
("name_pos", "Char", "NAME POSITION", "dot", "pos"),
|
|
150
|
+
("name_char", "Letter", "NAME LETTER", "fill", "char"),
|
|
151
|
+
None,
|
|
152
|
+
None,
|
|
153
|
+
("volume", "Vol", "VOLUME", "fill", "volume"),
|
|
154
|
+
),
|
|
155
|
+
)
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
def _to_enc(value, top):
|
|
159
|
+
return (value * ENC_MAX + top // 2) // top
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
def _from_enc(value, top):
|
|
163
|
+
return (value * top + ENC_MAX // 2) // ENC_MAX
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
def _signed(value):
|
|
167
|
+
return "+%d" % value if value > 0 else "%d" % value
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
class _Knob:
|
|
171
|
+
"""One encoder and what it edits."""
|
|
172
|
+
|
|
173
|
+
def __init__(self, enc, where, name, legend, long_name, top, reads):
|
|
174
|
+
self.enc = enc
|
|
175
|
+
#: "op" (the page's operator), an operator number, "voice", "name", or
|
|
176
|
+
#: "app" for what isn't part of the voice.
|
|
177
|
+
self.where = where
|
|
178
|
+
self.name = name
|
|
179
|
+
self.legend = legend
|
|
180
|
+
self.long_name = long_name
|
|
181
|
+
self.top = top
|
|
182
|
+
self.reads = reads
|
|
183
|
+
#: The envelope view and stage this one moves, as (view, "rate" or "level", stage).
|
|
184
|
+
self.stage = None
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
class Panel:
|
|
188
|
+
"""The built panel, and the few things that update it.
|
|
189
|
+
|
|
190
|
+
*editor* is what it edits. *screen* is the object to build on (the
|
|
191
|
+
active screen by default) and *group* the input group the encoders join
|
|
192
|
+
(the default group). *theme* is a controlkit theme name or dict.
|
|
193
|
+
*engine_text* is the small print under the name. *channel* is the MIDI
|
|
194
|
+
channel listened to, 1 to 16 or 0 for all, and ``on_channel(channel)`` is
|
|
195
|
+
called when another is chosen on the panel. *bluetooth* is None on a
|
|
196
|
+
board with no Bluetooth MIDI, or whether it's on; ``on_bluetooth(on)`` is
|
|
197
|
+
called when its pads turn it on or off, and ``on_bluetooth_new()`` when
|
|
198
|
+
BT NEW is pressed. *volume* is the VOLUME knob's
|
|
199
|
+
step, 0 to *volume_steps*, or None for a panel with no such knob;
|
|
200
|
+
*volume_default* is where a double-click sends it, ``volume_text(step)``
|
|
201
|
+
what it reads, and ``on_volume(step)`` is called when it is turned.
|
|
202
|
+
"""
|
|
203
|
+
|
|
204
|
+
def __init__(self, editor, screen=None, group=None, theme=None, engine_text="", engine_ok=True, channel=0,
|
|
205
|
+
on_channel=None, bluetooth=None, on_bluetooth=None, on_bluetooth_new=None, volume=None, volume_steps=1,
|
|
206
|
+
volume_default=0, volume_text=None, on_volume=None):
|
|
207
|
+
self.editor = editor
|
|
208
|
+
self.screen = screen if screen is not None else lv.screen_active()
|
|
209
|
+
self.group = group if group is not None else lv.group_get_default()
|
|
210
|
+
self.theme = resolve(theme)
|
|
211
|
+
self.fine = False
|
|
212
|
+
self.page = None
|
|
213
|
+
self.op = 1
|
|
214
|
+
self.knobs = []
|
|
215
|
+
self.pages = {}
|
|
216
|
+
self.tabs = []
|
|
217
|
+
self.name_pos = 0
|
|
218
|
+
self._page_knobs = {}
|
|
219
|
+
self._show_until = 0
|
|
220
|
+
self._timer = None
|
|
221
|
+
self._built = {}
|
|
222
|
+
self.channel = channel
|
|
223
|
+
self.on_channel = on_channel
|
|
224
|
+
self.bluetooth = bluetooth
|
|
225
|
+
self.on_bluetooth = on_bluetooth
|
|
226
|
+
self.on_bluetooth_new = on_bluetooth_new
|
|
227
|
+
self.volume = volume
|
|
228
|
+
self.volume_steps = volume_steps
|
|
229
|
+
self.volume_default = volume_default
|
|
230
|
+
self._volume_text = volume_text
|
|
231
|
+
self.on_volume = on_volume
|
|
232
|
+
self._pads = CHANNEL_PADS if bluetooth is None else BLUETOOTH_PADS
|
|
233
|
+
#: The level meter and the MIDI button, or None on a display with no
|
|
234
|
+
#: room for them in the header.
|
|
235
|
+
self.meter = None
|
|
236
|
+
self.midi_button = None
|
|
237
|
+
self._midi_lamp = None
|
|
238
|
+
self._channels = None
|
|
239
|
+
self._build(engine_text, engine_ok)
|
|
240
|
+
editor.on_change = self._changed_outside
|
|
241
|
+
|
|
242
|
+
# ---- sizes --------------------------------------------------------------------
|
|
243
|
+
|
|
244
|
+
def _s(self, value):
|
|
245
|
+
return max(1, int(value * self.scale + 0.5))
|
|
246
|
+
|
|
247
|
+
# ---- what an encoder asks of its panel ------------------------------------------
|
|
248
|
+
|
|
249
|
+
def default_value(self, index):
|
|
250
|
+
"""Where a double-click sends encoder *index*: the stored voice's value."""
|
|
251
|
+
knob = self.knobs[index]
|
|
252
|
+
if knob.where == "app":
|
|
253
|
+
return _to_enc(self.volume_default, knob.top)
|
|
254
|
+
return _to_enc(self._read(knob, self.editor.stored), knob.top)
|
|
255
|
+
|
|
256
|
+
def _focused(self, enc):
|
|
257
|
+
knob = self.knobs[enc.index]
|
|
258
|
+
self._light_stage(knob)
|
|
259
|
+
self._show_value(knob)
|
|
260
|
+
|
|
261
|
+
def _turned(self, enc, value):
|
|
262
|
+
knob = self.knobs[enc.index]
|
|
263
|
+
old = self._read(knob, self.editor.voice)
|
|
264
|
+
new = _from_enc(value, knob.top)
|
|
265
|
+
if new == old and self._stepped():
|
|
266
|
+
# One notch of a wheel or an arrow key is less than one step of a
|
|
267
|
+
# parameter with few values: it still moves it by one.
|
|
268
|
+
new = old + (1 if value > _to_enc(old, knob.top) else -1)
|
|
269
|
+
new = 0 if new < 0 else (knob.top if new > knob.top else new)
|
|
270
|
+
if new != old and not self._write(knob, new):
|
|
271
|
+
new = old
|
|
272
|
+
self.flash("COMPARE: NO EDIT")
|
|
273
|
+
enc.set_value(_to_enc(new, knob.top))
|
|
274
|
+
if new == old:
|
|
275
|
+
return
|
|
276
|
+
self._after_edit(knob)
|
|
277
|
+
|
|
278
|
+
def _stepped(self):
|
|
279
|
+
"""True when the turn came from a wheel or a key, not from a drag."""
|
|
280
|
+
indev = lv.indev_active()
|
|
281
|
+
return indev is not None and indev.get_type() != lv.INDEV_TYPE.POINTER
|
|
282
|
+
|
|
283
|
+
# ---- reading and writing the voice ------------------------------------------------
|
|
284
|
+
|
|
285
|
+
def _read(self, knob, voice):
|
|
286
|
+
where = knob.where
|
|
287
|
+
if where == "app":
|
|
288
|
+
return self.volume
|
|
289
|
+
if where == "voice":
|
|
290
|
+
return voice.get(knob.name)
|
|
291
|
+
if where == "name":
|
|
292
|
+
if knob.name == "name_pos":
|
|
293
|
+
return self.name_pos
|
|
294
|
+
code = voice.data[145 + self.name_pos]
|
|
295
|
+
return min(max(code - 32, 0), knob.top)
|
|
296
|
+
return voice.op(self.op if where == "op" else where).get(knob.name)
|
|
297
|
+
|
|
298
|
+
def _write(self, knob, value):
|
|
299
|
+
editor = self.editor
|
|
300
|
+
where = knob.where
|
|
301
|
+
if where == "app":
|
|
302
|
+
# Not part of the voice: it turns while comparing, too.
|
|
303
|
+
self.volume = value
|
|
304
|
+
if self.on_volume is not None:
|
|
305
|
+
self.on_volume(value)
|
|
306
|
+
return True
|
|
307
|
+
if where == "voice":
|
|
308
|
+
return editor.set_voice(knob.name, value)
|
|
309
|
+
if where == "name":
|
|
310
|
+
if knob.name == "name_pos":
|
|
311
|
+
self.name_pos = value
|
|
312
|
+
return True
|
|
313
|
+
name = list(editor.voice.name + " " * NAME_SIZE)[:NAME_SIZE]
|
|
314
|
+
name[self.name_pos] = chr(32 + value)
|
|
315
|
+
return editor.set_name("".join(name).rstrip())
|
|
316
|
+
return editor.set_op(self.op if where == "op" else where, knob.name, value)
|
|
317
|
+
|
|
318
|
+
def _text(self, knob, value):
|
|
319
|
+
reads = knob.reads
|
|
320
|
+
if reads is None:
|
|
321
|
+
return "%d" % value
|
|
322
|
+
if reads == "volume":
|
|
323
|
+
return self._volume_text(value) if self._volume_text is not None else "%d" % value
|
|
324
|
+
if reads == "detune":
|
|
325
|
+
return _signed(value - 7)
|
|
326
|
+
if reads == "transpose":
|
|
327
|
+
return _signed(value - 24)
|
|
328
|
+
if reads == "curve":
|
|
329
|
+
return CURVES[value]
|
|
330
|
+
if reads == "wave":
|
|
331
|
+
return LFO_WAVES[value]
|
|
332
|
+
if reads == "note":
|
|
333
|
+
return note_name(value)
|
|
334
|
+
if reads == "alg":
|
|
335
|
+
return "%d" % (value + 1)
|
|
336
|
+
if reads == "pos":
|
|
337
|
+
return "%d" % (value + 1)
|
|
338
|
+
if reads == "char":
|
|
339
|
+
return "[%s]" % chr(32 + value)
|
|
340
|
+
if reads == "coarse":
|
|
341
|
+
if self.editor.voice.op(self.op).get("fixed"):
|
|
342
|
+
return ("1Hz", "10Hz", "100Hz", "1kHz")[value & 3]
|
|
343
|
+
return "0.5" if value == 0 else "%d" % value
|
|
344
|
+
return "%d" % value
|
|
345
|
+
|
|
346
|
+
# ---- showing ------------------------------------------------------------------------
|
|
347
|
+
|
|
348
|
+
def _show_knob(self, knob):
|
|
349
|
+
"""Move one encoder and its legend to the voice's value."""
|
|
350
|
+
value = self._read(knob, self.editor.voice)
|
|
351
|
+
knob.enc.set_value(_to_enc(value, knob.top))
|
|
352
|
+
text = self._text(knob, value)
|
|
353
|
+
legend = knob.legend
|
|
354
|
+
if knob.reads == "coarse" and self.editor.voice.op(self.op).get("fixed"):
|
|
355
|
+
legend = "Fix"
|
|
356
|
+
knob.enc.legend.set_text(("%s %s" % (legend, text)).strip().upper())
|
|
357
|
+
|
|
358
|
+
def _light_stage(self, knob):
|
|
359
|
+
if knob.stage is not None:
|
|
360
|
+
knob.stage[0].set_selected(knob.stage[2])
|
|
361
|
+
|
|
362
|
+
def _show_value(self, knob):
|
|
363
|
+
value = self._read(knob, self.editor.voice)
|
|
364
|
+
text = self._text(knob, value).upper()
|
|
365
|
+
name = knob.long_name
|
|
366
|
+
if knob.where == "op":
|
|
367
|
+
name = "OP%d %s" % (self.op, name)
|
|
368
|
+
elif knob.where not in ("voice", "name", "app"):
|
|
369
|
+
name = "OP%d %s" % (knob.where, name)
|
|
370
|
+
room = DISPLAY_COLUMNS - len(text) - 1
|
|
371
|
+
self.display.set_line(1, "%s %s" % (name[:room] + " " * (room - len(name[:room])), text))
|
|
372
|
+
self._show_until = lv.tick_get() + SHOW_MS
|
|
373
|
+
if knob.where == "name":
|
|
374
|
+
self._show_until = 0
|
|
375
|
+
self.display.set_line(1, " " * (3 + self.name_pos) + "^")
|
|
376
|
+
|
|
377
|
+
def _after_edit(self, knob):
|
|
378
|
+
"""A knob changed the voice: repaint what depends on it."""
|
|
379
|
+
self._show_knob(knob)
|
|
380
|
+
stage = knob.stage
|
|
381
|
+
if stage is not None:
|
|
382
|
+
view, kind, index = stage
|
|
383
|
+
value = self._read(knob, self.editor.voice)
|
|
384
|
+
if kind == "rate":
|
|
385
|
+
view.set_rate(index, value)
|
|
386
|
+
else:
|
|
387
|
+
view.set_level(index, value)
|
|
388
|
+
view.set_selected(index)
|
|
389
|
+
name = knob.name
|
|
390
|
+
if name == "algorithm":
|
|
391
|
+
self._draw_graph(self._built.get("algo_diagram"))
|
|
392
|
+
elif name == "name_pos":
|
|
393
|
+
self._show_knob(self._named("name_char"))
|
|
394
|
+
self._show_title()
|
|
395
|
+
self._show_value(knob)
|
|
396
|
+
|
|
397
|
+
def _named(self, name):
|
|
398
|
+
for knob in self._page_knobs.get(self._page_key(), ()):
|
|
399
|
+
if knob.name == name:
|
|
400
|
+
return knob
|
|
401
|
+
return None
|
|
402
|
+
|
|
403
|
+
def _show_title(self):
|
|
404
|
+
"""The display's first line: the slot, the voice's name and whether it is edited."""
|
|
405
|
+
editor = self.editor
|
|
406
|
+
mark = "=" if editor.comparing else ("*" if editor.edited else " ")
|
|
407
|
+
name = editor.voice.name
|
|
408
|
+
self.display.set_line(0, "%02d %s%s%s" % (editor.slot + 1, name, " " * (11 - len(name)), mark))
|
|
409
|
+
self.compare.set_lamp(self.theme["amber"] if editor.edited else None)
|
|
410
|
+
|
|
411
|
+
def _idle_text(self):
|
|
412
|
+
"""The display's second line while nothing is being turned."""
|
|
413
|
+
editor = self.editor
|
|
414
|
+
voice = editor.voice
|
|
415
|
+
page = self.page
|
|
416
|
+
if page == "bank":
|
|
417
|
+
name = editor.file or "NO BANK FILE"
|
|
418
|
+
return name[:-4] if name.lower().endswith(".syx") else name
|
|
419
|
+
if page == "algo":
|
|
420
|
+
return "ALGO %02d FBACK %d" % (voice.get("algorithm") + 1, voice.get("feedback"))
|
|
421
|
+
if page == "global":
|
|
422
|
+
return "LFO %s" % LFO_WAVES[voice.get("lfo_wave")]
|
|
423
|
+
op = voice.op(self.op)
|
|
424
|
+
heard = self.op in algorithms.carriers(voice.get("algorithm") + 1)
|
|
425
|
+
return "OP%d %s %s" % (self.op, "CAR" if heard else "MOD", op.frequency_text())
|
|
426
|
+
|
|
427
|
+
def _show_idle(self):
|
|
428
|
+
self._show_until = 0
|
|
429
|
+
self.display.set_line(1, self._idle_text().upper())
|
|
430
|
+
|
|
431
|
+
def flash(self, text):
|
|
432
|
+
"""Show *text* on the display's second line for a moment."""
|
|
433
|
+
self.display.set_line(1, text.upper())
|
|
434
|
+
self._show_until = lv.tick_get() + SHOW_MS
|
|
435
|
+
|
|
436
|
+
def _tick(self, _timer):
|
|
437
|
+
if self._show_until and lv.tick_get() >= self._show_until:
|
|
438
|
+
self._show_idle()
|
|
439
|
+
|
|
440
|
+
# ---- construction -------------------------------------------------------------------
|
|
441
|
+
|
|
442
|
+
def _build(self, engine_text, engine_ok):
|
|
443
|
+
theme = self.theme
|
|
444
|
+
screen = self.screen
|
|
445
|
+
screen.update_layout()
|
|
446
|
+
width = screen.get_width()
|
|
447
|
+
height = screen.get_height()
|
|
448
|
+
self.width = width
|
|
449
|
+
self.height = height
|
|
450
|
+
self.scale = min(width / 800, height / 480)
|
|
451
|
+
s = self._s
|
|
452
|
+
self.travel = s(200)
|
|
453
|
+
|
|
454
|
+
root = _box(screen, 0, 0, width, height)
|
|
455
|
+
_fill(root, theme["face"])
|
|
456
|
+
_finish(root, theme["face"], theme["face_finish"])
|
|
457
|
+
root.add_event_cb(safe(self._on_delete), lv.EVENT.DELETE, None)
|
|
458
|
+
self.root = root
|
|
459
|
+
|
|
460
|
+
header_h = s(70)
|
|
461
|
+
self._build_header(header_h, engine_text, engine_ok)
|
|
462
|
+
tabs_y = header_h + s(5)
|
|
463
|
+
tabs_h = self._build_tabs(tabs_y)
|
|
464
|
+
self.top = tabs_y + tabs_h + s(5)
|
|
465
|
+
_fill(_box(root, s(16), self.top - s(3), width - 2 * s(16), 1), theme["rule"])
|
|
466
|
+
|
|
467
|
+
self._show_title()
|
|
468
|
+
self.show("bank")
|
|
469
|
+
self._timer = lv.timer_create(safe(self._tick), _TICK_MS, None)
|
|
470
|
+
|
|
471
|
+
def _build_header(self, h, engine_text, engine_ok):
|
|
472
|
+
theme = self.theme
|
|
473
|
+
s = self._s
|
|
474
|
+
width = self.width
|
|
475
|
+
header = _box(self.root, 0, 0, width, h)
|
|
476
|
+
_fill(header, theme["header"])
|
|
477
|
+
_finish(header, theme["header"], theme["header_finish"])
|
|
478
|
+
_fill(_box(self.root, 0, h, width, 1), theme["bevel_dark"])
|
|
479
|
+
_fill(_box(self.root, 0, h + 1, width, 1), theme["bevel_light"])
|
|
480
|
+
self.header = header
|
|
481
|
+
|
|
482
|
+
# FINE and COMPARE on the right.
|
|
483
|
+
button_w = max(s(78), 78)
|
|
484
|
+
gap = s(8)
|
|
485
|
+
cap_h = max(s(26), 22)
|
|
486
|
+
x = width - s(24) - 2 * button_w - gap
|
|
487
|
+
right_start = x
|
|
488
|
+
y = max(0, (h - cap_h - 16) // 2)
|
|
489
|
+
self.fine_button = LampButton(header, x, y, button_w, cap_h, theme, legend="Fine", toggle=True,
|
|
490
|
+
on_press=self._on_fine)
|
|
491
|
+
self.compare = LampButton(header, x + button_w + gap, y, button_w, cap_h, theme, legend="Compare",
|
|
492
|
+
on_press=self._on_compare)
|
|
493
|
+
|
|
494
|
+
# The display, left of the buttons.
|
|
495
|
+
pitch = 2 if self.scale < 0.9 else (3 if self.scale < 1.3 else 4)
|
|
496
|
+
columns = DISPLAY_COLUMNS
|
|
497
|
+
matrix_w = columns * 6 * pitch - pitch
|
|
498
|
+
matrix_h = 2 * 8 * pitch + pitch
|
|
499
|
+
bezel_w = matrix_w + 2 * s(8)
|
|
500
|
+
bezel_h = min(h - s(8), matrix_h + 2 * s(5))
|
|
501
|
+
bezel_x = right_start - s(20) - bezel_w
|
|
502
|
+
bezel_y = (h - bezel_h) // 2
|
|
503
|
+
bezel = _box(header, bezel_x, bezel_y, bezel_w, bezel_h)
|
|
504
|
+
_fill(bezel, theme["display_bezel"])
|
|
505
|
+
bezel.set_style_radius(s(4), 0)
|
|
506
|
+
bezel.set_style_border_width(1, 0)
|
|
507
|
+
bezel.set_style_border_color(lv.color_hex(theme["bevel_light"]), 0)
|
|
508
|
+
bezel.set_style_border_side(lv.BORDER_SIDE.BOTTOM, 0)
|
|
509
|
+
window = _box(bezel, s(4), s(3), bezel_w - 2 * s(4), bezel_h - 2 * s(3) - 1)
|
|
510
|
+
_fill(window, theme["display_bg"])
|
|
511
|
+
window.set_style_radius(s(2), 0)
|
|
512
|
+
self.display = DotMatrix(window, columns, 2, pitch, theme)
|
|
513
|
+
self.display.obj.set_pos(
|
|
514
|
+
(bezel_w - 2 * s(4) - matrix_w) // 2,
|
|
515
|
+
(bezel_h - 2 * s(3) - 1 - self.display.height) // 2,
|
|
516
|
+
)
|
|
517
|
+
|
|
518
|
+
# The name plate on the left, with the engine's lamp and a line of small print.
|
|
519
|
+
left = s(28)
|
|
520
|
+
plate_w = max(1, bezel_x - left - s(12))
|
|
521
|
+
big = self.scale >= 0.9
|
|
522
|
+
brand = _label(header, "FMSYNTH", theme["brand"], lv.font_montserrat_24 if big else lv.font_montserrat_16, 3)
|
|
523
|
+
brand.set_pos(left, s(11) if big else s(14))
|
|
524
|
+
lens = max(2.0, s(5) * 0.8)
|
|
525
|
+
self.engine_lamp = _Lamp(header, left + lens + 1, s(51), lens, theme)
|
|
526
|
+
self.engine_lamp.set(theme["status_ok"] if engine_ok else theme["status_wait"])
|
|
527
|
+
sub = _label(header, engine_text.upper(), theme["header_legend_dim"], None, 1)
|
|
528
|
+
sub.set_long_mode(lv.label.LONG_MODE.DOTS)
|
|
529
|
+
sub_x = left + int(2 * lens) + s(10)
|
|
530
|
+
sub.set_pos(sub_x, s(43))
|
|
531
|
+
self.subtitle = sub
|
|
532
|
+
|
|
533
|
+
# Between the name and the display, if they fit: the level meter and
|
|
534
|
+
# the MIDI button. The small print stops short of them.
|
|
535
|
+
brand.update_layout()
|
|
536
|
+
meter_w = s(12)
|
|
537
|
+
midi_w = max(s(72), 64)
|
|
538
|
+
strip_w = meter_w + s(8) + midi_w
|
|
539
|
+
strip_x = bezel_x - s(14) - strip_w
|
|
540
|
+
if strip_x >= left + brand.get_width() + s(8):
|
|
541
|
+
pad = s(6)
|
|
542
|
+
self.meter = LedMeter(header, strip_x, pad, meter_w, h - 2 * pad, theme, segments=METER_SEGMENTS)
|
|
543
|
+
self.midi_button = LampButton(header, strip_x + meter_w + s(8), y, midi_w, cap_h, theme, legend="MIDI",
|
|
544
|
+
on_press=self._on_midi_button)
|
|
545
|
+
self.midi_button.set_lamp(None)
|
|
546
|
+
# The cap says which channel is listened to, left of its lamp.
|
|
547
|
+
text = _label(self.midi_button.cap, "", theme["button_text"], None, 0)
|
|
548
|
+
text.set_width(midi_w - 14)
|
|
549
|
+
text.set_style_text_align(lv.TEXT_ALIGN.CENTER, 0)
|
|
550
|
+
text.set_pos(0, (cap_h - 16) // 2)
|
|
551
|
+
self._channel_text = text
|
|
552
|
+
self._show_channel()
|
|
553
|
+
plate_w = strip_x - s(8) - left
|
|
554
|
+
sub.set_size(max(1, left + plate_w - sub_x), 16)
|
|
555
|
+
|
|
556
|
+
def _build_tabs(self, y):
|
|
557
|
+
theme = self.theme
|
|
558
|
+
s = self._s
|
|
559
|
+
inset = s(16)
|
|
560
|
+
gap = s(6)
|
|
561
|
+
count = len(PAGES)
|
|
562
|
+
tab_w = (self.width - 2 * inset - (count - 1) * gap) // count
|
|
563
|
+
cap_h = max(s(22), 18)
|
|
564
|
+
for i, legend in enumerate(TAB_LEGENDS):
|
|
565
|
+
button = LampButton(self.root, inset + i * (tab_w + gap), y, tab_w, cap_h, theme, legend=legend,
|
|
566
|
+
on_press=lambda b, on, page=PAGES[i]: self.show(page))
|
|
567
|
+
self.tabs.append(button)
|
|
568
|
+
return cap_h + 16
|
|
569
|
+
|
|
570
|
+
def _page_box(self):
|
|
571
|
+
page = _box(self.root, 0, self.top, self.width, self.height - self.top)
|
|
572
|
+
return page
|
|
573
|
+
|
|
574
|
+
# ---- encoders -------------------------------------------------------------------------
|
|
575
|
+
|
|
576
|
+
def _knob(self, parent, page_key, where, spec, top, x, y, w, h):
|
|
577
|
+
name, legend, long_name, mode, reads = spec
|
|
578
|
+
index = len(self.knobs)
|
|
579
|
+
geom = _encoder.geometry(w, h, self.scale)
|
|
580
|
+
enc = _encoder.Encoder(self, parent, index, legend, x, y, w, h, geom, self.theme, True, mode)
|
|
581
|
+
knob = _Knob(enc, where, name, legend, long_name, top, reads)
|
|
582
|
+
self.knobs.append(knob)
|
|
583
|
+
self._page_knobs.setdefault(page_key, []).append(knob)
|
|
584
|
+
# Joining the group can focus the encoder at once, which asks the panel about it.
|
|
585
|
+
if self.group is not None:
|
|
586
|
+
self.group.add_obj(enc.obj)
|
|
587
|
+
return knob
|
|
588
|
+
|
|
589
|
+
def _envelope_block(self, parent, page_key, where, specs, legend, x, y, w, h):
|
|
590
|
+
"""An envelope view over two rows of four encoders: the rates, then the levels."""
|
|
591
|
+
s = self._s
|
|
592
|
+
view_h = h - 2 * s(110) - s(4)
|
|
593
|
+
view = EnvelopeView(parent, x, y, w, view_h, self.theme, stages=4, sustain=SUSTAIN_STAGE, maximum=99,
|
|
594
|
+
legend=legend)
|
|
595
|
+
cell_w = w // 4
|
|
596
|
+
cell_h = s(110)
|
|
597
|
+
for i, spec in enumerate(specs):
|
|
598
|
+
row, column = divmod(i, 4)
|
|
599
|
+
knob = self._knob(parent, page_key, where, spec, 99, x + column * cell_w,
|
|
600
|
+
y + view_h + s(4) + row * cell_h, cell_w, cell_h)
|
|
601
|
+
knob.stage = (view, "rate" if row == 0 else "level", column)
|
|
602
|
+
return view
|
|
603
|
+
|
|
604
|
+
def _grid(self, parent, page_key, where, rows, x, y, w, h):
|
|
605
|
+
"""Rows of five encoder cells; returns the cells left empty as (row, column, x, y, w, h)."""
|
|
606
|
+
cell_w = w // 5
|
|
607
|
+
cell_h = h // len(rows)
|
|
608
|
+
empty = []
|
|
609
|
+
for r, row in enumerate(rows):
|
|
610
|
+
for c, spec in enumerate(row):
|
|
611
|
+
cx = x + c * cell_w
|
|
612
|
+
cy = y + r * cell_h
|
|
613
|
+
if spec is None:
|
|
614
|
+
empty.append((r, c, cx, cy, cell_w, cell_h))
|
|
615
|
+
continue
|
|
616
|
+
if spec[0] == "volume":
|
|
617
|
+
if self.volume is None:
|
|
618
|
+
empty.append((r, c, cx, cy, cell_w, cell_h))
|
|
619
|
+
else:
|
|
620
|
+
self._knob(parent, page_key, "app", spec, self.volume_steps, cx, cy, cell_w, cell_h)
|
|
621
|
+
elif spec[0].startswith("name_"):
|
|
622
|
+
top = NAME_SIZE - 1 if spec[0] == "name_pos" else 94
|
|
623
|
+
self._knob(parent, page_key, "name", spec, top, cx, cy, cell_w, cell_h)
|
|
624
|
+
else:
|
|
625
|
+
self._knob(parent, page_key, where, spec, param_max(spec[0]), cx, cy, cell_w, cell_h)
|
|
626
|
+
return empty
|
|
627
|
+
|
|
628
|
+
def _cell_button(self, parent, cell, legend, on_press, toggle=True):
|
|
629
|
+
"""A lamp button in the middle of an encoder cell."""
|
|
630
|
+
s = self._s
|
|
631
|
+
_r, _c, x, y, w, h = cell
|
|
632
|
+
button_w = w - s(8)
|
|
633
|
+
cap_h = max(s(30), 22)
|
|
634
|
+
return LampButton(parent, x + (w - button_w) // 2, y + (h - cap_h - 16) // 2, button_w, cap_h, self.theme,
|
|
635
|
+
legend=legend, toggle=toggle, on_press=on_press)
|
|
636
|
+
|
|
637
|
+
# ---- the pages ------------------------------------------------------------------------
|
|
638
|
+
|
|
639
|
+
def _build_bank(self):
|
|
640
|
+
s = self._s
|
|
641
|
+
theme = self.theme
|
|
642
|
+
page = self._page_box()
|
|
643
|
+
inset = s(16)
|
|
644
|
+
w = self.width - 2 * inset
|
|
645
|
+
h = self.height - self.top
|
|
646
|
+
buttons_h = s(30) + 16 + s(14)
|
|
647
|
+
grid_h = h - buttons_h - s(14)
|
|
648
|
+
grid = PadGrid(page, inset, s(6), w, grid_h, theme, cols=4, rows=VOICES // 4, gap=s(6),
|
|
649
|
+
on_press=self._on_pad)
|
|
650
|
+
self._built["pads"] = grid
|
|
651
|
+
self._pad_lit = None
|
|
652
|
+
|
|
653
|
+
names = ("File -", "File +", "Load", "Save", "Store", "Init")
|
|
654
|
+
handlers = (self._on_file_prev, self._on_file_next, self._on_load, self._on_save, self._on_store,
|
|
655
|
+
self._on_init)
|
|
656
|
+
gap = s(10)
|
|
657
|
+
button_w = (w - 5 * gap - s(24)) // 6
|
|
658
|
+
y = s(6) + grid_h + s(10)
|
|
659
|
+
_fill(_box(page, inset, y - s(5), w, 1), theme["rule"])
|
|
660
|
+
self._built["bank_buttons"] = []
|
|
661
|
+
for i, name in enumerate(names):
|
|
662
|
+
x = inset + i * (button_w + gap) + (s(24) if i >= 4 else 0)
|
|
663
|
+
button = LampButton(page, x, y, button_w, s(30), theme, legend=name, lamp=None,
|
|
664
|
+
on_press=lambda b, on, fn=handlers[i]: fn())
|
|
665
|
+
button.set_lamp(None)
|
|
666
|
+
self._built["bank_buttons"].append(button)
|
|
667
|
+
self._file_index = None
|
|
668
|
+
return page
|
|
669
|
+
|
|
670
|
+
def _build_algo(self):
|
|
671
|
+
s = self._s
|
|
672
|
+
theme = self.theme
|
|
673
|
+
page = self._page_box()
|
|
674
|
+
inset = s(16)
|
|
675
|
+
w = self.width - 2 * inset
|
|
676
|
+
h = self.height - self.top
|
|
677
|
+
levels_h = s(118)
|
|
678
|
+
top_h = h - levels_h - s(8)
|
|
679
|
+
side_w = s(300)
|
|
680
|
+
diagram = RoutingDiagram(page, inset, s(6), w - side_w - s(12), top_h - s(6), theme,
|
|
681
|
+
on_press=self._on_node)
|
|
682
|
+
self._built["algo_diagram"] = diagram
|
|
683
|
+
x = inset + w - side_w
|
|
684
|
+
cell_w = side_w // 2
|
|
685
|
+
self._knob(page, "algo", "voice", ("algorithm", "Algorithm", "ALGORITHM", "dot", "alg"), 31, x, s(6),
|
|
686
|
+
cell_w, top_h - s(6))
|
|
687
|
+
self._knob(page, "algo", "voice", ("feedback", "Feedback", "FEEDBACK", "dot", None), 7, x + cell_w, s(6),
|
|
688
|
+
cell_w, top_h - s(6))
|
|
689
|
+
_fill(_box(page, inset, top_h + s(4), w, 1), theme["rule"])
|
|
690
|
+
cell_w = w // 6
|
|
691
|
+
for number in range(1, 7):
|
|
692
|
+
self._knob(page, "algo", number, ("level", "Op%d" % number, "OUT LEVEL", "fill", None), 99,
|
|
693
|
+
inset + (number - 1) * cell_w, top_h + s(8), cell_w, levels_h)
|
|
694
|
+
return page
|
|
695
|
+
|
|
696
|
+
def _build_op(self):
|
|
697
|
+
s = self._s
|
|
698
|
+
page = self._page_box()
|
|
699
|
+
inset = s(16)
|
|
700
|
+
w = self.width - 2 * inset
|
|
701
|
+
h = self.height - self.top - s(4)
|
|
702
|
+
left_w = s(300)
|
|
703
|
+
view = self._envelope_block(page, "op", "op", _EG, "Envelope", inset, s(4), left_w, h)
|
|
704
|
+
self._built["op_view"] = view
|
|
705
|
+
x = inset + left_w + s(16)
|
|
706
|
+
empty = self._grid(page, "op", "op", _OP_ROWS, x, s(4), w - left_w - s(16), h)
|
|
707
|
+
# The two cells at the end of the first row hold a small diagram of the algorithm.
|
|
708
|
+
first, second, fixed = empty[0], empty[1], empty[2]
|
|
709
|
+
diagram = RoutingDiagram(page, first[2] + s(4), first[3] + s(4), first[4] + second[4] - s(4),
|
|
710
|
+
first[5] - s(10), self.theme, on_press=self._on_node)
|
|
711
|
+
self._built["op_diagram"] = diagram
|
|
712
|
+
self._built["fixed"] = self._cell_button(page, fixed, "Fixed Hz", self._on_fixed)
|
|
713
|
+
return page
|
|
714
|
+
|
|
715
|
+
def _build_global(self):
|
|
716
|
+
s = self._s
|
|
717
|
+
page = self._page_box()
|
|
718
|
+
inset = s(16)
|
|
719
|
+
w = self.width - 2 * inset
|
|
720
|
+
h = self.height - self.top - s(4)
|
|
721
|
+
left_w = s(300)
|
|
722
|
+
view = self._envelope_block(page, "global", "voice", _PITCH_EG, "Pitch envelope", inset, s(4), left_w, h)
|
|
723
|
+
self._built["pitch_view"] = view
|
|
724
|
+
x = inset + left_w + s(16)
|
|
725
|
+
empty = self._grid(page, "global", "voice", _GLOBAL_ROWS, x, s(4), w - left_w - s(16), h)
|
|
726
|
+
self._built["lfo_sync"] = self._cell_button(page, empty[0], "LFO Sync", self._on_lfo_sync)
|
|
727
|
+
self._built["key_sync"] = self._cell_button(page, empty[1], "Key Sync", self._on_key_sync)
|
|
728
|
+
return page
|
|
729
|
+
|
|
730
|
+
def _build_channels(self):
|
|
731
|
+
"""The pads the MIDI button opens, over whichever page is showing."""
|
|
732
|
+
s = self._s
|
|
733
|
+
page = self._page_box()
|
|
734
|
+
inset = s(16)
|
|
735
|
+
w = self.width - 2 * inset
|
|
736
|
+
h = self.height - self.top
|
|
737
|
+
title = _label(page, "MIDI CHANNEL", self.theme["legend"], None, 1)
|
|
738
|
+
title.set_pos(inset, s(8))
|
|
739
|
+
cols = CHANNEL_PADS // 3 if self.bluetooth is None else BLUETOOTH_COLS
|
|
740
|
+
grid = PadGrid(page, inset, s(32), w, h - s(32) - s(14), self.theme, cols=cols, rows=self._pads // cols,
|
|
741
|
+
gap=s(6), on_press=self._on_channel_pad)
|
|
742
|
+
self._built["channel_pads"] = grid
|
|
743
|
+
return page
|
|
744
|
+
|
|
745
|
+
def _show_channel_pads(self):
|
|
746
|
+
grid = self._built["channel_pads"]
|
|
747
|
+
theme = self.theme
|
|
748
|
+
last = self._pads - 1
|
|
749
|
+
for i in range(self._pads):
|
|
750
|
+
if i == last:
|
|
751
|
+
text = "BACK"
|
|
752
|
+
chosen = False
|
|
753
|
+
elif i == BT_NEW:
|
|
754
|
+
text = "BT NEW"
|
|
755
|
+
chosen = False
|
|
756
|
+
elif i > CHANNELS:
|
|
757
|
+
# Two pads, the lit one saying which it is now.
|
|
758
|
+
on = i == BT_ON
|
|
759
|
+
text = "BT ON" if on else "BT OFF"
|
|
760
|
+
chosen = on == bool(self.bluetooth)
|
|
761
|
+
else:
|
|
762
|
+
text = "%d" % i if i else "OMNI"
|
|
763
|
+
chosen = i == self.channel
|
|
764
|
+
grid.set_color(i, theme["pad_lit"] if chosen else None)
|
|
765
|
+
grid.set_label(i, text, theme["pad_lit_text"] if chosen else theme["pad_text"])
|
|
766
|
+
|
|
767
|
+
# ---- the meter, the MIDI light and the channel -------------------------------------------
|
|
768
|
+
|
|
769
|
+
def set_meter(self, level):
|
|
770
|
+
"""Show *level*, 0.0 to 1.0 of the meter's height."""
|
|
771
|
+
if self.meter is not None:
|
|
772
|
+
self.meter.set_level(level)
|
|
773
|
+
|
|
774
|
+
def set_midi_light(self, lit, played=True):
|
|
775
|
+
"""Light the MIDI button's lamp or put it out. *played* is False for a
|
|
776
|
+
note on a channel that isn't listened to, which shows amber."""
|
|
777
|
+
rgb = None
|
|
778
|
+
if lit:
|
|
779
|
+
rgb = self.theme["led_on"] if played else self.theme["amber"]
|
|
780
|
+
if self.midi_button is not None and rgb != self._midi_lamp:
|
|
781
|
+
self._midi_lamp = rgb
|
|
782
|
+
self.midi_button.set_lamp(rgb)
|
|
783
|
+
|
|
784
|
+
def set_status(self, text):
|
|
785
|
+
"""The small print under the name: the render load and the underruns."""
|
|
786
|
+
self.subtitle.set_text(text.upper())
|
|
787
|
+
|
|
788
|
+
def _channel_name(self):
|
|
789
|
+
return "CH %d" % self.channel if self.channel else "OMNI"
|
|
790
|
+
|
|
791
|
+
def _show_channel(self):
|
|
792
|
+
if self.midi_button is not None:
|
|
793
|
+
self._channel_text.set_text(self._channel_name())
|
|
794
|
+
|
|
795
|
+
def set_channel(self, channel):
|
|
796
|
+
"""Show that MIDI channel *channel*, 1 to 16 or 0 for all, is listened to."""
|
|
797
|
+
self.channel = channel
|
|
798
|
+
self._show_channel()
|
|
799
|
+
if self.channels_open:
|
|
800
|
+
self._show_channel_pads()
|
|
801
|
+
self.flash("MIDI %s" % self._channel_name())
|
|
802
|
+
|
|
803
|
+
def set_volume(self, step):
|
|
804
|
+
"""Show the VOLUME knob at *step*."""
|
|
805
|
+
self.volume = step
|
|
806
|
+
if self._page_key() == "global":
|
|
807
|
+
knob = self._named("volume")
|
|
808
|
+
if knob is not None:
|
|
809
|
+
self._show_knob(knob)
|
|
810
|
+
|
|
811
|
+
def set_bluetooth(self, on, text=None):
|
|
812
|
+
"""Show that Bluetooth MIDI is on or off; *text* is put on the display."""
|
|
813
|
+
self.bluetooth = bool(on)
|
|
814
|
+
if self.channels_open:
|
|
815
|
+
self._show_channel_pads()
|
|
816
|
+
if text:
|
|
817
|
+
self.flash(text)
|
|
818
|
+
|
|
819
|
+
@property
|
|
820
|
+
def channels_open(self):
|
|
821
|
+
"""True while the channel pads are showing."""
|
|
822
|
+
return self._channels is not None and not self._channels.has_flag(lv.obj.FLAG.HIDDEN)
|
|
823
|
+
|
|
824
|
+
def open_channels(self):
|
|
825
|
+
"""Put the channel pads where the page is."""
|
|
826
|
+
if self._channels is None:
|
|
827
|
+
self._channels = self._build_channels()
|
|
828
|
+
for obj in self.pages.values():
|
|
829
|
+
obj.add_flag(lv.obj.FLAG.HIDDEN)
|
|
830
|
+
self._channels.remove_flag(lv.obj.FLAG.HIDDEN)
|
|
831
|
+
self._show_channel_pads()
|
|
832
|
+
self._show_until = 0
|
|
833
|
+
self.display.set_line(1, "MIDI CHANNEL?")
|
|
834
|
+
|
|
835
|
+
def close_channels(self):
|
|
836
|
+
"""Take the channel pads away and bring the page back."""
|
|
837
|
+
if self.channels_open:
|
|
838
|
+
self.show(self.page)
|
|
839
|
+
|
|
840
|
+
def _on_midi_button(self, _button, _on):
|
|
841
|
+
if self.channels_open:
|
|
842
|
+
self.close_channels()
|
|
843
|
+
else:
|
|
844
|
+
self.open_channels()
|
|
845
|
+
|
|
846
|
+
def _on_channel_pad(self, _grid, index):
|
|
847
|
+
self.close_channels()
|
|
848
|
+
last = self._pads - 1
|
|
849
|
+
if index >= last or index == self.channel:
|
|
850
|
+
return
|
|
851
|
+
if index == BT_NEW:
|
|
852
|
+
if self.on_bluetooth_new is not None:
|
|
853
|
+
self.on_bluetooth_new()
|
|
854
|
+
return
|
|
855
|
+
if index > CHANNELS:
|
|
856
|
+
on = index == BT_ON
|
|
857
|
+
if on != bool(self.bluetooth):
|
|
858
|
+
if self.on_bluetooth is not None:
|
|
859
|
+
self.on_bluetooth(on)
|
|
860
|
+
else:
|
|
861
|
+
self.set_bluetooth(on)
|
|
862
|
+
return
|
|
863
|
+
if self.on_channel is not None:
|
|
864
|
+
self.on_channel(index)
|
|
865
|
+
else:
|
|
866
|
+
self.set_channel(index)
|
|
867
|
+
|
|
868
|
+
# ---- choosing a page ---------------------------------------------------------------------
|
|
869
|
+
|
|
870
|
+
def _page_key(self):
|
|
871
|
+
page = self.page
|
|
872
|
+
return "op" if page is not None and page.startswith("op") else page
|
|
873
|
+
|
|
874
|
+
def show(self, page):
|
|
875
|
+
"""Open *page*: one of `PAGES`."""
|
|
876
|
+
if page not in PAGES:
|
|
877
|
+
raise ValueError("no page called %r" % (page,))
|
|
878
|
+
key = "op" if page.startswith("op") else page
|
|
879
|
+
if page.startswith("op"):
|
|
880
|
+
self.op = int(page[2:])
|
|
881
|
+
if key not in self.pages:
|
|
882
|
+
self.pages[key] = {"bank": self._build_bank, "algo": self._build_algo, "op": self._build_op,
|
|
883
|
+
"global": self._build_global}[key]()
|
|
884
|
+
if self._channels is not None:
|
|
885
|
+
self._channels.add_flag(lv.obj.FLAG.HIDDEN)
|
|
886
|
+
for name, obj in self.pages.items():
|
|
887
|
+
if name == key:
|
|
888
|
+
obj.remove_flag(lv.obj.FLAG.HIDDEN)
|
|
889
|
+
else:
|
|
890
|
+
obj.add_flag(lv.obj.FLAG.HIDDEN)
|
|
891
|
+
self.page = page
|
|
892
|
+
for i, tab in enumerate(self.tabs):
|
|
893
|
+
tab.set_lamp(self.theme["led_on"] if PAGES[i] == page else None)
|
|
894
|
+
self.sync()
|
|
895
|
+
|
|
896
|
+
def sync(self):
|
|
897
|
+
"""Repaint the open page, and the display, from the editor."""
|
|
898
|
+
editor = self.editor
|
|
899
|
+
voice = editor.voice
|
|
900
|
+
key = self._page_key()
|
|
901
|
+
for knob in self._page_knobs.get(key, ()):
|
|
902
|
+
self._show_knob(knob)
|
|
903
|
+
if key == "bank":
|
|
904
|
+
self._show_pads()
|
|
905
|
+
elif key == "algo":
|
|
906
|
+
self._draw_graph(self._built["algo_diagram"])
|
|
907
|
+
elif key == "op":
|
|
908
|
+
op = voice.op(self.op)
|
|
909
|
+
view = self._built["op_view"]
|
|
910
|
+
view.set_values(op.rates(), op.levels())
|
|
911
|
+
view.set_selected(None)
|
|
912
|
+
self._draw_graph(self._built["op_diagram"])
|
|
913
|
+
self._built["fixed"].set_on(op.get("fixed"))
|
|
914
|
+
elif key == "global":
|
|
915
|
+
view = self._built["pitch_view"]
|
|
916
|
+
view.set_values(voice.pitch_rates(), voice.pitch_levels())
|
|
917
|
+
view.set_selected(None)
|
|
918
|
+
self._built["lfo_sync"].set_on(voice.get("lfo_sync"))
|
|
919
|
+
self._built["key_sync"].set_on(voice.get("key_sync"))
|
|
920
|
+
self._show_title()
|
|
921
|
+
self._show_idle()
|
|
922
|
+
|
|
923
|
+
def _draw_graph(self, diagram):
|
|
924
|
+
if diagram is None:
|
|
925
|
+
return
|
|
926
|
+
diagram.set_graph(*algorithms.graph(self.editor.voice.get("algorithm") + 1))
|
|
927
|
+
if self._page_key() == "op":
|
|
928
|
+
diagram.set_selected(self.op)
|
|
929
|
+
|
|
930
|
+
def _show_pads(self):
|
|
931
|
+
grid = self._built["pads"]
|
|
932
|
+
theme = self.theme
|
|
933
|
+
editor = self.editor
|
|
934
|
+
for i, name in enumerate(editor.bank.names()):
|
|
935
|
+
chosen = i == editor.slot
|
|
936
|
+
grid.set_color(i, theme["pad_lit"] if chosen else None)
|
|
937
|
+
grid.set_label(i, "%02d %s" % (i + 1, name), theme["pad_lit_text"] if chosen else theme["pad_text"])
|
|
938
|
+
|
|
939
|
+
def _changed_outside(self, what):
|
|
940
|
+
"""MIDI chose a slot, or sent a voice or a bank."""
|
|
941
|
+
self.sync()
|
|
942
|
+
if what == "bank":
|
|
943
|
+
self.flash("BANK RECEIVED")
|
|
944
|
+
elif what == "voice":
|
|
945
|
+
self.flash("VOICE RECEIVED")
|
|
946
|
+
|
|
947
|
+
# ---- buttons --------------------------------------------------------------------------------
|
|
948
|
+
|
|
949
|
+
def _on_fine(self, _button, on):
|
|
950
|
+
self.fine = on
|
|
951
|
+
self.flash("FINE ON" if on else "FINE OFF")
|
|
952
|
+
|
|
953
|
+
def _on_compare(self, _button, _on):
|
|
954
|
+
editor = self.editor
|
|
955
|
+
if not editor.comparing and not editor.edited:
|
|
956
|
+
self.flash("NOTHING CHANGED")
|
|
957
|
+
return
|
|
958
|
+
editor.compare(not editor.comparing)
|
|
959
|
+
self.sync()
|
|
960
|
+
self.flash("STORED VOICE" if editor.comparing else "EDITED VOICE")
|
|
961
|
+
|
|
962
|
+
def _on_pad(self, _grid, index):
|
|
963
|
+
self.editor.select(index)
|
|
964
|
+
self.sync()
|
|
965
|
+
|
|
966
|
+
def _on_node(self, _diagram, number):
|
|
967
|
+
self.show("op%d" % number)
|
|
968
|
+
|
|
969
|
+
def _on_fixed(self, _button, on):
|
|
970
|
+
if not self.editor.set_op(self.op, "fixed", 1 if on else 0):
|
|
971
|
+
self._built["fixed"].set_on(not on)
|
|
972
|
+
self.flash("COMPARE: NO EDIT")
|
|
973
|
+
return
|
|
974
|
+
self.sync()
|
|
975
|
+
|
|
976
|
+
def _on_lfo_sync(self, _button, on):
|
|
977
|
+
self._toggle("lfo_sync", on)
|
|
978
|
+
|
|
979
|
+
def _on_key_sync(self, _button, on):
|
|
980
|
+
self._toggle("key_sync", on)
|
|
981
|
+
|
|
982
|
+
def _toggle(self, name, on):
|
|
983
|
+
if not self.editor.set_voice(name, 1 if on else 0):
|
|
984
|
+
self._built[name].set_on(not on)
|
|
985
|
+
self.flash("COMPARE: NO EDIT")
|
|
986
|
+
return
|
|
987
|
+
self._show_title()
|
|
988
|
+
self.flash("%s %s" % (name.replace("_", " "), "ON" if on else "OFF"))
|
|
989
|
+
|
|
990
|
+
def _files(self):
|
|
991
|
+
files = self.editor.files()
|
|
992
|
+
if self._file_index is None:
|
|
993
|
+
names = [name for name, _path in files]
|
|
994
|
+
self._file_index = names.index(self.editor.file) if self.editor.file in names else 0
|
|
995
|
+
return files
|
|
996
|
+
|
|
997
|
+
def _step_file(self, step):
|
|
998
|
+
files = self._files()
|
|
999
|
+
if not files:
|
|
1000
|
+
self.flash("NO BANK FILES")
|
|
1001
|
+
return
|
|
1002
|
+
self._file_index = (self._file_index + step) % len(files)
|
|
1003
|
+
self.flash("? " + files[self._file_index][0][:-4])
|
|
1004
|
+
self._show_until = lv.tick_get() + 4 * SHOW_MS
|
|
1005
|
+
|
|
1006
|
+
def _on_file_prev(self):
|
|
1007
|
+
self._step_file(-1)
|
|
1008
|
+
|
|
1009
|
+
def _on_file_next(self):
|
|
1010
|
+
self._step_file(1)
|
|
1011
|
+
|
|
1012
|
+
def _on_load(self):
|
|
1013
|
+
files = self._files()
|
|
1014
|
+
if not files:
|
|
1015
|
+
self.flash("NO BANK FILES")
|
|
1016
|
+
return
|
|
1017
|
+
name, path = files[self._file_index % len(files)]
|
|
1018
|
+
try:
|
|
1019
|
+
self.editor.load(path)
|
|
1020
|
+
except (OSError, ValueError) as e:
|
|
1021
|
+
print("fmsynth: %s: %s" % (path, e))
|
|
1022
|
+
self.flash("CAN'T LOAD")
|
|
1023
|
+
return
|
|
1024
|
+
self.sync()
|
|
1025
|
+
self.flash("LOADED")
|
|
1026
|
+
|
|
1027
|
+
def _on_save(self):
|
|
1028
|
+
try:
|
|
1029
|
+
path = self.editor.save()
|
|
1030
|
+
except OSError as e:
|
|
1031
|
+
print("fmsynth: save: %s" % (e,))
|
|
1032
|
+
self.flash("CAN'T SAVE")
|
|
1033
|
+
return
|
|
1034
|
+
print("fmsynth: saved", path)
|
|
1035
|
+
self._file_index = None
|
|
1036
|
+
self.flash("BANK SAVED")
|
|
1037
|
+
|
|
1038
|
+
def _on_store(self):
|
|
1039
|
+
self.editor.store()
|
|
1040
|
+
self.sync()
|
|
1041
|
+
self.flash("STORED IN %02d" % (self.editor.slot + 1))
|
|
1042
|
+
|
|
1043
|
+
def _on_init(self):
|
|
1044
|
+
self.editor.init_voice()
|
|
1045
|
+
self.sync()
|
|
1046
|
+
self.flash("NEW VOICE")
|
|
1047
|
+
|
|
1048
|
+
# ---- going away ---------------------------------------------------------------------------------
|
|
1049
|
+
|
|
1050
|
+
def _on_delete(self, _event):
|
|
1051
|
+
self.root = None
|
|
1052
|
+
if self._timer is not None:
|
|
1053
|
+
self._timer.delete()
|
|
1054
|
+
self._timer = None
|
|
1055
|
+
|
|
1056
|
+
def delete(self):
|
|
1057
|
+
"""Take the panel off the screen and stop its timer."""
|
|
1058
|
+
if self.root is not None:
|
|
1059
|
+
self.root.delete()
|
|
1060
|
+
self.root = None
|
|
1061
|
+
|
|
1062
|
+
|
|
1063
|
+
def build(editor, screen=None, group=None, **options):
|
|
1064
|
+
"""Build the panel for *editor* and return it.
|
|
1065
|
+
|
|
1066
|
+
*options* are the keywords `Panel` takes: ``theme``, ``engine_text``,
|
|
1067
|
+
``engine_ok``, ``channel``, ``on_channel``, ``bluetooth``,
|
|
1068
|
+
``on_bluetooth`` and the five for the volume.
|
|
1069
|
+
"""
|
|
1070
|
+
_require()
|
|
1071
|
+
return Panel(editor, screen=screen, group=group, **options)
|