Collect plugin runtime profile statistics.
[ardour.git] / libs / ardour / export_format_manager.cc
index ff115d44470a6d6e8e34c8c8da1d3882858f2a98..2b5fc1868ba500ea10a5e7dc687517d8cb5b2cef 100644 (file)
@@ -23,7 +23,7 @@
 #include "ardour/export_format_specification.h"
 #include "ardour/export_format_compatibility.h"
 
-#include "i18n.h"
+#include "pbd/i18n.h"
 
 using std::string;
 
@@ -40,6 +40,8 @@ ExportFormatManager::ExportFormatManager (ExportFormatSpecPtr specification) :
        init_qualities ();
        init_formats ();
        init_sample_rates ();
+
+       prev_description = current_selection->description();
 }
 
 ExportFormatManager::~ExportFormatManager ()
@@ -176,6 +178,17 @@ ExportFormatManager::init_formats ()
        fl_ptr->set_extension ("w64");
        add_format (f_ptr);
 
+       f_ptr.reset (fl_ptr = new ExportFormatLinear ("CAF", ExportFormatBase::F_CAF));
+       fl_ptr->add_sample_format (ExportFormatBase::SF_U8);
+       fl_ptr->add_sample_format (ExportFormatBase::SF_16);
+       fl_ptr->add_sample_format (ExportFormatBase::SF_24);
+       fl_ptr->add_sample_format (ExportFormatBase::SF_32);
+       fl_ptr->add_sample_format (ExportFormatBase::SF_Float);
+       fl_ptr->add_sample_format (ExportFormatBase::SF_Double);
+       fl_ptr->set_default_sample_format (ExportFormatBase::SF_Float);
+       fl_ptr->set_extension ("caf");
+       add_format (f_ptr);
+
        f_ptr.reset (fl_ptr = new ExportFormatLinear ("RAW", ExportFormatBase::F_RAW));
        fl_ptr->add_sample_format (ExportFormatBase::SF_U8);
        fl_ptr->add_sample_format (ExportFormatBase::SF_8);
@@ -203,12 +216,14 @@ void
 ExportFormatManager::init_sample_rates ()
 {
        add_sample_rate (SampleRatePtr (new SampleRateState (ExportFormatBase::SR_Session, _("Session rate"))));
-       add_sample_rate (SampleRatePtr (new SampleRateState (ExportFormatBase::SR_22_05, "22,05 kHz")));
-       add_sample_rate (SampleRatePtr (new SampleRateState (ExportFormatBase::SR_44_1, "44,1 kHz")));
-       add_sample_rate (SampleRatePtr (new SampleRateState (ExportFormatBase::SR_48, "48 kHz")));
-       add_sample_rate (SampleRatePtr (new SampleRateState (ExportFormatBase::SR_88_2, "88,2 kHz")));
-       add_sample_rate (SampleRatePtr (new SampleRateState (ExportFormatBase::SR_96, "96 kHz")));
-       add_sample_rate (SampleRatePtr (new SampleRateState (ExportFormatBase::SR_192, "192 kHz")));
+       add_sample_rate (SampleRatePtr (new SampleRateState (ExportFormatBase::SR_8,     string_compose ("%1%2%3 kHz", std::fixed, std::setprecision(0), 8))));
+       add_sample_rate (SampleRatePtr (new SampleRateState (ExportFormatBase::SR_22_05, string_compose ("%1%2%3 kHz", std::fixed, std::setprecision(2), 22.05))));
+       add_sample_rate (SampleRatePtr (new SampleRateState (ExportFormatBase::SR_44_1,  string_compose ("%1%2%3 kHz", std::fixed, std::setprecision(1), 44.1))));
+       add_sample_rate (SampleRatePtr (new SampleRateState (ExportFormatBase::SR_48,    string_compose ("%1%2%3 kHz", std::fixed, std::setprecision(0), 48))));
+       add_sample_rate (SampleRatePtr (new SampleRateState (ExportFormatBase::SR_88_2,  string_compose ("%1%2%3 kHz", std::fixed, std::setprecision(1), 88.2))));
+       add_sample_rate (SampleRatePtr (new SampleRateState (ExportFormatBase::SR_96,    string_compose ("%1%2%3 kHz", std::fixed, std::setprecision(0), 96))));
+       add_sample_rate (SampleRatePtr (new SampleRateState (ExportFormatBase::SR_176_4, string_compose ("%1%2%3 kHz", std::fixed, std::setprecision(0), 176.4))));
+       add_sample_rate (SampleRatePtr (new SampleRateState (ExportFormatBase::SR_192,   string_compose ("%1%2%3 kHz", std::fixed, std::setprecision(0), 192))));
 }
 
 void
