Skip to content

Invalidate previous music cue regions before a bank re-export - #6867

Merged
shayderrr merged 4 commits into
ItsNotRexed:mainfrom
kacper-serewis:fix/awc-invalidate-cue-sheet
Nov 23, 2026
Merged

shayderrr merged 4 commits into
ItsNotRexed:mainfrom
kacper-serewis:fix/awc-invalidate-cue-sheet

Conversation

@kacper-serewis

Copy link
Copy Markdown
Contributor

Item AWC-CUE-SHEET-RERUN (claim).
Depends on: #6780
Depends on: #5518 (via #6780)

On #6780, after an eligible synthetic bank was replaced with malformed input, the normal --cue-sheet CLI skipped it with exit 0. #6819 then accepted the previous sheet and emitted the previous channel's labels into a fresh directory. Successful revisions removing markers, shortening the frame limit, or changing the channel ID produced current rows. Existing Audacity directories intentionally reject publication.

Atomically replace an existing sheet with an empty one before reading the selected bank. Publish verified rows only once the export succeeds. A failure to invalidate the sheet itself fails the bank before audio writes.

Tested on Windows with synthetic banks only. The regression runs the CLI against both malformed input and a blocked Ogg destination. All 78 tests passed across test_awc_markers.py, test_awc_opus.py, and test_audio_stage_resume.py. CPU only, GPU and driver inapplicable. AI-assisted.

zzEmmazz and others added 4 commits November 23, 2026 13:11
…cord by record (ASSET-320)

docs/rsc8_audio.md read the near-equal start/end counts on five cue names
(196/197, 101/101, 54/54, 49/49, 20/19) as region pairs and labelled it a
hypothesis, because the split was counted and not matched. pair_marker_regions()
matches them: inside one 0xbd tag, a pair is a start whose next record of the
same name is an end at the same or a later offset; every other record of such
a name is an exception. Every scan summary gets a marker_regions block (per
name hash: starts, ends, pairs, exceptions by kind, pair lengths; pairs per
tag; overlaps between names; where each exception sits in its tag). Counts,
sample offsets and 32-bit hashes only.

Measured over all of audio.rpf (7,162 banks, 420,168 0xbd tags, 781,350
records): 841 region records in 22 tags, 420 start, 420 end, one third value;
418 pairs, 20 of 22 tags pair completely, 5 exceptions in two tags, none at
an edge of its tag. The other three archives with ADAT banks have none.

Tests build their records and banks by hand.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@memorypressure

Copy link
Copy Markdown

Verified at 0bd95f8 merged with current main 023952c: both suites green under python -I (test_awc_markers Ran 10, test_rsc8_audio Ran 48, re-run at the newer tip). The re-export invalidation clears cue_regions.json up front so a bank skipped mid-run can't leave stale regions current — the ordering is verified in the diff — and the region analysis stays counts/offsets/hashes only, consistent with the tool's counts-only contract. Writes route through the existing atomic write_file. Checks pending. AI-assisted: yes. Tested on Linux (RTX 5080 host, CPU-only run).

@shayderrr shayderrr left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary

  • Adds pair_marker_regions()/tally plumbing in tools/rsc8_audio.py that matches 0xBD start/end cue records into regions and reports pairs, exceptions, overlaps and lengths in scan summaries.
  • Extends tools/awc_opus.py with --cue-sheet, emitting cue_regions.json only for unambiguous stream/channel IDs and clearing stale sheets on skipped banks.
  • Documents the format in docs/audio.md/docs/rsc8_audio.md and covers pairing, overlap and CLI behavior with new unit tests.

Why merge

This turns measured cue-hash observations into a validated, exported region format with stale-output protection. Documentation and tests match the code, so the new report is reproducible and trustworthy.

Verdict: Approve

@shayderrr

Copy link
Copy Markdown
Collaborator

Summary

  • Adds pair_marker_regions()/tally plumbing in tools/rsc8_audio.py that matches 0xBD start/end cue records into regions and reports pairs, exceptions, overlaps and lengths in scan summaries.
  • Extends tools/awc_opus.py with --cue-sheet, emitting cue_regions.json only for unambiguous stream/channel IDs and clearing stale sheets on skipped banks.
  • Documents the format in docs/audio.md/docs/rsc8_audio.md and covers pairing, overlap and CLI behavior with new unit tests.

Why merge

This turns measured cue-hash observations into a validated, exported region format with stale-output protection. Documentation and tests match the code, so the new report is reproducible and trustworthy.

Verdict: Approve

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.

4 participants