mirror of
https://github.com/got-feedBack/feedBack.git
synced 2026-08-11 03:09:57 +00:00
Stream the rig library to the client
The core rig reader landed its reading half but not its exposing half:
the bindings shipped (`base_rig`, per-change `rig`) while the library
they are references INTO stayed server-side on LoadedSloppak.rigs with
no consumer at all. A client could see that a change binds
"grand-piano" and had no way to learn what that was.
Add a `rigs` WS message carrying the library whole and verbatim, and put
each drum part's resolved `tones` binding on its `song_info.drum_parts`
entry — the drum half had the same gap, since the loader resolved the
binding in P3 and the wire payload was still `{id, name}`.
Sent whenever the pack ships a library, deliberately NOT gated on this
arrangement having tone changes: a pack can bind sound to its drum parts
alone via `drum_tones` and still need the library.
Verbatim matters here. Core selects no realization and applies no
`intent.gm` floor, so the consumer that voices the part needs the whole
block to make that choice — including the unknown `role`/`engine`/`kind`
values and `ext` namespaces §7.9 requires a Reader to preserve.
Client side: `hwState.rigs` / `toneBaseRig`, `getRigs()` /
`getToneBaseRig()`, and `bundle.rigs` / `bundle.toneBaseRig` so
renderers reach them the same way they reach every other chart array,
with both reset paths clearing them between songs.
Packs that bind no rig are byte-identical on the wire — no `rigs`
message, no `base_rig`, no `rig`, no `tones` on a drum part.
Signed-off-by: gionnibgud <gionnibgud@gmail.com>
This commit is contained in:
@@ -581,8 +581,14 @@ async def highway_ws(websocket: WebSocket, filename: str, arrangement: int = -1,
|
||||
# as the `drum_tab`/`drum_hits` messages below. Always a list
|
||||
# (empty when the pack has no drums, and a single entry for a
|
||||
# legacy one-drum pack), so a part picker can bind unconditionally.
|
||||
# `tones` is the part's sound binding (feedpak 1.18.0 §5.1/§5.2 —
|
||||
# entry `tones` or the song-level `drum_tones` fallback, already
|
||||
# resolved by the loader). Omitted when the part binds nothing, so
|
||||
# a pack without bindings sends the payload it always did; pair it
|
||||
# with the `rigs` message below to resolve `base_rig`/`rig` ids.
|
||||
"drum_parts": [
|
||||
{"id": p["id"], "name": p["name"]}
|
||||
{"id": p["id"], "name": p["name"],
|
||||
**({"tones": p["tones"]} if p.get("tones") else {})}
|
||||
for p in (loaded_slop.drum_parts or [])
|
||||
] if is_slop and loaded_slop is not None else [],
|
||||
"has_notation": bool(
|
||||
@@ -797,6 +803,22 @@ async def highway_ws(websocket: WebSocket, filename: str, arrangement: int = -1,
|
||||
if base_rig:
|
||||
payload["base_rig"] = base_rig
|
||||
await websocket.send_json(payload)
|
||||
|
||||
# The pack's RIG LIBRARY (rigs.json, spec §7.9) — the thing the
|
||||
# `base_rig` / `rig` ids above (and the drum parts' `tones`) are
|
||||
# references INTO. Sent whole and verbatim: core does not select a
|
||||
# realization or apply the `intent.gm` floor, so the consumer that
|
||||
# voices the part needs the entire block to make that choice.
|
||||
#
|
||||
# Deliberately NOT gated on this arrangement having tone changes —
|
||||
# a pack can bind sound to its drum parts alone (`drum_tones`) and
|
||||
# still need the library. Sent whenever the pack ships one.
|
||||
if loaded_slop is not None and loaded_slop.rigs is not None:
|
||||
await websocket.send_json({
|
||||
"type": "rigs",
|
||||
"version": int(loaded_slop.rigs.get("version", 1)),
|
||||
"data": loaded_slop.rigs.get("rigs") or [],
|
||||
})
|
||||
else:
|
||||
xml_paths = sorted(_xml_walk("*.xml"))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user