Skip to content
Open
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 changelog/2026-11-26-ev-audio-step-base.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Base: `ev_audio_step` call hook at `0x400a2d6a` (index 63, room 8, rejoin `0x400a2d74`). Play Modes coexists via machine-ports (order 40, replaces `pm_audio_step`, native sources unchanged). Seq Pos listing tip subscribes order 50. Leave index 63 as next-free on main; open `ot_lfo_pmtr_dest` #2261 rebases if this lands first. Fork mop101/102 pattern. No USB. Owner base review required.
5 changes: 5 additions & 0 deletions sdk/machines/octatrack/HOOKS.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ next base build, which renames them; the base loads them by those paths.
| `ot_settings` | table | none | PROJ > MODWERK > SETTINGS lists the contributed settings in table order. YES opens a row and shows its choices with the active one marked. UP and DOWN browse, YES applies the highlighted choice, and NO returns to the list | `24-byte record` | Contribute one struct modwerk_setting (every field set) for a choice the player makes on the unit, not in a project: it holds for the whole instrument. The base calls apply(choice) when the player takes a choice and, within a tick, after every change of the installed modules (a power-up, a sync, an Undo, a switch in MODULES), so the module starts as with its first choice and needs no storage of its own. The base keeps the choice through a power cycle under the label, so an update of the module, or another build of it with the same label, keeps the setting; give a label no other module uses. A kept choice this record does not offer is the first one until the player chooses again. A grouped record (ABI 2) points choices at struct modwerk_setting_pages and provides a field list for MODWERK_SETTING_FIELDS or the options of one listed field, and converts a confirmed selection to its saved word. The module must handle an initial zero and older saved values. Labels and names are read each time the page is drawn: keep them in the image, printable capitals. | lower first, then module id: the page's row order. 50-90. | the UI task: apply is short and must not draw or open a window |
| `ev_audio_frame_prepare` | call | 0x4000cf4a | once per 16-sample audio frame, after sequencer event staging and before the eight audio tracks calculate LFOs and render their sources, including while transport is stopped | `void f(void)` | Observe the instrument’s current step and tick here to prepare the upcoming render. Return without starting transport or advancing the sequencer. Each subscriber receives one notification per visit to the frame preparation site. The hook stays active while a module rests, so it can retain timing from before its first note. | Lower order first, then module ID. All subscribers run. 10-90. | the audio frame interrupt. Keep the EMAC as found and preserve the C callee-saved registers. A handler must be bounded and must not block. |
| `ev_frame_deadline` | call | none: the base raises it | every frame-interrupt entry, before any render: no stock site, the base raises it from mw_frame_enter (machine_registry.c) once it knows how late the entry is against the DSP's frame grid | `unsigned f(uint32_t deadline, unsigned rest)` | deadline is the DTCN3 count (0xfc07c00c, 132 MHz) by which work at IPL 5 (stock's delay routine and a module's detours in it) must end so that the next frame interrupt enters no more than 60 µs late: the next frame's grid time plus 80 µs less a 20 µs margin. Compare with (int32_t)(DTCN3 - deadline): past 0, or within your next block's cost of it, hold that block (dry, or the ring held) rather than run it. An entry in the DSP's late window (80 to 190 µs) skips a DSP frame, heard as a click, or stops the frame exchange for good (owner's MKII, 22 November 2026). rest is nonzero on every frame of a pattern the base predicts past the frame ceiling with this module's effect running, the Part's module machines already silent (owner, 22 November 2026): bypass dry for this frame, doing no work. It is latched at the frame's entry and never changes within it; the handler runs every frame whether rest is set or not, so it sees rest go back to 0 itself and starts its state afresh then. Admission charges the effect as if it ran either way. Every handler runs; the answers are ignored. d2-d7/a2-a6 must be kept, as C keeps them; the base keeps d0-d1/a0-a1. | lower first, then module id; every handler runs, so the order does not change the result. 10-90. | the frame interrupt: short, no firmware call that can block, the EMAC kept as found. Store the deadline and return |
| `ev_audio_step` | call | 0x400a2d6a | the tick's audio pass loads step = 0x800064d0[track] (track in d5) just before 0x4009d1e8(track, bank, pattern, step, n); remappers may change the step that plays | `int f(unsigned *step, unsigned track)` | Base loads the stock step into *step. Change *step to change which pattern step plays for this track. Return nonzero to take the track: no later handler runs. The base leaves the final step in d0 and rejoins at 0x400a2d74. The tick's d2-d7/a2-a6 are intact in a handler and must be kept, as C keeps them. PHAS does not subscribe (fire-time 0x400a2e12). | lower first, then module id. 40: Keep Play Modes mode map; 50: Seq Pos address remap when enabled. v1 remappers return 0 to chain. | the audio tick / frame interrupt: short, no firmware call that can block, the EMAC kept as found |

## Reviewed subscribers

Expand Down Expand Up @@ -155,6 +156,8 @@ next base build, which renames them; the base loads them by those paths.
| `ot_sequencer_rows` | synth | `mw_sequencer_rows` | 40 | SCALE, ROOT, GLIDE rows of FM's bundled quantizer | sdk/octabam/modules/synth/upstream/quantizer/quantizer.s (FM's bundled copy, fm_ units) qz_lbl_*, qz_get*, qz_set* |
| `ot_sequencer_rows` | quantizer | `mw_sequencer_rows` | 50 | SCALE, ROOT, GLIDE rows | sdk/octabam/modules/quantizer/upstream/quantizer/quantizer.s qz_lbl_*, qz_get*, qz_set* |
| `ev_tail_kill` | bbd | `bbd_tail_kill` | 50 | while the kill holds a track whose FX2 is BBD (id 0x0e), zeroes its slot 11 (+53): BBD plays the input exactly and clears its line until the track's next trig | sdk/octabam/modules/bbd/stopkill.s bbd_kill_hook (the card build's detour at the same site); on the owner's MKII 15 Oct 2026 (dev twin e429b787): slot 11 0 while held, 127 after T1's next trig, the tail cut to -132 dBFS |
| `ev_audio_step` | playmodes | `pm_ev_audio_step` | 40 | maps the raw (or prior) step through the current play mode; returns 0 to chain | machine-ports playmodes callWrappers step_ptr_track via pm_step_entry replaces pm_audio_step (fork mop102; native sources unchanged until a follow-up owner-approved playmodes runtime.json) |
| `ev_audio_step` | seq-pos | `sp_ev_audio_step` | 50 | when sp_en[t], address-remaps *step via sp_map; else leaves it; returns 0 to chain | sdk/octatrack/modules/seq-pos/unit.s sp_map; runtime.json subscribe replaces sp_audio_step (fork mop102); listing tip cursor/seq-pos-publish-f021 |

