From 18eb8a07ba39a8aad1c75521cee027b9c9c72e40 Mon Sep 17 00:00:00 2001 From: skal Date: Sun, 1 Feb 2026 00:58:20 +0100 Subject: clang-format --- tools/spectool.cc | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'tools/spectool.cc') diff --git a/tools/spectool.cc b/tools/spectool.cc index 5c05a03..80a970e 100644 --- a/tools/spectool.cc +++ b/tools/spectool.cc @@ -31,7 +31,7 @@ struct SpecHeader { int32_t num_frames; }; -int analyze_audio(const char *in_path, const char *out_path) { +int analyze_audio(const char* in_path, const char* out_path) { printf("Analyzing %s -> %s\n", in_path, out_path); ma_decoder_config config = ma_decoder_config_init(ma_format_f32, 1, 32000); @@ -57,7 +57,9 @@ int analyze_audio(const char *in_path, const char *out_path) { } // Apply window - for (int i = 0; i < DCT_SIZE; ++i) { pcm_chunk[i] *= window[i]; } + for (int i = 0; i < DCT_SIZE; ++i) { + pcm_chunk[i] *= window[i]; + } // Apply FDCT float dct_chunk[DCT_SIZE]; @@ -88,7 +90,7 @@ int analyze_audio(const char *in_path, const char *out_path) { spec_data.resize(last_frame * DCT_SIZE); // Write to .spec file - FILE *f_out = fopen(out_path, "wb"); + FILE* f_out = fopen(out_path, "wb"); if (!f_out) { printf("Error: Failed to open output file: %s\n", out_path); return 1; @@ -108,10 +110,10 @@ int analyze_audio(const char *in_path, const char *out_path) { return 0; } -int play_spec(const char *in_path) { +int play_spec(const char* in_path) { printf("Playing %s\n", in_path); - FILE *f_in = fopen(in_path, "rb"); + FILE* f_in = fopen(in_path, "rb"); if (!f_in) { printf("Error: Failed to open input file: %s\n", in_path); return 1; @@ -152,7 +154,7 @@ int play_spec(const char *in_path) { return 0; } -int test_gen(const char *out_path) { +int test_gen(const char* out_path) { printf("Generating test spectrogram -> %s\n", out_path); std::vector track_data; @@ -189,7 +191,7 @@ int test_gen(const char *out_path) { } // Write to file (Duplicate logic, but fine for now) - FILE *f_out = fopen(out_path, "wb"); + FILE* f_out = fopen(out_path, "wb"); if (!f_out) { printf("Error: Failed to open output file: %s\n", out_path); return 1; @@ -222,13 +224,13 @@ void print_usage() { "spectrogram.\n"); } -int main(int argc, char **argv) { +int main(int argc, char** argv) { if (argc < 2) { print_usage(); return 1; } - const char *command = argv[1]; + const char* command = argv[1]; if (strcmp(command, "analyze") == 0) { if (argc < 4) { -- cgit v1.2.3