From c2b67077b233331d1cdf318840a7dc96cf942f58 Mon Sep 17 00:00:00 2001 From: Intel A80486DX2-66 Date: Tue, 9 Jan 2024 18:34:12 +0300 Subject: [PATCH] b/c...py: call `preprocessor_bool` in `substitute_vars` --- bytebeat_compiler.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/bytebeat_compiler.py b/bytebeat_compiler.py index ada8782..8427cf6 100644 --- a/bytebeat_compiler.py +++ b/bytebeat_compiler.py @@ -63,6 +63,9 @@ def substitute_vars(replacements: dict, text: str, verbose: bool) -> str: if verbose: print("Substituting values:") for placeholder, replacement in replacements.items(): + if isinstance(replacement, bool): + replacement = preprocessor_bool(replacement) + if verbose and placeholder != "bytebeat_contents": print(placeholder, ": ", replacement, sep="") text = text.replace(f"`{placeholder}`", str(replacement)) @@ -182,14 +185,14 @@ if __name__ == "__main__": "original_sample_rate": original_sample_rate, "final_sample_rate_code": final_sample_rate_code, "bit_depth": args.bit_depth, - "is_signed": preprocessor_bool(args.signed), - "precalculated_ratio": preprocessor_bool(args.precalculate_ratio), - "faster_sample_ratio_math": preprocessor_bool(args.precalculate_ratio), - "fp_return_type": preprocessor_bool(args.floating_point), + "is_signed": args.signed, + "precalculated_ratio": args.precalculate_ratio, + "faster_sample_ratio_math": args.precalculate_ratio, + "fp_return_type": args.floating_point, "channels": args.channels, "length": samples, - "silent_mode": preprocessor_bool(args.silent), - "verbose_mode": preprocessor_bool(args.verbose and not args.silent), + "silent_mode": args.silent, + "verbose_mode": args.verbose and not args.silent, "fwrite_le": "../" + PATHS["fwrite_le_header"] }, read_file(PATHS["template"]), args.show_substituted_values))