#include #include #include #include #include "Arguments.h" #include "SampleStream.h" #include "FilterWorker.h" 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 stream(file_input_content.str()); std::vector original; original = std::vector(stream._stream); for (unsigned long i = 0; i < original.size(); i++) { double x_pp = i < 2 ? 0 : original[i-2]; double x_p = i < 1 ? 0 : original[i-1]; double x_ = i < 0 ? 0 : original[i-0]; double y_pp = i < 2 ? 0 : stream._stream[i-2]; double y_p = i < 1 ? 0 : stream._stream[i-1]; stream._stream[i] = args.bass.b0 * x_ + args.bass.b1 * x_p + args.bass.b2 * x_pp + args.bass.a1 * y_p + args.bass.a2 * y_pp; } original = std::vector(stream._stream); for (unsigned long i = 0; i < original.size(); i++) { double x_pp = i < 2 ? 0 : original[i-2]; double x_p = i < 1 ? 0 : original[i-1]; double x_ = i < 0 ? 0 : original[i-0]; double y_pp = i < 2 ? 0 : stream._stream[i-2]; double y_p = i < 1 ? 0 : stream._stream[i-1]; stream._stream[i] = args.treble.b0 * x_ + args.treble.b1 * x_p + args.treble.b2 * x_pp + args.treble.a1 * y_p + args.treble.a2 * y_pp; } std::fstream file_output(args.file_output, std::ios::out | std::ios::binary); std::string edited_stream = stream.save(); file_output.write(edited_stream.c_str(), edited_stream.size()); file_output.close(); return 0; }