Skip to content

Octatrack base 0.7.12: stage shared USB Audio settings and reconnect - #1899

Merged
repeat98 merged 63 commits into
mainfrom
base/octatrack-next
Nov 20, 2026
Merged

repeat98 merged 63 commits into
mainfrom
base/octatrack-next

Conversation

@repeat98

Copy link
Copy Markdown
Owner

What changed

Publish the cumulative SDK changes from #1848. This stages the hardware-qualified Octatrack 0.7.12 base and its shared Settings and USB function hooks. The installer continues to offer base 0.7.11, USB Audio 0.2.0-experimental and all seven existing base layouts at this stage. The subsequent module release switches the base and configurable USB Audio together. The previous Recorder Loop URL remains available for already-open installers.

The native SDK and browser can reproduce 0.7.12. Its SDK-side panel adapter and host integration test accompany the shared hooks so that the source identity is reproducible. The USB Audio module's manifest, published version and installation behavior stay at their existing release in this stage.

How I checked it

Built and saved all seven 0.7.11 firmware layouts with the live site’s compiled worker, then compared each with the staged worker. All seven firmware hashes and base identities match. The native and browser 0.7.12 builds have the same firmware SHA-256 as the image tested on the MKII, 7e7539c8ea20f72ffc8cc2491452129c3f46aad2081d9bcb1a73e116a3a2640a. All 404 app test files passed. The SDK ran 723 test cases with 28 skips.

Tested on a unit: Octatrack MKII, OS 1.40C, release base 0.7.12 254c5a75a139255e057e69532bb952daffef5039ffeee0e6c9fabda302e5bb91. Eight recordings and Undos, Keep, physical power cycle and card restoration passed. After the power cycle the same image restored Track 8/Master without a module upload and recorded 89,088 stereo frames. The flashed base returned with the original ten modules and full saved-set checksum.

Edge cases

Case Why this change makes it a risk How run Result
Track 8/Master after PRE and again after 20 channels An earlier build disappeared from USB MKII, macOS PCM capture and Undo twice pass
Migration across every width Site and card could install different presets Seven saved profiles through both preparation paths, eight MKII trials pass
Concurrent panel settings entries A module could hide alternatives or monopolize SETTINGS MKII emulator, capture four screens from the 0.7.12 image and compare their pixels pass
Outbox duplicate Main and Off Assignments could send another source Compare all 88,576 eight-channel frames on macOS pass
Keep and power off The next boot could load the default or discard the original set MKII card restore, compare set identity, preset and stereo capture pass
Physical Outbox outputs, full-speed-only host, Windows/WASAPI and Linux USB or analogue playback depends on host and attached hardware USB pairs observed on macOS not run: those devices and hosts were unavailable

The version-specific owner exception covers worst-case ColdFire cycles and complete memory bounds including stack and DMA. The package declares 10,288 initialized bytes and 94,152 bytes of zero-initialized storage. Measured unit results

Guides

The USB Audio development guide and hardware record describe the shared interfaces and the Track 8/Master reconnect, Keep and cold-start checks. Related to #1831. Installer preparation is in #1865.

repeat98 and others added 30 commits November 20, 2026 09:27
…and the base reconnects for it

USB Audio is to become a module of its own instead of a base variant per layout. This is the base side:
three hooks the base raises from its own USB shims (ev_usb_isr, ev_usb_bus_end, ev_usb_control), the
table ot_usb_functions (one function: its interfaces from 4, endpoint 3, four descriptor blocks) and
usb_function.c, which checks the record at admission, keeps the configurations in 512-byte slots and,
when the table changes, takes the unit off the bus, rewrites the slots and comes back without undoing
an open sync or trial. A function that leaves has its endpoint flushed and disabled at the switch.

Not built into a base yet: the committed base and its variants are unchanged, and no module contributes.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…t ends after the host's bus reset

Found in the emulator with a package that contributes a function:
- a vendor request before the host's bus reset ended the reconnect too early, so that reset undid the
  open trial. The reconnect is now over when the host has reset the bus and then reached the vendor
  interface.
- the hooks ran through the loader's dispatch code from the USB interrupt, which left its addresses in
  stack memory on every transfer; the loader then refused the rollback for good. The base now walks the
  three rows in usb_function.c (no modwerk_raise_ entry exists for a hook the base raises).
