X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fcinema_sound_processor.cc;h=434fdd1cf6628ae92d79c95cb663c63c5a5390a0;hb=182b9d2e2feb6545592868606aaf0f0146095481;hp=1eaf8e1fcd1904e456995190ee690e45daa22241;hpb=b539d468acc3ca73cc58a4434002e511a4995f7d;p=dcpomatic.git diff --git a/src/lib/cinema_sound_processor.cc b/src/lib/cinema_sound_processor.cc index 1eaf8e1fc..434fdd1cf 100644 --- a/src/lib/cinema_sound_processor.cc +++ b/src/lib/cinema_sound_processor.cc @@ -36,7 +36,7 @@ using namespace std; -vector CinemaSoundProcessor::_cinema_sound_processors; +vector> CinemaSoundProcessor::_cinema_sound_processors; /** @param i Our id. @@ -57,7 +57,11 @@ CinemaSoundProcessor::CinemaSoundProcessor (string i, string n, float knee, floa vector CinemaSoundProcessor::all () { - return _cinema_sound_processors; + vector raw; + for (auto& processor: _cinema_sound_processors) { + raw.push_back (processor.get()); + } + return raw; } @@ -67,9 +71,9 @@ CinemaSoundProcessor::all () 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); + _cinema_sound_processors.push_back (unique_ptr(new DolbyCP750)); + _cinema_sound_processors.push_back (unique_ptr(new USL)); + _cinema_sound_processors.push_back (unique_ptr(new DatasatAP2x)); } @@ -88,26 +92,7 @@ CinemaSoundProcessor::from_id (string id) return nullptr; } - return *i; -} - - -/** @param s A sound processor from our static list. - * @return Index of the sound processor with the list, or -1. - */ -int -CinemaSoundProcessor::as_index (CinemaSoundProcessor const * s) -{ - vector::size_type i = 0; - while (i < _cinema_sound_processors.size() && _cinema_sound_processors[i] != s) { - ++i; - } - - if (i == _cinema_sound_processors.size ()) { - return -1; - } - - return i; + return i->get(); } @@ -118,7 +103,7 @@ CinemaSoundProcessor const * CinemaSoundProcessor::from_index (int i) { DCPOMATIC_ASSERT (i >= 0 && i < int(_cinema_sound_processors.size())); - return _cinema_sound_processors[i]; + return _cinema_sound_processors[i].get(); }