summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2020-04-19 22:59:05 +0200
committerCarl Hetherington <cth@carlh.net>2020-04-20 00:31:10 +0200
commit7f094ed2cde4c8bc187c2728873c234493fc57aa (patch)
treef24af26ebfea386820dd793bfd8918ff445b9370 /src
parent835b4625429b5f57ff381e1321230901f43e13fc (diff)
Add GPL boilerplate; allow building without libsndfile.
Diffstat (limited to 'src')
-rw-r--r--src/leqm_nrt.cc6
-rw-r--r--src/leqm_nrt.h25
-rw-r--r--src/leqm_nrt_cli.cc2
-rw-r--r--src/wscript13
4 files changed, 38 insertions, 8 deletions
diff --git a/src/leqm_nrt.cc b/src/leqm_nrt.cc
index b778357..7785cbc 100644
--- a/src/leqm_nrt.cc
+++ b/src/leqm_nrt.cc
@@ -21,11 +21,13 @@
*/
-#include "leqm-nrt.h"
+#include "leqm_nrt.h"
#include <stdio.h>
#include <math.h>
+#ifdef LEQM_NRT_WITH_LIBSNDFILE
#include <sndfile.h>
+#endif
#include <unistd.h>
#include <pthread.h>
#include <string.h>
@@ -242,6 +244,7 @@ static std::vector<double> inverse_fft(std::vector<double> const& freq_response)
}
+#ifdef LEQM_NRT_WITH_LIBSNDFILE
Result leqm_nrt::calculate_file(
std::string sound_filename,
std::vector<double> channel_corrections,
@@ -302,6 +305,7 @@ Result leqm_nrt::calculate_file(
return {calculator.leq_m(), calculator.leq_nw()};
}
+#endif
std::vector<double> calculate_ir(double number_of_filter_interpolation_points, int sample_rate, int bits_per_sample)
diff --git a/src/leqm_nrt.h b/src/leqm_nrt.h
index 2dc25f0..189f0cf 100644
--- a/src/leqm_nrt.h
+++ b/src/leqm_nrt.h
@@ -1,3 +1,26 @@
+/*
+ leqm-nrt is a non-real-time implementation
+ of Leq(M) measurement according to ISO 21727:2004(E)
+ "Cinematography -- Method of measurement of perceived
+ loudness of motion-picture audio material"
+
+ Copyright (C) 2011-2013, 2017-2018 Luca Trisciani
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+ */
+
#pragma once
#include <string>
@@ -97,6 +120,7 @@ struct Result
};
+#ifdef LEQM_NRT_WITH_LIBSNDFILE
Result calculate_file(
std::string sound_filename,
std::vector<double> channel_corrections,
@@ -104,6 +128,7 @@ Result calculate_file(
int number_of_filter_interpolation_points,
int num_cpu
);
+#endif
double convert_log_to_linear_single(double in);
diff --git a/src/leqm_nrt_cli.cc b/src/leqm_nrt_cli.cc
index e4110bb..6387f69 100644
--- a/src/leqm_nrt_cli.cc
+++ b/src/leqm_nrt_cli.cc
@@ -21,7 +21,7 @@
*/
-#include "leqm-nrt.h"
+#include "leqm_nrt.h"
#include <stdio.h>
#include <math.h>
diff --git a/src/wscript b/src/wscript
index a5c51a6..cbea215 100644
--- a/src/wscript
+++ b/src/wscript
@@ -5,12 +5,13 @@ def build(bld):
obj.export_includes = ['.']
obj.source = 'leqm_nrt.cc'
- obj = bld(features='cxx cxxprogram')
- obj.name = 'leqm_nrt_cli'
- obj.target = 'leqm_nrt'
- obj.source = 'leqm_nrt_cli.cc'
- obj.use = 'libleqm_nrt'
- obj.uselib = 'SNDFILE'
+ if bld.env.WITH_LIBSNDFILE:
+ obj = bld(features='cxx cxxprogram')
+ obj.name = 'leqm_nrt_cli'
+ obj.target = 'leqm_nrt'
+ obj.source = 'leqm_nrt_cli.cc'
+ obj.use = 'libleqm_nrt'
+ obj.uselib = 'SNDFILE'
bld.install_files('${PREFIX}/include', 'leqm_nrt.h')