diff --git a/bytebeat_compiler.py b/bytebeat_compiler.py index 4cd56dc..ada8782 100644 --- a/bytebeat_compiler.py +++ b/bytebeat_compiler.py @@ -70,6 +70,8 @@ def substitute_vars(replacements: dict, text: str, verbose: bool) -> str: print() return text +preprocessor_bool = lambda value: "1" if value else "0" + CC = fetch("CC") CFLAGS = fetch("CFLAGS") INPUT_FILE = fetch("INPUT_FILE") @@ -180,14 +182,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": "1" if args.signed else "0", - "precalculated_ratio": "1" if args.precalculate_ratio else "0", - "faster_sample_ratio_math": "1" if args.precalculate_ratio else "0", - "fp_return_type": "1" if args.floating_point else "0", + "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), "channels": args.channels, "length": samples, - "silent_mode": "true" if args.silent else "false", - "verbose_mode": "true" if args.verbose and not args.silent else "false", + "silent_mode": preprocessor_bool(args.silent), + "verbose_mode": preprocessor_bool(args.verbose and not args.silent), "fwrite_le": "../" + PATHS["fwrite_le_header"] }, read_file(PATHS["template"]), args.show_substituted_values))