summaryrefslogtreecommitdiff
path: root/tools/spectool.cc
diff options
context:
space:
mode:
authorskal <pascal.massimino@gmail.com>2026-02-01 00:58:20 +0100
committerskal <pascal.massimino@gmail.com>2026-02-01 01:13:53 +0100
commit18eb8a07ba39a8aad1c75521cee027b9c9c72e40 (patch)
tree87e498dbaffdd591eb94fddca315f6ba28756a32 /tools/spectool.cc
parent03cd94817097e59a0809b222e0e1e74dd9a8ede7 (diff)
clang-format
Diffstat (limited to 'tools/spectool.cc')
-rw-r--r--tools/spectool.cc20
1 files changed, 11 insertions, 9 deletions
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<float> 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) {