diff options
| author | Carl Hetherington <cth@carlh.net> | 2019-07-02 01:32:54 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2019-07-02 01:32:54 +0100 |
| commit | e6c828cbd577239e7c8e4c532161084a33843a0f (patch) | |
| tree | 2290dcdc341e47bcec5ed9f364be9f457b7bf3c0 /src/lib/cinema_sound_processor.cc | |
| parent | 8c0414a0dec9f444a80fc30c7be3bc82188446d4 (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/cinema_sound_processor.cc')
| -rw-r--r-- | src/lib/cinema_sound_processor.cc | 39 |
1 files changed, 38 insertions, 1 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; +} |