- a base with USB Audio linked in did not compile (unused helpers).

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…unction; device usb

scripts/verify-octatrack-usb-function.mjs installs examples/usb_function.c (two vendor interfaces, the
three hooks) as a trial in ot_emu and checks the reconnect, the configuration at both speeds, that the
trial stays open, the hooks, rollback, keep and removal; --linked checks that a base with USB Audio
linked in refuses it. `npm run device -- usb` prints USB FUNCTION (request 41). The table's registry
entry gets its empty site list, which a registry test reads.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Main now marks a hook the base raises with raisedByBase and keeps its entry in the dispatch code; the loader
still hands no package that entry. The USB hooks use that scheme since the rebase onto main of 20 November.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…e's USB function

A USB Audio module produces its block in the frame interrupt, where usbaudio.s's audio_frame_shim sits when
USB Audio is linked into a base (0x4000d9a0). A base that takes a module's function now owns that site with a
shim of its own and raises ev_usb_frame there (hook 59), walking the row in usb_function.c like the three other
USB hooks. A base that links USB Audio in leaves the site to it, so no site has two owners; that is why the
hook is raised by the base and not declared as a stock site in events.json.

The example function and the emulator verifier count it. Host tests pass. In ot_emu with --frame (a development
base with USB MIDI alone, built from this commit on 20 November 2026) the verifier passes: the trial stays open
across the reconnect, the four hooks run, rollback, keep and removal. Emulator only; not on a unit.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…an emulator verifier

usb_audio_package.py builds the authored USB AUDIO OUT TRACKS MAIN CUE source as a package for a base that takes
a module's USB function. The import stays exact; at guarded seams its interrupt, bus-end and producer shims
return to the base and are subscribed to ev_usb_isr, ev_usb_bus_end and ev_usb_frame, the class requests are
answered by an ev_usb_control handler that calls stock's usb_ep0_send (0x4001d498) instead of jumping into the
dispatcher's tail, and its descriptors are the ot_usb_functions block, cut from the configuration a linked base
sends. SET_INTERFACE, GET_INTERFACE and the EP0 page fix stay its own three stock sites, by SHA-256 guard. The
transfer descriptors are aligned to 32 bytes at run time: a package's image sits at a 16-byte boundary of the pool.

3,292 bytes of code and data, 94,116 of bss, a 118-byte function block; the three guards match OS 1.40C.

scripts/verify-octatrack-usb-audio-package.mjs, in ot_emu with --frame on a development base with USB MIDI alone
(20 November 2026): a trial reconnects, the host reads the 259-byte configuration with six interfaces a linked
base sends, the clock source answers 44.1 kHz, alternate setting 1 gives 16 packets of 800 or 880 bytes (10 or 11
frames of 20 channels) in 16 polls with no underrun or overrun counted, alternate setting 0 closes the stream, and
a rollback restores the first configuration. Emulator only: no host driver, no audio content, not on a unit; the
other five layouts are not built yet.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…d as packages

usb_audio_package.py takes the four other layouts of the same authored source. Each carries the same three
guarded stock sites and a 118-byte function block: TRACKS 3,056 bytes and 76,976 of bss, MAIN CUE 2,956 and
26,804, MASTER 2,844 and 10,404, MAIN 2,812 and 10,404. The emulator verifier takes the layout's frame size.

In ot_emu with --frame on a development base with USB MIDI alone (20 November 2026), each as a trial: the
259-byte configuration with six interfaces, the clock source, 16 packets of 10 or 11 whole frames (TRACKS 640
or 704 bytes, MAIN CUE 160 or 176, MASTER and MAIN 80 or 88) within 18 polls, no underrun or overrun counted,
the stream closed and a rollback. Emulator only; not on a unit.

USB AUDIO OUT TRACKS POST is not built as a package: its producer needs the stock gain curve, which a package
may not carry.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…uted gain curve

The POST producer scales each stem by core 0's XLV curve, 256 words a linked base reads from the owner's stock
DSP image. A package carries no stock data, so it takes the computed quarter sine instead (owner, 20 November
2026): round(sin(2 pi i / 1024) * 0x7fffff), the curve usb_post.py checks the stock table against and accepts
within 64 of 2^23. A stem's level can differ from a linked base's by at most that; not compared on a unit.

