abc2midi: allow %%MIDIdef macros to be defined anywhere (#23)

* abc2midi: allow %%MIDIdef macros to be defined anywhere

Fix also some lost CHANGES from previous commit.

abc2midi: allow %%MIDIdef macros to be defined anywhere, including before the first X: field (outside any tune). Previously %%MIDIdef was only handled inside event_specific() after the started_parsing check,so macros defined in the file header were silently ignored.
The %%MIDIdef handling has been moved before the started_parsing check in event_specific() in store.c since macro definitions are context-independent.

* Update the golden test files since X:, R: and C: are now emitted
This commit is contained in:
Ronan Keryell
2026-04-23 06:21:48 -07:00
committed by GitHub
parent 22ad87cd72
commit 6ecbbde0fd
7 changed files with 84 additions and 7 deletions

View File

@@ -5,8 +5,12 @@ Time=0 Meta Text, type=0x01 (Text Event) leng=10
Time=0 Tempo, microseconds-per-MIDI-quarter-note=472440
Time=0 Key signature, sharp/flats=1 minor=0
Time=0 Time signature=4/4 MIDI-clocks/click=48 32nd-notes/24-MIDI-clocks=8
Time=0 Meta Text, type=0x01 (Text Event) leng=3
Text = <X:1>
Time=0 Meta Text, type=0x03 (Sequence/Track Name) leng=13
Text = <Horses Branle>
Time=0 Meta Text, type=0x01 (Text Event) leng=6
Text = <C:Trad>
Time=1 Note on, chan=1 pitch=67 vol=105
Time=360 Note off, chan=1 pitch=67 vol=0
Time=361 Note on, chan=1 pitch=69 vol=80