## Reviewed raisers

Expand Down Expand Up @@ -225,6 +228,7 @@ A raised hook has no stock site: these modules call the base's entry and act on
- `ot_settings`: Each setting is its module's own and no row reads another's. USB Audio is the first to contribute (ALL CHANNELS, OFF, and MAIN + CUE ONLY in the twenty-channel layout: issue 1512); until its package is published no module does.
- `ev_audio_frame_prepare`: Clock readers such as FM Synth and sequenced machines observe stock state independently. Subscribers must not rely on another module’s state.
- `ev_frame_deadline`: Each subscriber keeps its own copy of the deadline; none reads another's. Owner approved 22 November 2026 for Tape Echo and every ColdFire effect after it.
- `ev_audio_step`: Fork mop101/102: Play Modes order 40 then Seq Pos order 50 so address-mode modulates the play-mode-mapped step. PHAS stays off this list. Upstream hook index 63 (append after ev_frame_deadline 62; open ot_lfo_pmtr_dest #2261 must rebase to the next free index if this lands first). Nonzero take reserved for a future exclusive remapper.

## The sites

Expand Down Expand Up @@ -265,6 +269,7 @@ A raised hook has no stock site: these modules call the base's entry and act on
| 0x400909d8 | 10 | `04b9d7a74c6bd182603087f929a77f363eac1667a5135d86b8fda1c6d35d9b82` | the new, empty project: three instructions that end in a call, before stock goes on at 0x400909e2. Site and behaviour read from upstream octabam's STORE notes (sambanks/octabam fe8d6a25, MIT) and checked against the stock bytes; not yet measured on this base. |
| 0x400917c8 | 8 | `b692e058a2f3049810c18b0571d61c085c3daba589a09b531fed42f528b96012` | the bank writer (background save, save as, new project), at its entry: a link frame, so the caller's return address is at 4(a6) after its first two instructions. Site and behaviour read from upstream octabam's STORE notes (sambanks/octabam fe8d6a25, MIT) and checked against the stock bytes; not yet measured on this base. |
| 0x4009fb58 | 6 | `b9fd3e826833844716d1d4904ee373c65d291047e78b9f34f8d9e3c95dac30fd` | the MIDI tracks' note sender 0x4009f794 (sequencer and arpeggiator), once per note of a track's trig or arp step: d7 the track (0-7), a2 the note byte after TRAN (signed; -1 drops it), -64(%fp) KEY's root offset (0 with KEY OFF); stock then corrects the note to KEY's Major or Minor scale (0x4009fb5e) and sends it, keeping it for its note-off |
| 0x400a2d6a | 6 | `1cb5e6a4478a2248b033baac126f63d4930860b767556518139cf5f717c08433` | the tick's audio pass, just before 0x4009d1e8(track, bank, pattern, step, n): stock loads step = 0x800064d0[track] (track in d5) via lea 0x800064d0,%a0 (this site) then mvzb; remappers mutate the step before the call |

## Sites the tables own

Expand Down
Loading
Loading