1
0

bytebeat_compiler.py: fix sample rate logic

This commit is contained in:
Intel A80486DX2-66 2024-01-10 04:08:05 +03:00
parent d1906f0dc1
commit d326f32193
Signed by: 80486DX2-66
GPG Key ID: 83631EF27054609B

View File

@ -176,9 +176,9 @@ if __name__ == "__main__":
if no_seconds and samples_exist: if no_seconds and samples_exist:
samples = args.samples samples = args.samples
elif seconds_exist and samples_exist: elif seconds_exist and samples_exist:
samples = args.seconds * args.sample_rate + args.samples samples = args.seconds * args.final_sample_rate + args.samples
elif seconds_exist and no_samples: elif seconds_exist and no_samples:
samples = args.seconds * args.sample_rate samples = args.seconds * args.final_sample_rate
elif no_seconds and no_samples: elif no_seconds and no_samples:
args.seconds = 30 # default args.seconds = 30 # default
continue continue
@ -197,7 +197,8 @@ if __name__ == "__main__":
rewrite_file(PATHS["substitute"], substitute_vars({ rewrite_file(PATHS["substitute"], substitute_vars({
"bytebeat_contents": bytebeat_contents, "bytebeat_contents": bytebeat_contents,
"output_file": C_str_repr(args.output), "output_file": C_str_repr(args.output),
"sample_rate": args.sample_rate, "sample_rate": \
value if (value := args.final_sample_rate) else args.sample_rate,
"original_sample_rate": original_sample_rate, "original_sample_rate": original_sample_rate,
"final_sample_rate_code": final_sample_rate_code, "final_sample_rate_code": final_sample_rate_code,
"bit_depth": args.bit_depth, "bit_depth": args.bit_depth,