updating songbird
This commit is contained in:
parent
2b988fa945
commit
c02f683bc7
1 changed files with 11 additions and 11 deletions
22
songbird.py
22
songbird.py
|
@ -69,8 +69,9 @@ infile = str(sys.argv[1])
|
||||||
outfile = str(sys.argv[2])
|
outfile = str(sys.argv[2])
|
||||||
|
|
||||||
lane_idx = 0
|
lane_idx = 0
|
||||||
bar_len = 1
|
playback_speed = 1
|
||||||
multi_bar = 1
|
multi_bar = 1
|
||||||
|
bar_len = 1
|
||||||
lanes = defaultdict(list)
|
lanes = defaultdict(list)
|
||||||
|
|
||||||
with open(infile, "r") as inf, open(outfile, "wb") as outf:
|
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
|
continue
|
||||||
|
|
||||||
for word in line.split():
|
for word in line.split():
|
||||||
if word[1:].isnumeric():
|
val = word[1:]
|
||||||
val = int(word[1:])
|
|
||||||
|
|
||||||
match word[0]:
|
match word[0]:
|
||||||
case "!":
|
case "!":
|
||||||
lane_idx = val
|
lane_idx = int(val)
|
||||||
case "=":
|
|
||||||
bar_len = val
|
|
||||||
case "%":
|
case "%":
|
||||||
multi_bar = val
|
multi_bar = int(val)
|
||||||
|
case "=":
|
||||||
|
bar_len = int(val)
|
||||||
case "@":
|
case "@":
|
||||||
enc_set("I", val)
|
enc_set("I", int(val))
|
||||||
case "$":
|
case "$":
|
||||||
reg, val = word[1:].split(":")
|
reg, val = word[1:].split(":")
|
||||||
enc_set(reg, int(val))
|
enc_set(reg, int(val))
|
||||||
case _:
|
case _:
|
||||||
m = re.match(r"^([0-9]+)?([a-zA-Z]+|\-)([0-9]+)?$", word)
|
m = re.match(r"^([0-9]+)?([a-zA-Z]+|\-)([0-9]+)?$", word)
|
||||||
d, k, p = m.groups()
|
d, k, p = m.groups()
|
||||||
d = int(float(d) * multi_bar) if d else bar_len * multi_bar
|
d = int(int(d) * multi_bar) if d else bar_len * multi_bar
|
||||||
p = int(p or 0)
|
p = int(p or 0x7f)
|
||||||
enc_note(d, k, p)
|
enc_note(d, k, p)
|
||||||
|
|
||||||
def write_le(v):
|
def write_le(v):
|
||||||
|
@ -129,7 +129,7 @@ with open(infile, "r") as inf, open(outfile, "wb") as outf:
|
||||||
len(used_lanes),
|
len(used_lanes),
|
||||||
0xc0fe0001, # for esoteric reasons the first two bytes are 0xc0fe
|
0xc0fe0001, # for esoteric reasons the first two bytes are 0xc0fe
|
||||||
|
|
||||||
*accumulate(map(len, used_lanes))
|
*map(len, used_lanes)
|
||||||
]
|
]
|
||||||
|
|
||||||
for x in header:
|
for x in header:
|
||||||
|
|
Loading…
Reference in a new issue