GUI options to select FLAC as media format
authorRobin Gareus <robin@gareus.org>
Wed, 7 Nov 2018 18:53:23 +0000 (19:53 +0100)
committerRobin Gareus <robin@gareus.org>
Wed, 7 Nov 2018 18:59:51 +0000 (19:59 +0100)
gtk2_ardour/ardour_ui.cc
gtk2_ardour/session_option_editor.cc
gtk2_ardour/session_option_editor.h

index 32e4e4f473686e59ca327c131a74bbfcd27ae260..049d26b0699ada27b6c5c0bfe1aae4aa4d612534 100644 (file)
@@ -1661,6 +1661,9 @@ ARDOUR_UI::update_format ()
        case MBWF:
                s << _("MBWF");
                break;
+       case FLAC:
+               s << _("FLAC");
+               break;
        }
 
        s << " ";
index e2775e641dc474ecd5eb61a0bd06607268284ac2..0ffb4c14d7aeb906ff9251a8a74895d601eec10c 100644 (file)
@@ -179,18 +179,15 @@ SessionOptionEditor::SessionOptionEditor (Session* s)
 
        add_option (_("Media"), new OptionEditorHeading (_("Audio File Format")));
 
-       ComboOption<SampleFormat>* sf = new ComboOption<SampleFormat> (
+       _sf = new ComboOption<SampleFormat> (
                "native-file-data-format",
                _("Sample format"),
                sigc::mem_fun (*_session_config, &SessionConfiguration::get_native_file_data_format),
                sigc::mem_fun (*_session_config, &SessionConfiguration::set_native_file_data_format)
                );
-
-       sf->add (FormatFloat, _("32-bit floating point"));
-       sf->add (FormatInt24, _("24-bit integer"));
-       sf->add (FormatInt16, _("16-bit integer"));
-
-       add_option (_("Media"), sf);
+       add_option (_("Media"), _sf);
+       /* refill available sample-formats, depening on file-format */
+       parameter_changed ("native-file-header-format");
 
        ComboOption<HeaderFormat>* hf = new ComboOption<HeaderFormat> (
                "native-file-header-format",
@@ -210,6 +207,7 @@ SessionOptionEditor::SessionOptionEditor (Session* s)
 #ifdef HAVE_RF64_RIFF
        hf->add (RF64_WAV, _("RF64 (WAV compatible)"));
 #endif
+       hf->add (FLAC, _("FLAC"));
 
        add_option (_("Media"), hf);
 
@@ -410,6 +408,13 @@ SessionOptionEditor::SessionOptionEditor (Session* s)
        set_current_page (_("Timecode"));
 }
 
+SessionOptionEditor::~SessionOptionEditor ()
+{
+       delete _vpu;
+       delete _sf;
+       delete _take_name;
+}
+
 void
 SessionOptionEditor::parameter_changed (std::string const & p)
 {
@@ -429,6 +434,25 @@ SessionOptionEditor::parameter_changed (std::string const & p)
        else if (p == "track-name-take") {
                _take_name->set_sensitive(_session_config->get_track_name_take());
        }
+       else if (p == "native-file-header-format") {
+               bool need_refill = true;
+               _sf->clear ();
+               if (_session_config->get_native_file_header_format() == FLAC) {
+                       _sf->add (FormatInt24, _("24-bit integer"));
+                       _sf->add (FormatInt16, _("16-bit integer"));
+                       if (_session_config->get_native_file_data_format() == FormatFloat) {
+                               _session_config->set_native_file_data_format (FormatInt24);
+                               need_refill = false;
+                       }
+               } else {
+                       _sf->add (FormatFloat, _("32-bit floating point"));
+                       _sf->add (FormatInt24, _("24-bit integer"));
+                       _sf->add (FormatInt16, _("16-bit integer"));
+               }
+               if (need_refill) {
+                       parameter_changed ("native-file-data-format");
+               }
+       }
 }
 
 /* the presence of absence of a monitor section is not really a regular session
index 759f28ff18e63f87dd7a8b8a326fd651ca7ae79d..bf373c8f339d4a81c661bcd84ea38bd194f64493 100644 (file)
@@ -31,6 +31,7 @@ class SessionOptionEditor : public OptionEditorWindow
 {
 public:
        SessionOptionEditor (ARDOUR::Session* s);
+       ~SessionOptionEditor ();
 
 private:
        void parameter_changed (std::string const &);
@@ -41,6 +42,7 @@ private:
        bool get_use_monitor_section ();
 
        ComboOption<float>* _vpu;
+       ComboOption<ARDOUR::SampleFormat>* _sf;
        EntryOption* _take_name;
 
        void save_defaults ();