5,684 bytes of code and data, 76,972 of bss, the same three guarded sites and 118-byte function block. In ot_emu
with --frame (20 November 2026), as a trial: the 259-byte configuration, the clock source, 16 packets of 640 or
704 bytes (10 or 11 frames of 16 channels) in 16 polls, no underrun or overrun counted, the stream closed and a
rollback. Emulator only: the gains themselves were not checked, and nothing ran on a unit.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…builds as packages

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…h in its package

The owner decided on 20 November 2026 that a module's on-device setting appears under one SETTINGS row in
PROJ > MODWERK and that the base keeps it through a power cycle.

- Base (development builds with site events and the DSP loader): the table ot_settings (events.json, hook 60):
  a module contributes a label, two to six choice names and apply(choice). settings.c keeps the choice in
  battery RAM under the label's hash ('MWS1' at 0x100f9000, eight entries, battery-ram.json) and applies every
  kept choice again after each change of the installed modules. status.c's SETTINGS page lists one row per
  setting with the choice in force; UP and DOWN move, YES takes the next choice at once, NO closes.
- USB Audio's package contributes its setting: ALL CHANNELS and OFF in every layout, MAIN + CUE ONLY in the
  twenty-channel one. The producer reads it through pull request 1517's seams (audio_switch), which were
  written for a base that linked USB Audio in and tried on the owner's MKII there.

Checked: test_settings.py (host model of the table, the store and when choices are applied), the package and
battery-RAM tests. In ot_emu with --frame and a card, on a development base built from this commit: the
twenty-channel package as a trial, the page opened from the panel, OFF kept in battery RAM with 16 whole
packets of zeros, MAIN + CUE ONLY kept with the sixteen track channels silent, back to ALL CHANNELS; TRACKS
the same with its two choices; the example USB function's verifier still passes. Emulator only: the page was
not seen on a unit, the choice was not read back after a power cycle, and the counters showed 2 overruns
across the choice changes, not looked into yet.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…e from

The 2 overruns counted across the SETTINGS choices also come with the same control traffic and no setting
change: the emulated unit produces while the test presses keys and reads RAM instead of polling EP3.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The unit reports a package's layout number in its inventory, so the site can tell which USB Audio layout is
installed and replace it on a change: the layout's define in the imported source, plus one (TRACKS MAIN CUE 1,
TRACKS 2, MASTER 3, MAIN CUE 4, MAIN 5, TRACKS POST 6).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
repeat98 and others added 24 commits November 20, 2026 21:16
…usb-audio-migration-1831

# Conflicts:
#	public/octatrack-modules/recorder-loop-fix/0.1.0-experimental.mwrm
#	sdk/machines/octatrack/base-binding.json
#	sdk/machines/octatrack/base-sizes.json
#	sdk/machines/octatrack/base-versions.json
#	sdk/machines/octatrack/elekloader/runtime_events.h
#	src/engine/assets/octatrack-base-fills.json
#	src/engine/assets/octatrack-base-sources.json
#	src/engine/assets/octatrack-base-variants.json
#	src/engine/assets/octatrack-base.elemod
#	src/engine/assets/octatrack-module-packages.json
…-compiled-version into codex/usb-audio-migration-1831
…falg/coding/modwerk/.claude/worktrees/usb-audio-site-1831 into codex/usb-audio-migration-1831
…ikassfalg/coding/modwerk/.claude/worktrees/usb-audio-compiled-version into codex/usb-audio-migration-1831
…ikassfalg/coding/modwerk/.claude/worktrees/usb-audio-compiled-version into codex/usb-audio-0712-stage
…ikassfalg/coding/modwerk/.claude/worktrees/usb-audio-compiled-version into codex/usb-audio-0712-stage
Stage Octatrack base 0.7.12 for configurable USB Audio
@repeat98
repeat98 marked this pull request as ready for review November 20, 2026 22:32
@repeat98
repeat98 enabled auto-merge November 20, 2026 22:35
@repeat98
repeat98 merged commit a241c59 into main Nov 20, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant