Apply changes to a typed region as patches to its own header

Instrument.Patches works out the opcode changes that make region i read as an
updated Region, checking them against the reader, and Instrument.Apply makes
them in the document. Only the changed settings are touched, always in the
region's own header, so unknown opcodes and what other regions inherit stay as
they are. A change the header can't hold is an error and changes nothing.

FlatRegion gains Own, Inherited and Header to trace a region to its source, and
regionLines lists a region's opcodes with the field each sets.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-12-01 18:42:17 +00:00
co-authored by Claude Sonnet 5.5
parent 359de59033
commit 83c905633c
7 changed files with 704 additions and 102 deletions
+5
View File
@@ -221,6 +221,11 @@ type Instrument struct {
Controls []Control `json:"controls,omitempty" doc:"The controllers that the instrument names, sets or uses."`
// Keyswitches are its keyswitch keys, or nil if it has none.
Keyswitches *KeyswitchRange `json:"keyswitches,omitempty" doc:"The keys that are keyswitches, or nil if the instrument has none."`
// sources are the flattened regions that the typed ones were read from, in
// the same order, and eval reads a region from opcodes as they were.
sources []FlatRegion
eval evaluator
}
// Reasons a region is skipped: the typed model has no region for it.