b/c...py: call preprocessor_bool
in substitute_vars
This commit is contained in:
parent
d045eb7355
commit
c2b67077b2
@ -63,6 +63,9 @@ def substitute_vars(replacements: dict, text: str, verbose: bool) -> str:
|
|||||||
if verbose:
|
if verbose:
|
||||||
print("Substituting values:")
|
print("Substituting values:")
|
||||||
for placeholder, replacement in replacements.items():
|
for placeholder, replacement in replacements.items():
|
||||||
|
if isinstance(replacement, bool):
|
||||||
|
replacement = preprocessor_bool(replacement)
|
||||||
|
|
||||||
if verbose and placeholder != "bytebeat_contents":
|
if verbose and placeholder != "bytebeat_contents":
|
||||||
print(placeholder, ": ", replacement, sep="")
|
print(placeholder, ": ", replacement, sep="")
|
||||||
text = text.replace(f"`{placeholder}`", str(replacement))
|
text = text.replace(f"`{placeholder}`", str(replacement))
|
||||||
@ -182,14 +185,14 @@ if __name__ == "__main__":
|
|||||||
"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,
|
||||||
"is_signed": preprocessor_bool(args.signed),
|
"is_signed": args.signed,
|
||||||
"precalculated_ratio": preprocessor_bool(args.precalculate_ratio),
|
"precalculated_ratio": args.precalculate_ratio,
|
||||||
"faster_sample_ratio_math": preprocessor_bool(args.precalculate_ratio),
|
"faster_sample_ratio_math": args.precalculate_ratio,
|
||||||
"fp_return_type": preprocessor_bool(args.floating_point),
|
"fp_return_type": args.floating_point,
|
||||||
"channels": args.channels,
|
"channels": args.channels,
|
||||||
"length": samples,
|
"length": samples,
|
||||||
"silent_mode": preprocessor_bool(args.silent),
|
"silent_mode": args.silent,
|
||||||
"verbose_mode": preprocessor_bool(args.verbose and not args.silent),
|
"verbose_mode": args.verbose and not args.silent,
|
||||||
"fwrite_le": "../" + PATHS["fwrite_le_header"]
|
"fwrite_le": "../" + PATHS["fwrite_le_header"]
|
||||||
}, read_file(PATHS["template"]), args.show_substituted_values))
|
}, read_file(PATHS["template"]), args.show_substituted_values))
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user