diff options
Diffstat (limited to 'tools')
| -rw-r--r-- | tools/spectool.cc | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/tools/spectool.cc b/tools/spectool.cc index a9bf551..aa28a0b 100644 --- a/tools/spectool.cc +++ b/tools/spectool.cc @@ -97,26 +97,27 @@ int analyze_audio(const char* in_path, const char* out_path) { for (int i = num_frames - 1; i >= first_frame; --i) { bool all_zeros = true; for (int j = 0; j < DCT_SIZE; ++j) { - if (fabsf(spec_data[i * DCT_SIZE + j]) > epsilon) { - all_zeros = false; - break; - } + if (fabsf(spec_data[i * DCT_SIZE + j]) > epsilon) { + all_zeros = false; + break; + } } if (all_zeros) { - last_frame = i; + last_frame = i; } else { - break; + break; } } // Create a new vector with the trimmed data std::vector<float> trimmed_data; if (first_frame < last_frame) { - trimmed_data.assign(spec_data.begin() + first_frame * DCT_SIZE, - spec_data.begin() + last_frame * DCT_SIZE); + trimmed_data.assign(spec_data.begin() + first_frame * DCT_SIZE, + spec_data.begin() + last_frame * DCT_SIZE); } - printf("Trimming: Original frames: %d -> Trimmed frames: %zu\n", num_frames, trimmed_data.size() / DCT_SIZE); + printf("Trimming: Original frames: %d -> Trimmed frames: %zu\n", num_frames, + trimmed_data.size() / DCT_SIZE); // Write to .spec file FILE* f_out = fopen(out_path, "wb"); |
