Commit Graph
6 Commits
Author SHA1 Message Date
aneurinandClaude Sonnet 5.5 535856ba77 Read repeated point spellings in a fixed order and end comments at a carriage return
Two spellings of one curve point, as v064 and v64, now give the same
result each time. A line comment ends at a lone carriage return, as in
sfizz. Header.Set's documentation says an include in the header's range
can override what it sets.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-12-02 00:46:19 +00:00
aneurinandClaude Sonnet 5.5 8134660721 Fix the differences from the spec and sfizz that a conformance review found
Read opcodes under their other names. The registry lists the other names an
opcode has, and the typed model now reads each under its own name: amp_release
for ampeg_release, offby, bendup, tune_keytrack and the rest. Apply treats an
old name as belonging to the same field, so it doesn't leave one behind.

Cut a #define's value at the first space, as ARIA and sfizz do, so that two
defines can share a line. Before, the first define took the rest of the line,
and a kit that writes "#define $lo 1  #define $hi 25" lost its velocity layers.

Ignore opcodes before any header when flattening, as sfizz does, and report
them as a warning. Included files that hold only opcodes are not affected.

Read the limits of a controller the same way each time. A region that sets
lohdccN and inherits loccN took whichever the map gave first, so Apply's change
could read back as the old limits. The hdcc opcodes now win.

Accept -1 for lokey, hikey and key, which SFZ v2 allows, and don't report a
region with a hikey of -1 as an inverted range.

Cut numbers that don't fit to what a setting can hold, so offset=1e30 doesn't
turn negative, and ignore a controller number or octave that overflows.

Read polyphony=legato_high, legato_last and legato_low as a limit of 1.

Put a new #define after a byte order mark.

Mark in the tests where each expected value comes from, correct the tags that
the spec doesn't support, and add tests for each of these.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-12-01 20:38:57 +00:00
aneurinandClaude Sonnet 5.5 e08f3a5d0b Make reading a header's opcodes safe for concurrent readers
indexOf wrote the node's remembered index even when it was right, so
Header.Get raced when a document was read from several goroutines.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-12-01 19:15:55 +00:00
aneurinandClaude Sonnet 5.5 158661eefe Rewrite the code comments for consistent tone and accuracy
Comments only: the tokens of every Go file are unchanged.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-12-01 19:08:00 +00:00
aneurinandClaude Sonnet 5.5 d4b44b6ffb Check edited values, keep comments in place and make edits cheap
- Header.Set, Document.SetDefine and Document.AddHeader return an error for
  a value or name that can't be written as one opcode, define or header, and
  Build returns the same error for what it can't write.
- Set puts a new opcode after the last one's trailing comment, and never
  where text on its line would become part of its value. Delete keeps the
  line breaks it doesn't own.
- Node.Line and Node.Col are replaced by File.Position, which works lines and
  columns out when asked, and a node remembers where it was in its file, so an
  edit no longer renumbers the file or searches it from the start.
- Add FuzzEdit checks that an edited file reads back as its nodes.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-12-01 18:27:17 +00:00
aneurinandClaude Sonnet 5.5 3d2ab78a32 Add editing, writing and building documents
Header.Get, Set and Delete edit opcodes in place and keep the text around
them. Write and WriteFiles take WriteOptions to inline includes, expand
variables and set line endings. Build makes a document from a typed
Instrument, with options to split regions into included files and to
hoist repeated values into #define directives.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-12-01 17:41:34 +00:00