diff options
| author | Carl Hetherington <cth@carlh.net> | 2020-04-19 22:04:51 +0200 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2020-04-20 00:31:10 +0200 |
| commit | 43faf1810e74b79711deec499fae7e69abd6870b (patch) | |
| tree | ce39cb0ca09f26a38e917d00b75f71f31f355481 /src | |
| parent | 20cd6dd0a9fa278338c98d385fb75e3e28835ece (diff) | |
Add a namespace.
Diffstat (limited to 'src')
| -rw-r--r-- | src/leqm-nrt-cli.cc | 4 | ||||
| -rw-r--r-- | src/leqm-nrt.cc | 10 | ||||
| -rw-r--r-- | src/leqm-nrt.h | 4 |
3 files changed, 13 insertions, 5 deletions
diff --git a/src/leqm-nrt-cli.cc b/src/leqm-nrt-cli.cc index 6e4f2b1..e4110bb 100644 --- a/src/leqm-nrt-cli.cc +++ b/src/leqm-nrt-cli.cc @@ -91,7 +91,7 @@ int main(int argc, const char ** argv) for (;;) { if (in < argc) { if (!(strncmp(argv[in], "-", 1) == 0) || isdigit(argv[in][1])) { - channel_corrections.push_back(convert_log_to_linear_single(atof(argv[in++]))); + channel_corrections.push_back(leqm_nrt::convert_log_to_linear_single(atof(argv[in++]))); } else break; } else break; @@ -143,7 +143,7 @@ int main(int argc, const char ** argv) } } - auto result = calculate_file(sound_filename, channel_corrections, buffer_size_ms, number_of_filter_interpolation_points, num_cpu); + auto result = leqm_nrt::calculate_file(sound_filename, channel_corrections, buffer_size_ms, number_of_filter_interpolation_points, num_cpu); if (display_leqnw) { printf("Leq(nW): %.4f\n", result.leq_nw); // Leq(no Weighting) diff --git a/src/leqm-nrt.cc b/src/leqm-nrt.cc index 762f7a6..b778357 100644 --- a/src/leqm-nrt.cc +++ b/src/leqm-nrt.cc @@ -41,9 +41,12 @@ #include <mutex> #include <functional> +using namespace leqm_nrt; + // Version 0.0.18 (C) Luca Trisciani 2011-2013, 2017-2018 // Tool from the DCP-Werkstatt Software Bundle +namespace leqm_nrt { class Worker { @@ -156,6 +159,8 @@ private: std::thread _thread; }; +} + //the following is different from version 1 because interpolate between db and not linear. Conversion from db to lin must be done after. //it is also different for the way it interpolates between DC and 31 Hz @@ -237,7 +242,7 @@ static std::vector<double> inverse_fft(std::vector<double> const& freq_response) } -Result calculate_file( +Result leqm_nrt::calculate_file( std::string sound_filename, std::vector<double> channel_corrections, int buffer_size_ms, @@ -323,7 +328,7 @@ std::vector<double> default_channel_corrections(int channels) } -double convert_log_to_linear_single(double in) +double leqm_nrt::convert_log_to_linear_single(double in) { return powf(10, in / 20.0f); } @@ -420,4 +425,3 @@ double Calculator::leq_nw() return _sum.rms(); } - diff --git a/src/leqm-nrt.h b/src/leqm-nrt.h index a72c299..92e2ce3 100644 --- a/src/leqm-nrt.h +++ b/src/leqm-nrt.h @@ -6,6 +6,8 @@ #include <cmath> #include <memory> +namespace leqm_nrt { + class Sum { public: @@ -163,3 +165,5 @@ private: size_t _buffer_free_offset = 0; }; +} + |
