diff --git a/VstHost_VisualC++/modules/AudioProcessing/source/WaveProcessingPipeline.cpp b/VstHost_VisualC++/modules/AudioProcessing/source/WaveProcessingPipeline.cpp index 80ca1b5..465826d 100644 --- a/VstHost_VisualC++/modules/AudioProcessing/source/WaveProcessingPipeline.cpp +++ b/VstHost_VisualC++/modules/AudioProcessing/source/WaveProcessingPipeline.cpp @@ -55,6 +55,7 @@ int WaveProcessingPipeline::CreatePreprocessingModules() int WaveProcessingPipeline::PreprocessingProcessing() { + LOG(INFO) << "Prepocessing in progress.."; int status = preprocessing_filter_wrapper_->Process(input_wave_->data, output_wave_->data); RETURN_ERROR_IF_NOT_SUCCESS_OR_BYPASS(status); if (status == VST_ERROR_STATUS::SUCCESS) @@ -62,6 +63,7 @@ int WaveProcessingPipeline::PreprocessingProcessing() status = SwapInOutBuffers(); RETURN_ERROR_IF_NOT_SUCCESS(status); } + LOG(INFO) << "Prepocessing finished."; return status; } @@ -75,7 +77,10 @@ int WaveProcessingPipeline::CreatePostprocessingModules() int WaveProcessingPipeline::PostprocessingProcessing() { - return postprocessing_filter_wrapper_->Process(input_wave_->data, output_wave_->data); + LOG(INFO) << "Postpocessing in progress.."; + int status = postprocessing_filter_wrapper_->Process(input_wave_->data, output_wave_->data); + LOG(INFO) << "Postpocessing finished."; + return status; } int WaveProcessingPipeline::GetConfig() diff --git a/VstHost_VisualC++/modules/UnitTests/data/sine_440_filtrated_pre_and_post_proc_both.wav b/VstHost_VisualC++/modules/UnitTests/data/sine_440_filtrated_pre_and_post_proc_both.wav new file mode 100644 index 0000000..652681d Binary files /dev/null and b/VstHost_VisualC++/modules/UnitTests/data/sine_440_filtrated_pre_and_post_proc_both.wav differ diff --git a/VstHost_VisualC++/modules/UnitTests/data/sine_440_filtrated_pre_and_post_proc_only.wav b/VstHost_VisualC++/modules/UnitTests/data/sine_440_filtrated_pre_and_post_proc_only.wav new file mode 100644 index 0000000..4154ef3 Binary files /dev/null and b/VstHost_VisualC++/modules/UnitTests/data/sine_440_filtrated_pre_and_post_proc_only.wav differ diff --git a/VstHost_VisualC++/modules/UnitTests/data/sine_440_filtrated_pre_post_vst_host.wav b/VstHost_VisualC++/modules/UnitTests/data/sine_440_filtrated_pre_post_vst_host.wav new file mode 100644 index 0000000..023b6e4 Binary files /dev/null and b/VstHost_VisualC++/modules/UnitTests/data/sine_440_filtrated_pre_post_vst_host.wav differ diff --git a/VstHost_VisualC++/modules/UnitTests/data/sine_440_filtrated_pre_vst_host.wav b/VstHost_VisualC++/modules/UnitTests/data/sine_440_filtrated_pre_vst_host.wav new file mode 100644 index 0000000..3a7081b Binary files /dev/null and b/VstHost_VisualC++/modules/UnitTests/data/sine_440_filtrated_pre_vst_host.wav differ diff --git a/VstHost_VisualC++/modules/UnitTests/header/UnitTestsCommon.h b/VstHost_VisualC++/modules/UnitTests/header/UnitTestsCommon.h index b77d5cd..de978a3 100644 --- a/VstHost_VisualC++/modules/UnitTests/header/UnitTestsCommon.h +++ b/VstHost_VisualC++/modules/UnitTests/header/UnitTestsCommon.h @@ -22,7 +22,10 @@ const std::string REF_OUTPUT_WITH_TWO_PLUGINS_2 = UT_DATA_FOLDER + "sine_440 const std::string PROCESSING_CONFIG_PATH = UT_DATA_FOLDER + "processing_config.json"; const std::string PLUGIN_NAME = "plugin_1"; const std::string REF_FILTRATED = UT_DATA_FOLDER + "sine_440_filtrated.wav"; -const std::string REF_PRE_POST_PROC = UT_DATA_FOLDER + "sine_440_filtrated_pre_and_post_proc.wav"; +const std::string REF_PRE_POST_PROC_ONLY = UT_DATA_FOLDER + "sine_440_filtrated_pre_and_post_proc_only.wav"; +const std::string REF_PRE_POST_PROC_BOTH = UT_DATA_FOLDER + "sine_440_filtrated_pre_and_post_proc_both.wav"; +const std::string REF_PRE_POST_VST_HOST = UT_DATA_FOLDER + "sine_440_filtrated_pre_post_vst_host.wav"; +const std::string REF_PRE_VST_HOST = UT_DATA_FOLDER + "sine_440_filtrated_pre_vst_host.wav"; const float PRECISION_9_DECIMAL_PLACES = 1e-9; const float PRECISION_8_DECIMAL_PLACES = 1e-8; diff --git a/VstHost_VisualC++/modules/UnitTests/src/VstHostToolUnitTests.cpp b/VstHost_VisualC++/modules/UnitTests/src/VstHostToolUnitTests.cpp index debc14b..33e7926 100644 --- a/VstHost_VisualC++/modules/UnitTests/src/VstHostToolUnitTests.cpp +++ b/VstHost_VisualC++/modules/UnitTests/src/VstHostToolUnitTests.cpp @@ -33,10 +33,10 @@ namespace VstHostToolUnitTest void CleanUpUtProducts() { - /* if (std::filesystem::exists(OUTPUT_WAVE_PATH)) + if (std::filesystem::exists(OUTPUT_WAVE_PATH)) { std::remove(OUTPUT_WAVE_PATH.c_str()); - }*/ + } if (std::filesystem::exists(DUMP_JSON_FILE_PATH)) { @@ -124,7 +124,7 @@ namespace VstHostToolUnitTest return status; } - void AppProcessingWithOutputValidation(std::string ref_path, bool validate_for_macos=true, bool bit_exact=true) + void AppProcessingWithOutputValidation(std::string ref_path, bool validate_quality=true, bool bit_exact=true) { std::vector arg_params = { "OfflineToolsUnitTests.exe", @@ -146,7 +146,7 @@ namespace VstHostToolUnitTest std::vector ref; status = LoadWave(ref_path, &ref); EXPECT_EQ(status, VST_ERROR_STATUS::SUCCESS); - if (validate_for_macos) + if (validate_quality) { if (bit_exact) { @@ -407,8 +407,8 @@ namespace VstHostToolUnitTest status = JsonUtils::DumpJson(json_config, PROCESSING_CONFIG_PATH); EXPECT_EQ(status, VST_ERROR_STATUS::SUCCESS); -#ifndef __APPLE__ - AppProcessingWithOutputValidation(REF_PRE_POST_PROC, true, false); +#ifdef _WIN32 + AppProcessingWithOutputValidation(REF_PRE_POST_PROC_ONLY, true, false); #else AppProcessingWithOutputValidation(REF_PRE_POST_PROC, false); #endif //!__APPLE__ @@ -424,17 +424,85 @@ namespace VstHostToolUnitTest status = JsonUtils::DumpJson(json_config, PROCESSING_CONFIG_PATH); EXPECT_EQ(status, VST_ERROR_STATUS::SUCCESS); -#ifndef __APPLE__ - AppProcessingWithOutputValidation(REF_PRE_POST_PROC, true, false); +#ifdef _WIN32 + AppProcessingWithOutputValidation(REF_PRE_POST_PROC_ONLY, true, false); #else AppProcessingWithOutputValidation(REF_PRE_POST_PROC, false); -#endif //!__APPLE__ +#endif //_WIN32 + } + + TEST_F(VstHostToolTest, RunToolWithPreAndPostprocessing) + { + nlohmann::json json_config; + int status = FirstConfigPreparations(&json_config, false); + EXPECT_EQ(status, VST_ERROR_STATUS::SUCCESS); + json_config[PREPROCESSING_STRING]["filter"]["enable"] = true; + json_config[POSTPROCESSING_STRING]["filter"]["enable"] = true; + + status = JsonUtils::DumpJson(json_config, PROCESSING_CONFIG_PATH); + EXPECT_EQ(status, VST_ERROR_STATUS::SUCCESS); +#ifdef _WIN32 + AppProcessingWithOutputValidation(REF_PRE_POST_PROC_BOTH, true, false); +#else + AppProcessingWithOutputValidation(REF_PRE_POST_PROC_BOTH, false); +#endif //_WIN32 + } + + TEST_F(VstHostToolTest, RunToolWithPrePostVstHostProcessing) + { + nlohmann::json json_config; + bool enable_vst_host = true; + std::string ref_file = REF_PRE_POST_VST_HOST; + int status = FirstConfigPreparations(&json_config, enable_vst_host); + EXPECT_EQ(status, VST_ERROR_STATUS::SUCCESS); + json_config[PREPROCESSING_STRING]["filter"]["enable"] = true; + json_config[POSTPROCESSING_STRING]["filter"]["enable"] = true; + + status = JsonUtils::DumpJson(json_config, PROCESSING_CONFIG_PATH); + EXPECT_EQ(status, VST_ERROR_STATUS::SUCCESS); +#ifdef _WIN32 + AppProcessingWithOutputValidation(ref_file, true, false); +#else + AppProcessingWithOutputValidation(ref_file, false); +#endif //_WIN32 + } + + TEST_F(VstHostToolTest, RunToolWithPreVstHostProcessing) + { + nlohmann::json json_config; + bool enable_vst_host = true; + std::string ref_file = REF_PRE_VST_HOST; + int status = FirstConfigPreparations(&json_config, enable_vst_host); + EXPECT_EQ(status, VST_ERROR_STATUS::SUCCESS); + json_config[PREPROCESSING_STRING]["filter"]["enable"] = true; + json_config[POSTPROCESSING_STRING]["filter"]["enable"] = false; + + status = JsonUtils::DumpJson(json_config, PROCESSING_CONFIG_PATH); + EXPECT_EQ(status, VST_ERROR_STATUS::SUCCESS); +#ifdef _WIN32 + AppProcessingWithOutputValidation(ref_file, true, false); +#else + AppProcessingWithOutputValidation(ref_file, false); +#endif //_WIN32 + } + + TEST_F(VstHostToolTest, RunToolWithPostVstHostProcessing) + { + nlohmann::json json_config; + bool enable_vst_host = true; + std::string ref_file = REF_PRE_VST_HOST; + int status = FirstConfigPreparations(&json_config, enable_vst_host); + EXPECT_EQ(status, VST_ERROR_STATUS::SUCCESS); + json_config[PREPROCESSING_STRING]["filter"]["enable"] = false; + json_config[POSTPROCESSING_STRING]["filter"]["enable"] = true; + + status = JsonUtils::DumpJson(json_config, PROCESSING_CONFIG_PATH); + EXPECT_EQ(status, VST_ERROR_STATUS::SUCCESS); +#ifdef _WIN32 + AppProcessingWithOutputValidation(ref_file, true, false); +#else + AppProcessingWithOutputValidation(ref_file, false); +#endif //_WIN32 } -// TODO: -// Prepare reference for each test RunToolWithPreprocessingOnly -// also for RunToolWithPostprocessingOnly and -// Add test for pre and post processing -// Add test for preprocessing + vst_host -// Add test for postprocessing + vst_host }