diff options
| author | Vasile Vilvoiu <vasi@vilvoiu.ro> | 2021-07-16 18:32:27 +0300 |
|---|---|---|
| committer | Vasile Vilvoiu <vasi@vilvoiu.ro> | 2021-07-16 18:32:27 +0300 |
| commit | 47bbfdbf1e2a6193157397938e76b16a1f60e789 (patch) | |
| tree | 5f90ac568bcd0ddfa2e885bacf4e4e996395d249 /src/specgram.cpp | |
| parent | 82c81858c65c80fb667e73ffdcc4ff69007cfa17 (diff) | |
Add support for arbitrary scales, with custom units.
Add support for linear scales.
Logging of scale to stderr.
Closes #9.
Diffstat (limited to 'src/specgram.cpp')
| -rw-r--r-- | src/specgram.cpp | 17 |
1 files changed, 9 insertions, 8 deletions
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<ValueMap> value_map = nullptr; - if (conf.GetScale() == ValueMapType::kdBFS) { - value_map = std::make_unique<dBFSValueMap>(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<ValueMap> value_map = ValueMap::Build(conf.GetScaleType(), + conf.GetScaleLowerBound(), + conf.GetScaleUpperBound(), + conf.GetScaleUnit()); /* create color map */ auto color_map = ColorMap::FromType(conf.GetColorMap(), |
