#include #include #include #include #include #include "Arguments.h" #include "SampleStream.h" #include "SampleBlock.h" #include "FilterWorker.h" using std::vector; #define SAMPLE_BLOCK_SIZE 1024 int main(int argc, char** argv) { Arguments args(argc, argv); std::fstream file_input(args.file_input, std::ios::in | std::ios::binary); std::stringstream file_input_content; file_input_content << file_input.rdbuf(); file_input.close(); SampleStream input(file_input_content.str()); vector input_blocks = input.split(SAMPLE_BLOCK_SIZE); SampleStream output(file_input_content.str()); vector output_blocks = output.split(SAMPLE_BLOCK_SIZE); for (size_t i = 0; i < input_blocks.size(); i++) { FilterWorker(input_blocks[i], output_blocks[i]).filter(args.bass, args.treble); } std::fstream file_output(args.file_output, std::ios::out | std::ios::binary); std::string edited_stream = output.save(); file_output.write(edited_stream.c_str(), edited_stream.size()); file_output.close(); return 0; }