X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fardour%2Fexport_formats.cc;h=32b71f6b045b347a163e12916c5df0256626f68a;hb=1db2be2fef7a70f5200bcd96a701f612bbd7ec52;hp=9e77bb2f1d0f3546d4e73cc37f178f57588eec4e;hpb=474f8bc37623f48f7e69dff57aee233c99f6d07c;p=ardour.git diff --git a/libs/ardour/export_formats.cc b/libs/ardour/export_formats.cc index 9e77bb2f1d..32b71f6b04 100644 --- a/libs/ardour/export_formats.cc +++ b/libs/ardour/export_formats.cc @@ -18,10 +18,12 @@ */ -#include +#include "ardour/export_formats.h" #include "i18n.h" +using namespace std; + namespace ARDOUR { @@ -43,7 +45,7 @@ HasSampleFormat::HasSampleFormat (ExportFormatBase::SampleFormatSet & sample_for _sample_formats (sample_formats) { /* Dither Types */ - + add_dither_type (ExportFormatBase::D_Shaped, _("Shaped Noise")); add_dither_type (ExportFormatBase::D_Tri, _("Triangular")); add_dither_type (ExportFormatBase::D_Rect, _("Rectangular")); @@ -54,22 +56,28 @@ void HasSampleFormat::add_sample_format (ExportFormatBase::SampleFormat format) { _sample_formats.insert (format); - + SampleFormatPtr ptr (new SampleFormatState (format, get_sample_format_name (format))); sample_format_states.push_back (ptr); - ptr->SelectChanged.connect (sigc::bind (SampleFormatSelectChanged.make_slot(), WeakSampleFormatPtr (ptr))); - ptr->SelectChanged.connect (sigc::mem_fun (*this, &HasSampleFormat::update_sample_format_selection)); - ptr->CompatibleChanged.connect (sigc::bind (SampleFormatCompatibleChanged.make_slot(), WeakSampleFormatPtr (ptr))); + ptr->SelectChanged.connect_same_thread (*this, boost::bind (&HasSampleFormat::update_sample_format_selection, this, _1)); + // BOOST SIGNALS Could this be made any uglier? + ptr->SelectChanged.connect_same_thread (*this, + boost::bind (boost::type (), boost::ref (SampleFormatSelectChanged), _1, WeakSampleFormatPtr (ptr))); + ptr->CompatibleChanged.connect_same_thread (*this, + boost::bind (boost::type (), boost::ref (SampleFormatCompatibleChanged), _1, WeakSampleFormatPtr (ptr))); } void -HasSampleFormat::add_dither_type (ExportFormatBase::DitherType type, Glib::ustring name) +HasSampleFormat::add_dither_type (ExportFormatBase::DitherType type, string name) { DitherTypePtr ptr (new DitherTypeState (type, name)); dither_type_states.push_back (ptr); - ptr->SelectChanged.connect (sigc::bind (DitherTypeSelectChanged.make_slot(), WeakDitherTypePtr (ptr))); - ptr->SelectChanged.connect (sigc::mem_fun (*this, &HasSampleFormat::update_dither_type_selection)); - ptr->CompatibleChanged.connect (sigc::bind (DitherTypeCompatibleChanged.make_slot(), WeakDitherTypePtr (ptr))); + ptr->SelectChanged.connect_same_thread (*this, boost::bind (&HasSampleFormat::update_dither_type_selection, this, _1)); + // BOOST SIGNALS Could this be made any uglier? + ptr->SelectChanged.connect_same_thread (*this, + boost::bind (boost::type (), boost::ref (DitherTypeSelectChanged), _1, WeakDitherTypePtr (ptr))); + ptr->CompatibleChanged.connect_same_thread (*this, + boost::bind (boost::type (),boost::ref ( DitherTypeCompatibleChanged), _1, WeakDitherTypePtr (ptr))); } HasSampleFormat::SampleFormatPtr @@ -80,7 +88,7 @@ HasSampleFormat::get_selected_sample_format () return *it; } } - + return SampleFormatPtr(); } @@ -92,7 +100,7 @@ HasSampleFormat::get_selected_dither_type () return *it; } } - + return DitherTypePtr(); } @@ -103,7 +111,7 @@ HasSampleFormat::update_sample_format_selection (bool) if (!format) { return; } - + if (format->format == ExportFormatBase::SF_24 || format->format == ExportFormatBase::SF_32 || format->format == ExportFormatBase::SF_Float || @@ -130,13 +138,13 @@ HasSampleFormat::update_dither_type_selection (bool) if (!type) { return; } - + if (!type->compatible()) { SampleFormatPtr format = get_selected_sample_format(); if (format) { format->set_selected (false); } - + for (DitherTypeList::iterator it = dither_type_states.begin(); it != dither_type_states.end(); ++it) { (*it)->set_compatible (true); } @@ -171,22 +179,23 @@ HasSampleFormat::get_sample_format_name (ExportFormatBase::SampleFormat format) /*** Linear ***/ -ExportFormatLinear::ExportFormatLinear (Glib::ustring name, FormatId format_id) : +ExportFormatLinear::ExportFormatLinear (string name, FormatId format_id) : HasSampleFormat (sample_formats), _default_sample_format (SF_None) { set_name (name); set_format_id (format_id); - + add_sample_rate (SR_22_05); add_sample_rate (SR_44_1); add_sample_rate (SR_48); add_sample_rate (SR_88_2); add_sample_rate (SR_96); add_sample_rate (SR_192); - + add_sample_rate (SR_Session); + add_endianness (E_FileDefault); - + set_quality (Q_LosslessLinear); } @@ -200,29 +209,29 @@ ExportFormatLinear::set_compatibility_state (ExportFormatCompatibility const & c if (!compatibility.has_quality (Q_LosslessLinear)) { compatible = false; } - + if (!compatibility.has_format (get_format_id())) { compatible = false; } boost::shared_ptr intersection = get_intersection (compatibility); - + if (intersection->endiannesses_empty()) { compatible = false; } - + if (intersection->sample_rates_empty()) { compatible = false; } - + if (intersection->sample_formats_empty()) { compatible = false; } - + set_compatible (compatible); /* Sample Formats */ - + for (SampleFormatList::iterator it = sample_format_states.begin(); it != sample_format_states.end(); ++it) { (*it)->set_compatible (compatibility.has_sample_format ((*it)->format)); } @@ -235,7 +244,7 @@ ExportFormatLinear::set_compatibility_state (ExportFormatCompatibility const & c ExportFormatOggVorbis::ExportFormatOggVorbis () { /* Check system compatibility */ - + SF_INFO sf_info; sf_info.channels = 2; sf_info.samplerate = SR_44_1; @@ -243,20 +252,21 @@ ExportFormatOggVorbis::ExportFormatOggVorbis () if (sf_format_check (&sf_info) != SF_TRUE) { throw ExportFormatIncompatible(); } - + set_name ("Ogg Vorbis"); set_format_id (F_Ogg); sample_formats.insert (SF_Vorbis); - + add_sample_rate (SR_22_05); add_sample_rate (SR_44_1); add_sample_rate (SR_48); add_sample_rate (SR_88_2); add_sample_rate (SR_96); add_sample_rate (SR_192); - + add_sample_rate (SR_Session); + add_endianness (E_FileDefault); - + set_extension ("ogg"); set_quality (Q_LossyCompression); } @@ -275,7 +285,7 @@ ExportFormatFLAC::ExportFormatFLAC () : HasSampleFormat (sample_formats) { /* Check system compatibility */ - + SF_INFO sf_info; sf_info.channels = 2; sf_info.samplerate = SR_44_1; @@ -283,23 +293,24 @@ ExportFormatFLAC::ExportFormatFLAC () : if (sf_format_check (&sf_info) != SF_TRUE) { throw ExportFormatIncompatible(); } - + set_name ("FLAC"); set_format_id (F_FLAC); - + add_sample_rate (SR_22_05); add_sample_rate (SR_44_1); add_sample_rate (SR_48); add_sample_rate (SR_88_2); add_sample_rate (SR_96); add_sample_rate (SR_192); - + add_sample_rate (SR_Session); + add_sample_format (SF_8); add_sample_format (SF_16); add_sample_format (SF_24); - + add_endianness (E_FileDefault); - + set_extension ("flac"); set_quality (Q_LosslessCompression); } @@ -319,13 +330,14 @@ ExportFormatBWF::ExportFormatBWF () : { set_name ("BWF"); set_format_id (F_WAV); - + add_sample_rate (SR_22_05); add_sample_rate (SR_44_1); add_sample_rate (SR_48); add_sample_rate (SR_88_2); add_sample_rate (SR_96); add_sample_rate (SR_192); + add_sample_rate (SR_Session); add_sample_format (SF_U8); add_sample_format (SF_16); @@ -333,9 +345,9 @@ ExportFormatBWF::ExportFormatBWF () : add_sample_format (SF_32); add_sample_format (SF_Float); add_sample_format (SF_Double); - + add_endianness (E_FileDefault); - + set_extension ("wav"); set_quality (Q_LosslessLinear); }