@@ -255,66 +270,112 @@ void
 ExportFormatManager::set_name (string name)
 {
        current_selection->set_name (name);
+       check_for_description_change ();
 }
 
 void
 ExportFormatManager::select_src_quality (ExportFormatBase::SRCQuality value)
 {
        current_selection->set_src_quality (value);
+       check_for_description_change ();
 }
 
 void
 ExportFormatManager::select_with_cue (bool value)
 {
        current_selection->set_with_cue (value);
+       check_for_description_change ();
 }
 
 void
 ExportFormatManager::select_with_toc (bool value)
 {
        current_selection->set_with_toc (value);
+       check_for_description_change ();
+}
+
+void
+ExportFormatManager::select_with_mp4chaps (bool value)
+{
+       current_selection->set_with_mp4chaps (value);
+       check_for_description_change ();
+}
+
+void
+ExportFormatManager::set_command (std::string command)
+{
+       current_selection->set_command (command);
+       check_for_description_change ();
 }
 
 void
 ExportFormatManager::select_trim_beginning (bool value)
 {
        current_selection->set_trim_beginning (value);
+       check_for_description_change ();
 }
 
 void
 ExportFormatManager::select_silence_beginning (AnyTime const & time)
 {
        current_selection->set_silence_beginning (time);
+       check_for_description_change ();
 }
 
 void
 ExportFormatManager::select_trim_end (bool value)
 {
        current_selection->set_trim_end (value);
+       check_for_description_change ();
 }
 
 void
 ExportFormatManager::select_silence_end (AnyTime const & time)
 {
        current_selection->set_silence_end (time);
+       check_for_description_change ();
 }
 
 void
 ExportFormatManager::select_normalize (bool value)
 {
        current_selection->set_normalize (value);
+       check_for_description_change ();
 }
 
 void
-ExportFormatManager::select_normalize_target (float value)
+ExportFormatManager::select_normalize_loudness (bool value)
 {
-       current_selection->set_normalize_target (value);
+       current_selection->set_normalize_loudness (value);
+       check_for_description_change ();
+}
+
+void
+ExportFormatManager::select_normalize_dbfs (float value)
+{
+       current_selection->set_normalize_dbfs (value);
+       check_for_description_change ();
+}
+
+void
+ExportFormatManager::select_normalize_lufs (float value)
+{
+       current_selection->set_normalize_lufs (value);
+       check_for_description_change ();
+}
+
+void
+ExportFormatManager::select_normalize_dbtp (float value)
+{
+       current_selection->set_normalize_dbtp (value);
+       check_for_description_change ();
 }
 
 void
 ExportFormatManager::select_tagging (bool tag)
 {
        current_selection->set_tag (tag);
+       check_for_description_change ();
 }
 
 void
@@ -694,15 +755,26 @@ ExportFormatManager::selection_changed ()
 
        }
 
-       /* Signal completeness */
+       /* Signal completeness and possible description change */
 
        CompleteChanged (current_selection->is_complete());
+       check_for_description_change ();
 
        /* Reset pending state */
 
        pending_selection_change = false;
 }
 
+void
+ExportFormatManager::check_for_description_change ()
+{
+       std::string new_description = current_selection->description();
+       if (new_description == prev_description) { return; }
+
+       prev_description = new_description;
+       DescriptionChanged();
+}
+
 ExportFormatManager::QualityPtr
 ExportFormatManager::get_selected_quality ()
 {