updating songbird

This commit is contained in:
Lucy 2024-11-26 02:56:31 +01:00
parent 2b988fa945
commit c02f683bc7

View file

@ -69,8 +69,9 @@ infile = str(sys.argv[1])
outfile = str(sys.argv[2])
lane_idx = 0
bar_len = 1
playback_speed = 1
multi_bar = 1
bar_len = 1
lanes = defaultdict(list)
with open(infile, "r") as inf, open(outfile, "wb") as outf:
@ -98,26 +99,25 @@ with open(infile, "r") as inf, open(outfile, "wb") as outf:
continue
for word in line.split():
if word[1:].isnumeric():
val = int(word[1:])
val = word[1:]
match word[0]:
case "!":
lane_idx = val
case "=":
bar_len = val
lane_idx = int(val)
case "%":
multi_bar = val
multi_bar = int(val)
case "=":
bar_len = int(val)
case "@":
enc_set("I", val)
enc_set("I", int(val))
case "$":
reg, val = word[1:].split(":")
enc_set(reg, int(val))
case _:
m = re.match(r"^([0-9]+)?([a-zA-Z]+|\-)([0-9]+)?$", word)
d, k, p = m.groups()
d = int(float(d) * multi_bar) if d else bar_len * multi_bar
p = int(p or 0)
d = int(int(d) * multi_bar) if d else bar_len * multi_bar
p = int(p or 0x7f)
enc_note(d, k, p)
def write_le(v):
@ -129,7 +129,7 @@ with open(infile, "r") as inf, open(outfile, "wb") as outf:
len(used_lanes),
0xc0fe0001, # for esoteric reasons the first two bytes are 0xc0fe
*accumulate(map(len, used_lanes))
*map(len, used_lanes)
]
for x in header: