From: Carl Hetherington Date: Sun, 13 Jul 2014 20:56:17 +0000 (+0100) Subject: Rename SoundProcessor -> CinemaSoundProcessor. X-Git-Tag: v2.0.48~727 X-Git-Url: https://git.carlh.net/gitweb/?a=commitdiff_plain;h=dbd26fada835a44d7547007fc44273b2119f3e35;p=dcpomatic.git Rename SoundProcessor -> CinemaSoundProcessor. --- diff --git a/src/lib/cinema_sound_processor.cc b/src/lib/cinema_sound_processor.cc new file mode 100644 index 000000000..6a7905114 --- /dev/null +++ b/src/lib/cinema_sound_processor.cc @@ -0,0 +1,103 @@ +/* + Copyright (C) 2012-2014 Carl Hetherington + + 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 2 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, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +*/ + +/** @file src/sound_processor.cc + * @brief CinemaSoundProcessor class. + */ + +#include +#include +#include "cinema_sound_processor.h" +#include "dolby_cp750.h" + +using namespace std; + +vector CinemaSoundProcessor::_cinema_sound_processors; + +/** @param i Our id. + * @param n User-visible name. + */ +CinemaSoundProcessor::CinemaSoundProcessor (string i, string n) + : _id (i) + , _name (n) +{ + +} + +/** @return All available sound processors */ +vector +CinemaSoundProcessor::all () +{ + return _cinema_sound_processors; +} + +/** Set up the static _sound_processors vector; must be called before from_* + * methods are used. + */ +void +CinemaSoundProcessor::setup_cinema_sound_processors () +{ + _cinema_sound_processors.push_back (new DolbyCP750); +} + +/** @param id One of our ids. + * @return Corresponding sound processor, or 0. + */ +CinemaSoundProcessor const * +CinemaSoundProcessor::from_id (string id) +{ + vector::iterator i = _cinema_sound_processors.begin (); + while (i != _cinema_sound_processors.end() && (*i)->id() != id) { + ++i; + } + + if (i == _cinema_sound_processors.end ()) { + return 0; + } + + 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; +} + +/** @param i An index returned from as_index(). + * @return Corresponding sound processor. + */ +CinemaSoundProcessor const * +CinemaSoundProcessor::from_index (int i) +{ + assert (i <= int(_cinema_sound_processors.size ())); + return _cinema_sound_processors[i]; +} diff --git a/src/lib/cinema_sound_processor.h b/src/lib/cinema_sound_processor.h new file mode 100644 index 000000000..f735b1227 --- /dev/null +++ b/src/lib/cinema_sound_processor.h @@ -0,0 +1,70 @@ +/* + Copyright (C) 2012-2014 Carl Hetherington + + 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 2 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, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +*/ + +/** @file src/cinema_sound_processor.h + * @brief CinemaSoundProcessor class + */ + +#ifndef DCPOMATIC_CINEMA_SOUND_PROCESSOR_H +#define DCPOMATIC_CINEMA_SOUND_PROCESSOR_H + +#include +#include +#include + +/** @class CinemaSoundProcessor + * @brief Class to describe a cimema's sound processor. + * + * In other words, the box in the rack that handles sound decoding and processing + * in a cinema. + */ +class CinemaSoundProcessor : public boost::noncopyable +{ +public: + CinemaSoundProcessor (std::string i, std::string n); + + virtual float db_for_fader_change (float from, float to) const = 0; + + /** @return id for our use */ + std::string id () const { + return _id; + } + + /** @return user-visible name for this sound processor */ + std::string name () const { + return _name; + } + + static std::vector all (); + static void setup_cinema_sound_processors (); + static CinemaSoundProcessor const * from_id (std::string id); + static CinemaSoundProcessor const * from_index (int); + static int as_index (CinemaSoundProcessor const *); + +private: + /** id for our use */ + std::string _id; + /** user-visible name for this sound processor */ + std::string _name; + + /** sll available cinema sound processors */ + static std::vector _cinema_sound_processors; +}; + +#endif diff --git a/src/lib/config.cc b/src/lib/config.cc index bb1fcd211..209b924fa 100644 --- a/src/lib/config.cc +++ b/src/lib/config.cc @@ -32,7 +32,7 @@ #include "filter.h" #include "ratio.h" #include "dcp_content_type.h" -#include "sound_processor.h" +#include "cinema_sound_processor.h" #include "colour_conversion.h" #include "cinema.h" #include "util.h" @@ -60,7 +60,7 @@ Config::Config () , _server_port_base (6192) , _use_any_servers (true) , _tms_path (".") - , _sound_processor (SoundProcessor::from_id (N_("dolby_cp750"))) + , _cinema_sound_processor (CinemaSoundProcessor::from_id (N_("dolby_cp750"))) , _allow_any_dcp_frame_rate (false) , _default_still_length (10) , _default_container (Ratio::from_id ("185")) @@ -128,7 +128,11 @@ Config::read () c = f.optional_string_child ("SoundProcessor"); if (c) { - _sound_processor = SoundProcessor::from_id (c.get ()); + _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"); @@ -244,7 +248,7 @@ Config::read_old_metadata () } else if (k == N_("tms_password")) { _tms_password = v; } else if (k == N_("sound_processor")) { - _sound_processor = SoundProcessor::from_id (v); + _cinema_sound_processor = CinemaSoundProcessor::from_id (v); } else if (k == "language") { _language = v; } else if (k == "default_container") { @@ -334,8 +338,8 @@ Config::write () const root->add_child("TMSPath")->add_child_text (_tms_path); root->add_child("TMSUser")->add_child_text (_tms_user); root->add_child("TMSPassword")->add_child_text (_tms_password); - if (_sound_processor) { - root->add_child("SoundProcessor")->add_child_text (_sound_processor->id ()); + if (_cinema_sound_processor) { + root->add_child("CinemaSoundProcessor")->add_child_text (_cinema_sound_processor->id ()); } if (_language) { root->add_child("Language")->add_child_text (_language.get()); diff --git a/src/lib/config.h b/src/lib/config.h index d9f104c7d..2bc07b683 100644 --- a/src/lib/config.h +++ b/src/lib/config.h @@ -35,7 +35,7 @@ class ServerDescription; class Scaler; class Filter; -class SoundProcessor; +class CinemaSoundProcessor; class DCPContentType; class Ratio; class Cinema; @@ -103,9 +103,9 @@ public: return _tms_password; } - /** @return The sound processor that we are using */ - SoundProcessor const * sound_processor () const { - return _sound_processor; + /** @return The cinema sound processor that we are using */ + CinemaSoundProcessor const * cinema_sound_processor () const { + return _cinema_sound_processor; } std::list > cinemas () const { @@ -394,8 +394,8 @@ private: std::string _tms_user; /** Password to log into the TMS with */ std::string _tms_password; - /** Our sound processor */ - SoundProcessor const * _sound_processor; + /** Our cinema sound processor */ + CinemaSoundProcessor const * _cinema_sound_processor; std::list _allowed_dcp_frame_rates; /** Allow any video frame rate for the DCP; if true, overrides _allowed_dcp_frame_rates */ bool _allow_any_dcp_frame_rate; diff --git a/src/lib/dolby_cp750.cc b/src/lib/dolby_cp750.cc index aeb469d29..317d129d9 100644 --- a/src/lib/dolby_cp750.cc +++ b/src/lib/dolby_cp750.cc @@ -24,7 +24,7 @@ using namespace std; DolbyCP750::DolbyCP750 () - : SoundProcessor ("dolby_cp750", _("Dolby CP650 and CP750")) + : CinemaSoundProcessor ("dolby_cp750", _("Dolby CP650 and CP750")) { } diff --git a/src/lib/dolby_cp750.h b/src/lib/dolby_cp750.h index b6c0e7df2..c545844fe 100644 --- a/src/lib/dolby_cp750.h +++ b/src/lib/dolby_cp750.h @@ -17,9 +17,9 @@ */ -#include "sound_processor.h" +#include "cinema_sound_processor.h" -class DolbyCP750 : public SoundProcessor +class DolbyCP750 : public CinemaSoundProcessor { public: DolbyCP750 (); diff --git a/src/lib/sound_processor.cc b/src/lib/sound_processor.cc deleted file mode 100644 index 9be6621cc..000000000 --- a/src/lib/sound_processor.cc +++ /dev/null @@ -1,103 +0,0 @@ -/* - Copyright (C) 2012 Carl Hetherington - - 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 2 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, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - -*/ - -/** @file src/sound_processor.cc - * @brief A class to describe a sound processor. - */ - -#include -#include -#include "sound_processor.h" -#include "dolby_cp750.h" - -using namespace std; - -vector SoundProcessor::_sound_processors; - -/** @param i Our id. - * @param n User-visible name. - */ -SoundProcessor::SoundProcessor (string i, string n) - : _id (i) - , _name (n) -{ - -} - -/** @return All available sound processors */ -vector -SoundProcessor::all () -{ - return _sound_processors; -} - -/** Set up the static _sound_processors vector; must be called before from_* - * methods are used. - */ -void -SoundProcessor::setup_sound_processors () -{ - _sound_processors.push_back (new DolbyCP750); -} - -/** @param id One of our ids. - * @return Corresponding sound processor, or 0. - */ -SoundProcessor const * -SoundProcessor::from_id (string id) -{ - vector::iterator i = _sound_processors.begin (); - while (i != _sound_processors.end() && (*i)->id() != id) { - ++i; - } - - if (i == _sound_processors.end ()) { - return 0; - } - - return *i; -} - -/** @param s A sound processor from our static list. - * @return Index of the sound processor with the list, or -1. - */ -int -SoundProcessor::as_index (SoundProcessor const * s) -{ - vector::size_type i = 0; - while (i < _sound_processors.size() && _sound_processors[i] != s) { - ++i; - } - - if (i == _sound_processors.size ()) { - return -1; - } - - return i; -} - -/** @param i An index returned from as_index(). - * @return Corresponding sound processor. - */ -SoundProcessor const * -SoundProcessor::from_index (int i) -{ - assert (i <= int(_sound_processors.size ())); - return _sound_processors[i]; -} diff --git a/src/lib/sound_processor.h b/src/lib/sound_processor.h deleted file mode 100644 index 8f2652243..000000000 --- a/src/lib/sound_processor.h +++ /dev/null @@ -1,67 +0,0 @@ -/* - Copyright (C) 2012 Carl Hetherington - - 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 2 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, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - -*/ - -/** @file src/sound_processor.h - * @brief A class to describe a sound processor. - */ - -#ifndef DCPOMATIC_SOUND_PROCESSOR_H -#define DCPOMATIC_SOUND_PROCESSOR_H - -#include -#include -#include - -/** @class SoundProcessor - * @brief Class to describe a sound processor. - */ -class SoundProcessor : public boost::noncopyable -{ -public: - SoundProcessor (std::string i, std::string n); - - virtual float db_for_fader_change (float from, float to) const = 0; - - /** @return id for our use */ - std::string id () const { - return _id; - } - - /** @return user-visible name for this sound processor */ - std::string name () const { - return _name; - } - - static std::vector all (); - static void setup_sound_processors (); - static SoundProcessor const * from_id (std::string id); - static SoundProcessor const * from_index (int); - static int as_index (SoundProcessor const *); - -private: - /** id for our use */ - std::string _id; - /** user-visible name for this sound processor */ - std::string _name; - - /** sll available sound processors */ - static std::vector _sound_processors; -}; - -#endif diff --git a/src/lib/util.cc b/src/lib/util.cc index dd39e286e..d04f195af 100644 --- a/src/lib/util.cc +++ b/src/lib/util.cc @@ -64,7 +64,7 @@ extern "C" { #include "scaler.h" #include "dcp_content_type.h" #include "filter.h" -#include "sound_processor.h" +#include "cinema_sound_processor.h" #include "config.h" #include "ratio.h" #include "job.h" @@ -336,7 +336,7 @@ dcpomatic_setup () DCPContentType::setup_dcp_content_types (); Scaler::setup_scalers (); Filter::setup_filters (); - SoundProcessor::setup_sound_processors (); + CinemaSoundProcessor::setup_cinema_sound_processors (); AudioProcessor::setup_audio_processors (); ui_thread = boost::this_thread::get_id (); diff --git a/src/lib/wscript b/src/lib/wscript index 60150f4da..9c929a671 100644 --- a/src/lib/wscript +++ b/src/lib/wscript @@ -10,6 +10,7 @@ sources = """ audio_mapping.cc audio_processor.cc cinema.cc + cinema_sound_processor.cc colour_conversion.cc config.cc content.cc @@ -72,7 +73,7 @@ sources = """ single_stream_audio_content.cc sndfile_content.cc sndfile_decoder.cc - sound_processor.cc + sox_audio_processor.cc subrip.cc subrip_content.cc subrip_decoder.cc diff --git a/src/wx/audio_panel.cc b/src/wx/audio_panel.cc index 651ea93e1..b19142ec5 100644 --- a/src/wx/audio_panel.cc +++ b/src/wx/audio_panel.cc @@ -20,10 +20,10 @@ #include #include #include "lib/config.h" -#include "lib/sound_processor.h" #include "lib/ffmpeg_content.h" #include "lib/ffmpeg_audio_stream.h" #include "lib/audio_processor.h" +#include "lib/cinema_sound_processor.h" #include "audio_dialog.h" #include "audio_panel.h" #include "audio_mapping_view.h" @@ -175,7 +175,7 @@ AudioPanel::gain_calculate_button_clicked () } _gain->wrapped()->SetValue ( - Config::instance()->sound_processor()->db_for_fader_change ( + Config::instance()->cinema_sound_processor()->db_for_fader_change ( d->wanted_fader (), d->actual_fader () ) diff --git a/src/wx/film_editor.cc b/src/wx/film_editor.cc index 151130f27..c80a2a16c 100644 --- a/src/wx/film_editor.cc +++ b/src/wx/film_editor.cc @@ -40,7 +40,6 @@ #include "lib/ffmpeg_content.h" #include "lib/sndfile_content.h" #include "lib/dcp_content_type.h" -#include "lib/sound_processor.h" #include "lib/scaler.h" #include "lib/playlist.h" #include "lib/content.h"