Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .site/gallery/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ <h2>Apps</h2>
<span class="card-badges">
<span class="tag featured">featured</span>
<span class="badge dep tag-tier-4">audioinstruments</span>
<span class="badge dep tag-tier-3">controlpanel</span>
<span class="badge dep tag-tier-3">lvgl</span>
<span class="badge dep tag-tier-1">multimer</span>
</span>
Expand Down
3 changes: 2 additions & 1 deletion .site/pyscript/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,13 @@ <h2>Apps</h2>
<div class="gallery-sidebar" id="gallery-sidebar" aria-label="Demo list">
<div class="grid">
<!-- GEN:demos:start -->
<a class="card" href="../pyscript/pyodide.html?manifests=drum_machine&deps=pydevices-audioinstruments%2Cpydevices-lvgl" target="_blank" rel="noopener">
<a class="card" href="../pyscript/pyodide.html?manifests=drum_machine&deps=pydevices-audioinstruments%2Cpydevices-controlpanel%2Cpydevices-lvgl" target="_blank" rel="noopener">
<div class="card-top">
<span class="card-icon"><img src="../pyscript/thumbnails/drum_machine.png" alt="" loading="lazy"></span>
<span class="card-badges">
<span class="tag featured">featured</span>
<span class="badge dep tag-tier-4">audioinstruments</span>
<span class="badge dep tag-tier-3">controlpanel</span>
<span class="badge dep tag-tier-3">lvgl</span>
<span class="badge dep tag-tier-1">multimer</span>
</span>
Expand Down
2 changes: 0 additions & 2 deletions gallery.toml
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,6 @@
"https://raw.githubusercontent.com/PyDevices/gallery/main/lib/examples/dino.py" = "/examples/dino.py"
"https://raw.githubusercontent.com/PyDevices/gallery/main/lib/examples/drum_machine/__init__.py" = "/examples/drum_machine/__init__.py"
"https://raw.githubusercontent.com/PyDevices/gallery/main/lib/examples/drum_machine/drum_machine.py" = "/examples/drum_machine/drum_machine.py"
"https://raw.githubusercontent.com/PyDevices/gallery/main/lib/examples/drum_seq/__init__.py" = "/examples/drum_seq/__init__.py"
"https://raw.githubusercontent.com/PyDevices/gallery/main/lib/examples/drum_seq/panel.py" = "/examples/drum_seq/panel.py"
"https://raw.githubusercontent.com/PyDevices/gallery/main/lib/examples/feathers.py" = "/examples/feathers.py"
"https://raw.githubusercontent.com/PyDevices/gallery/main/lib/examples/fleet_page/check_fleet.py" = "/examples/fleet_page/check_fleet.py"
"https://raw.githubusercontent.com/PyDevices/gallery/main/lib/examples/fleet_page/fleet.py" = "/examples/fleet_page/fleet.py"
Expand Down
2 changes: 1 addition & 1 deletion lib/examples/cast/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Anything else lacks the H.264 encoder.
## Try it

Install this example on the P4 beside `roku_remote` (for the TV control) and,
for the drum demo, `drum_machine` and `drum_seq`. Each demo has its sink's
for the drum demo, `drum_machine` and the `controlpanel` package. Each demo has its sink's
address at the top; set it first.

| Demo | What you see |
Expand Down
30 changes: 13 additions & 17 deletions lib/examples/drum_machine/drum_machine.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# deps: audioinstruments, lvgl, multimer
# deps: audioinstruments, controlpanel, lvgl, multimer
# gallery: featured, newwindow
"""
drum_machine.py — 16-step drum sequencer with ten classic drum machines.
Expand All @@ -7,8 +7,9 @@
shared by every machine in ``audioinstruments``) on an LVGL buttonmatrix, a
step-position indicator, transport with BPM and volume controls, and a
dropdown that switches between the ten drum machines while the pattern keeps
playing. The PANEL button opens the generic Tier-0 instrument panel
(``drum_seq.panel``) over the current machine for macro and patch editing.
playing. The PANEL button opens ``controlpanel`` over the current machine: its
kits on backlit pads and its macros on sixteen encoders with LED rings, the
same panel an mpvst plug-in shows. EXIT on the panel comes back here.

Where the firmware carries the audio pump, the groove is kept on the **audio
clock**: each step is handed to ``audiodev.pump``'s queue with the frame it
Expand Down Expand Up @@ -93,7 +94,7 @@
Sequencer = None

try:
from drum_seq.panel import Panel
from controlpanel import Panel
except ImportError:
Panel = None

Expand Down Expand Up @@ -195,7 +196,7 @@ def _toolbar_button(parent, text, width, cb=None, event=None, checkable=False):


class _InstrumentAdapter:
"""The Tier-0 panel's adapter contract over an audioinstruments machine."""
"""controlpanel's adapter contract over an audioinstruments machine."""

def __init__(self, dm):
self._dm = dm
Expand Down Expand Up @@ -230,7 +231,7 @@ def set_patch(self, index):
self._dm.inst.program_change(self._patch_keys[index])

def set_bypass(self, bypass):
pass # a drum machine has no bypass; the panel still draws the switch
pass # a drum machine has no bypass; the panel still draws the button

def request_reload(self):
inst = self._dm.inst
Expand Down Expand Up @@ -789,23 +790,18 @@ def _on_panel(self, e):
if Panel is None or self.panel is not None:
return
scr = lv.obj(None)
self.panel = Panel(_InstrumentAdapter(self), screen=scr)
back = lv.button(scr)
back.add_flag(lv.obj.FLAG.FLOATING)
back.set_size(96, 40)
back.align(lv.ALIGN.BOTTOM_RIGHT, -8, -8)
back.set_style_bg_color(ACCENT, 0)
label = lv.label(back)
label.set_text("BACK")
label.center()
back.add_event_cb(_guarded(self._close_panel), lv.EVENT.CLICKED, None)
self.panel = Panel(
_InstrumentAdapter(self), screen=scr, subtitle="Drum machine",
on_close=_guarded(self._close_panel),
)
self.panel_scr = scr
lv.screen_load(scr)

def _close_panel(self, e=None):
lv.screen_load(self.seq_scr)
if self.panel_scr is not None:
self.panel_scr.delete()
# EXIT's own click is still running: delete once it has returned.
self.panel_scr.delete_async()
self.panel = None
self.panel_scr = None

Expand Down
2 changes: 0 additions & 2 deletions lib/examples/drum_seq/__init__.py

This file was deleted.

Loading
Loading