From 47bbfdbf1e2a6193157397938e76b16a1f60e789 Mon Sep 17 00:00:00 2001 From: Vasile Vilvoiu Date: Fri, 16 Jul 2021 18:32:27 +0300 Subject: Add support for arbitrary scales, with custom units. Add support for linear scales. Logging of scale to stderr. Closes #9. --- src/specgram.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'src/specgram.cpp') diff --git a/src/specgram.cpp b/src/specgram.cpp index 6e209af..cb646fc 100644 --- a/src/specgram.cpp +++ b/src/specgram.cpp @@ -146,14 +146,15 @@ main(int argc, char** argv) FFT fft(conf.GetFFTWidth(), win_function); /* create value map */ - std::unique_ptr value_map = nullptr; - if (conf.GetScale() == ValueMapType::kdBFS) { - value_map = std::make_unique(conf.GetScaleLowerBound()); - } else { - assert(false); - spdlog::error("Internal error: unknown scale"); - return 1; - } + spdlog::info("Scale {}, unit {}, bounds [{}, {}]", + conf.GetScaleType() == ValueMapType::kLinear ? "linear" : "decibel", + conf.GetScaleUnit(), + conf.GetScaleLowerBound(), + conf.GetScaleUpperBound()); + std::unique_ptr value_map = ValueMap::Build(conf.GetScaleType(), + conf.GetScaleLowerBound(), + conf.GetScaleUpperBound(), + conf.GetScaleUnit()); /* create color map */ auto color_map = ColorMap::FromType(conf.GetColorMap(), -- cgit v1.2.3