added pass through s11

This commit is contained in:
Ayzen
2026-03-26 17:21:25 +03:00
parent 24f7ebb2fb
commit 9ddbde22bd
38 changed files with 945 additions and 291 deletions
@@ -18,6 +18,7 @@ struct ProcessingLiveConfig {
std::string processor_mode = "pass_through";
float gain_db = 0.0F;
float phase_deg = 0.0F;
std::string pass_through_channel = "s21";
bool pass_through_fixed_y_enabled = false;
float pass_through_y_min_db = -100.0F;
float pass_through_y_max_db = 0.0F;
@@ -30,6 +30,13 @@ using Json = nlohmann::json;
throw std::runtime_error("processing.history_command must be one of: none, remove_last, clear_all");
}
[[nodiscard]] auto parse_pass_through_channel(const std::string& value) -> std::string {
if (value == "s21" || value == "s11") {
return value;
}
throw std::runtime_error("processing.pass_through_channel must be one of: s21, s11");
}
[[nodiscard]] auto parse_u64_number(const Json& value, const std::string& field_name) -> std::uint64_t {
if (!value.is_number()) {
throw std::runtime_error(field_name + " must be number");
@@ -101,6 +108,12 @@ using Json = nlohmann::json;
}
config.phase_deg = static_cast<float>(found->get<double>());
}
if (const auto found = root.find("pass_through_channel"); found != root.end()) {
if (!found->is_string()) {
throw std::runtime_error("processing.pass_through_channel must be string");
}
config.pass_through_channel = parse_pass_through_channel(found->get<std::string>());
}
if (const auto found = root.find("pass_through_fixed_y_enabled"); found != root.end()) {
if (!found->is_boolean()) {
throw std::runtime_error("processing.pass_through_fixed_y_enabled must be bool");