summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2019-07-02 01:32:54 +0100
committerCarl Hetherington <cth@carlh.net>2019-07-02 01:32:54 +0100
commite6c828cbd577239e7c8e4c532161084a33843a0f (patch)
tree2290dcdc341e47bcec5ed9f364be9f457b7bf3c0 /src/lib
parent8c0414a0dec9f444a80fc30c7be3bc82188446d4 (diff)
Add support for Datasat AP2x and USL sound processors when converting
fader position to gain. Stop storing a chosen processor in config; instead, get the user to choose the processor when calculating gains.
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/cinema_sound_processor.cc39
-rw-r--r--src/lib/cinema_sound_processor.h7
-rw-r--r--src/lib/config.cc20
-rw-r--r--src/lib/config.h7
-rw-r--r--src/lib/datasat_ap2x.cc29
-rw-r--r--src/lib/datasat_ap2x.h31
-rw-r--r--src/lib/dolby_cp750.cc32
-rw-r--r--src/lib/dolby_cp750.h2
-rw-r--r--src/lib/usl.cc29
-rw-r--r--src/lib/usl.h31
-rw-r--r--src/lib/wscript2
11 files changed, 167 insertions, 62 deletions
diff --git a/src/lib/cinema_sound_processor.cc b/src/lib/cinema_sound_processor.cc
index 0b00ee2ee..1a3ba5a0f 100644
--- a/src/lib/cinema_sound_processor.cc
+++ b/src/lib/cinema_sound_processor.cc
@@ -24,6 +24,8 @@
#include "cinema_sound_processor.h"
#include "dolby_cp750.h"
+#include "usl.h"
+#include "datasat_ap2x.h"
#include "dcpomatic_assert.h"
#include <iostream>
#include <cassert>
@@ -35,9 +37,12 @@ vector<CinemaSoundProcessor const *> CinemaSoundProcessor::_cinema_sound_process
/** @param i Our id.
* @param n User-visible name.
*/
-CinemaSoundProcessor::CinemaSoundProcessor (string i, string n)
+CinemaSoundProcessor::CinemaSoundProcessor (string i, string n, float knee, float below, float above)
: _id (i)
, _name (n)
+ , _knee (knee)
+ , _below (below)
+ , _above (above)
{
}
@@ -56,6 +61,8 @@ void
CinemaSoundProcessor::setup_cinema_sound_processors ()
{
_cinema_sound_processors.push_back (new DolbyCP750);
+ _cinema_sound_processors.push_back (new USL);
+ _cinema_sound_processors.push_back (new DatasatAP2x);
}
/** @param id One of our ids.
@@ -103,3 +110,33 @@ CinemaSoundProcessor::from_index (int i)
DCPOMATIC_ASSERT (i <= int(_cinema_sound_processors.size ()));
return _cinema_sound_processors[i];
}
+
+float
+CinemaSoundProcessor::db_for_fader_change (float from, float to) const
+{
+ float db = 0;
+
+ if (from < to) {
+ if (from <= _knee) {
+ float const t = min (to, _knee);
+ db += (t - from) * _below;
+ }
+
+ if (to > 4) {
+ float const t = max (from, _knee);
+ db += (to - t) * _above;
+ }
+ } else {
+ if (from >= _knee) {
+ float const t = max (to, _knee);
+ db -= (from - t) * _above;
+ }
+
+ if (to < _knee) {
+ float const t = min (from, _knee);
+ db -= (t - to) * _below;
+ }
+ }
+
+ return db;
+}
diff --git a/src/lib/cinema_sound_processor.h b/src/lib/cinema_sound_processor.h
index c19c6ca22..25c576003 100644
--- a/src/lib/cinema_sound_processor.h
+++ b/src/lib/cinema_sound_processor.h
@@ -38,10 +38,10 @@
class CinemaSoundProcessor : public boost::noncopyable
{
public:
- CinemaSoundProcessor (std::string i, std::string n);
+ CinemaSoundProcessor (std::string i, std::string n, float knee, float below, float above);
virtual ~CinemaSoundProcessor () {}
- virtual float db_for_fader_change (float from, float to) const = 0;
+ float db_for_fader_change (float from, float to) const;
/** @return id for our use */
std::string id () const {
@@ -64,6 +64,9 @@ private:
std::string _id;
/** user-visible name for this sound processor */
std::string _name;
+ float _knee;
+ float _below;
+ float _above;
/** sll available cinema sound processors */
static std::vector<CinemaSoundProcessor const *> _cinema_sound_processors;
diff --git a/src/lib/config.cc b/src/lib/config.cc
index fdd051662..a7a457081 100644
--- a/src/lib/config.cc
+++ b/src/lib/config.cc
@@ -24,7 +24,6 @@
#include "types.h"
#include "log.h"
#include "dcp_content_type.h"
-#include "cinema_sound_processor.h"
#include "colour_conversion.h"
#include "cinema.h"
#include "util.h"
@@ -93,7 +92,6 @@ Config::set_defaults ()
_tms_path = ".";
_tms_user = "";
_tms_password = "";
- _cinema_sound_processor = CinemaSoundProcessor::from_id (N_("dolby_cp750"));
_allow_any_dcp_frame_rate = false;
_allow_any_container = false;
_language = optional<string> ();
@@ -293,19 +291,9 @@ try
_tms_user = f.string_child ("TMSUser");
_tms_password = f.string_child ("TMSPassword");
- optional<string> c;
- c = f.optional_string_child ("SoundProcessor");
- if (c) {
- _cinema_sound_processor = CinemaSoundProcessor::from_id (c.get ());
- }
- c = f.optional_string_child ("CinemaSoundProcessor");
- if (c) {
- _cinema_sound_processor = CinemaSoundProcessor::from_id (c.get ());
- }
-
_language = f.optional_string_child ("Language");
- c = f.optional_string_child ("DefaultContainer");
+ optional<string> c = f.optional_string_child ("DefaultContainer");
if (c) {
_default_container = Ratio::from_id (c.get ());
}
@@ -698,12 +686,6 @@ Config::write_config () const
root->add_child("TMSUser")->add_child_text (_tms_user);
/* [XML] TMSPassword Password to log into the TMS with. */
root->add_child("TMSPassword")->add_child_text (_tms_password);
- if (_cinema_sound_processor) {
- /* [XML:opt] CinemaSoundProcessor Identifier of the type of cinema sound processor to use when calculating
- gain changes from fader positions. Currently can only be <code>dolby_cp750</code>.
- */
- root->add_child("CinemaSoundProcessor")->add_child_text (_cinema_sound_processor->id ());
- }
if (_language) {
/* [XML:opt] Language Language to use in the GUI e.g. <code>fr_FR</code>. */
root->add_child("Language")->add_child_text (_language.get());
diff --git a/src/lib/config.h b/src/lib/config.h
index 29511b1fe..9a57b1b48 100644
--- a/src/lib/config.h
+++ b/src/lib/config.h
@@ -141,11 +141,6 @@ public:
return _tms_password;
}
- /** @return The cinema sound processor that we are using */
- CinemaSoundProcessor const * cinema_sound_processor () const {
- return _cinema_sound_processor;
- }
-
std::list<boost::shared_ptr<Cinema> > cinemas () const {
return _cinemas;
}
@@ -1173,8 +1168,6 @@ private:
std::string _tms_user;
/** Password to log into the TMS with */
std::string _tms_password;
- /** Our cinema sound processor */
- CinemaSoundProcessor const * _cinema_sound_processor;
/** The list of possible DCP frame rates that DCP-o-matic will use */
std::list<int> _allowed_dcp_frame_rates;
/** Allow any video frame rate for the DCP; if true, overrides _allowed_dcp_frame_rates */
diff --git a/src/lib/datasat_ap2x.cc b/src/lib/datasat_ap2x.cc
new file mode 100644
index 000000000..ade750ce1
--- /dev/null
+++ b/src/lib/datasat_ap2x.cc
@@ -0,0 +1,29 @@
+/*
+ Copyright (C) 2019 Carl Hetherington <cth@carlh.net>
+
+ This file is part of DCP-o-matic.
+
+ DCP-o-matic 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 2 of the License, or
+ (at your option) any later version.
+
+ DCP-o-matic 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 DCP-o-matic. If not, see <http://www.gnu.org/licenses/>.
+
+*/
+
+#include "datasat_ap2x.h"
+
+#include "i18n.h"
+
+DatasatAP2x::DatasatAP2x ()
+ : CinemaSoundProcessor ("dataset_ap2x", _("Datasat AP20 or AP25"), 3.2f, 20, 5)
+{
+
+}
diff --git a/src/lib/datasat_ap2x.h b/src/lib/datasat_ap2x.h
new file mode 100644
index 000000000..4bbe39521
--- /dev/null
+++ b/src/lib/datasat_ap2x.h
@@ -0,0 +1,31 @@
+/*
+ Copyright (C) 2019 Carl Hetherington <cth@carlh.net>
+
+ This file is part of DCP-o-matic.
+
+ DCP-o-matic 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 2 of the License, or
+ (at your option) any later version.
+
+ DCP-o-matic 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 DCP-o-matic. If not, see <http://www.gnu.org/licenses/>.
+
+*/
+
+/** @file src/lib/datasat_ap2x.h
+ * @brief DatasatAP2x class.
+ */
+
+#include "cinema_sound_processor.h"
+
+class DatasatAP2x : public CinemaSoundProcessor
+{
+public:
+ DatasatAP2x ();
+};
diff --git a/src/lib/dolby_cp750.cc b/src/lib/dolby_cp750.cc
index 3e2bb4346..380ab0564 100644
--- a/src/lib/dolby_cp750.cc
+++ b/src/lib/dolby_cp750.cc
@@ -25,37 +25,7 @@
using namespace std;
DolbyCP750::DolbyCP750 ()
- : CinemaSoundProcessor ("dolby_cp750", _("Dolby CP650 and CP750"))
+ : CinemaSoundProcessor ("dolby_cp750", _("Dolby CP650 or CP750"), 4.0f, 20, 3.33333333333333333)
{
}
-
-float
-DolbyCP750::db_for_fader_change (float from, float to) const
-{
- float db = 0;
-
- if (from < to) {
- if (from <= 4) {
- float const t = min (to, 4.0f);
- db += (t - from) * 20;
- }
-
- if (to > 4) {
- float const t = max (from, 4.0f);
- db += (to - t) * 3.33333333333333333;
- }
- } else {
- if (from >= 4) {
- float const t = max (to, 4.0f);
- db -= (from - t) * 3.33333333333333333;
- }
-
- if (to < 4) {
- float const t = min (from, 4.0f);
- db -= (t - to) * 20;
- }
- }
-
- return db;
-}
diff --git a/src/lib/dolby_cp750.h b/src/lib/dolby_cp750.h
index 3a8fcf6c7..3162a962d 100644
--- a/src/lib/dolby_cp750.h
+++ b/src/lib/dolby_cp750.h
@@ -28,6 +28,4 @@ class DolbyCP750 : public CinemaSoundProcessor
{
public:
DolbyCP750 ();
-
- float db_for_fader_change (float from, float to) const;
};
diff --git a/src/lib/usl.cc b/src/lib/usl.cc
new file mode 100644
index 000000000..b8a9a71f0
--- /dev/null
+++ b/src/lib/usl.cc
@@ -0,0 +1,29 @@
+/*
+ Copyright (C) 2019 Carl Hetherington <cth@carlh.net>
+
+ This file is part of DCP-o-matic.
+
+ DCP-o-matic 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 2 of the License, or
+ (at your option) any later version.
+
+ DCP-o-matic 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 DCP-o-matic. If not, see <http://www.gnu.org/licenses/>.
+
+*/
+
+#include "usl.h"
+
+#include "i18n.h"
+
+USL::USL ()
+ : CinemaSoundProcessor ("usl", _("USL"), 5.5f, 10, 3.33333333333333333)
+{
+
+}
diff --git a/src/lib/usl.h b/src/lib/usl.h
new file mode 100644
index 000000000..260eb3c80
--- /dev/null
+++ b/src/lib/usl.h
@@ -0,0 +1,31 @@
+/*
+ Copyright (C) 2019 Carl Hetherington <cth@carlh.net>
+
+ This file is part of DCP-o-matic.
+
+ DCP-o-matic 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 2 of the License, or
+ (at your option) any later version.
+
+ DCP-o-matic 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 DCP-o-matic. If not, see <http://www.gnu.org/licenses/>.
+
+*/
+
+/** @file src/lib/usl.h
+ * @brief USL class.
+ */
+
+#include "cinema_sound_processor.h"
+
+class USL : public CinemaSoundProcessor
+{
+public:
+ USL ();
+};
diff --git a/src/lib/wscript b/src/lib/wscript
index c5a270f65..177a58b64 100644
--- a/src/lib/wscript
+++ b/src/lib/wscript
@@ -56,6 +56,7 @@ sources = """
cross.cc
crypto.cc
curl_uploader.cc
+ datasat_ap2x.cc
dcp.cc
dcp_content.cc
dcp_content_type.cc
@@ -164,6 +165,7 @@ sources = """
uploader.cc
upmixer_a.cc
upmixer_b.cc
+ usl.cc
util.cc
verify_dcp_job.cc
video_content.cc