]> granicus.if.org Git - handbrake/commitdiff
LinGui: add audio gain adjustment and create advanced audio dialog.
authorjstebbins <jstebbins.hb@gmail.com>
Tue, 5 Apr 2011 20:46:35 +0000 (20:46 +0000)
committerjstebbins <jstebbins.hb@gmail.com>
Tue, 5 Apr 2011 20:46:35 +0000 (20:46 +0000)
Gain, DRC, and Sample Rate are now in an advanced audio dialog.
This makes the audio tab less crowded and makes room for future
improvements.

git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3903 b64f7644-9d1e-0410-96f1-a4d463321fa5

gtk/src/audiohandler.c
gtk/src/callbacks.c
gtk/src/ghb.ui
gtk/src/hb-backend.c
gtk/src/internal_defaults.xml
gtk/src/main.c
gtk/src/makedeps.py
gtk/src/queuehandler.c

index d44960a041c2340e20deee7aeba1693a5d8ea9c0..b490c825aae52de1747949df0389196c94710187 100644 (file)
@@ -172,7 +172,7 @@ ghb_set_pref_audio(gint titleindex, signal_user_data_t *ud)
        gint mux;
 
        const GValue *pref_audio;
-       const GValue *audio, *drc;
+       const GValue *audio, *drc, *gain;
        gint acodec, bitrate, mix;
        gdouble rate;
        gint count, ii, list_count;
@@ -227,6 +227,7 @@ ghb_set_pref_audio(gint titleindex, signal_user_data_t *ud)
                rate = ghb_settings_combo_double(audio, "AudioSamplerate");
                mix = ghb_settings_combo_int(audio, "AudioMixdown");
                drc = ghb_settings_get_value(audio, "AudioTrackDRCSlider");
+               gain = ghb_settings_get_value(audio, "AudioTrackGain");
                // If there are multiple audios using the same codec, then
                // select sequential tracks for each.  The hash keeps track 
                // of the tracks used for each codec.
@@ -294,6 +295,7 @@ ghb_set_pref_audio(gint titleindex, signal_user_data_t *ud)
                        ghb_settings_set_string(settings, "AudioMixdown",
                                ghb_lookup_combo_string("AudioMixdown", ghb_int_value(mix)));
                        ghb_settings_set_value(settings, "AudioTrackDRCSlider", drc);
+                       ghb_settings_set_value(settings, "AudioTrackGain", gain);
                        ghb_add_audio(ud, settings);
                        ghb_adjust_audio_rate_combos(ud);
                }
@@ -354,9 +356,9 @@ ghb_audio_list_refresh_selected(signal_user_data_t *ud)
        if (gtk_tree_selection_get_selected(selection, &store, &iter))
        {
                const gchar *track, *codec, *br, *sr, *mix;
-               gchar *s_drc;
+               gchar *s_drc, *s_gain;
                gint itrack;
-               gdouble drc;
+               gdouble drc, gain;
                // Get the row number
                treepath = gtk_tree_model_get_path (store, &iter);
                indices = gtk_tree_path_get_indices (treepath);
@@ -375,6 +377,8 @@ ghb_audio_list_refresh_selected(signal_user_data_t *ud)
                br = ghb_settings_combo_option(asettings, "AudioBitrate");
                sr = ghb_settings_combo_option(asettings, "AudioSamplerate");
                mix = ghb_settings_combo_option(asettings, "AudioMixdown");
+               gain = ghb_settings_get_double(asettings, "AudioTrackGain");
+               s_gain = g_strdup_printf("%.fdB", gain);
 
                drc = ghb_settings_get_double(asettings, "AudioTrackDRCSlider");
                if (drc < 1.0)
@@ -389,9 +393,11 @@ ghb_audio_list_refresh_selected(signal_user_data_t *ud)
                        2, br,
                        3, sr,
                        4, mix,
-                       5, s_drc,
+                       5, s_gain,
+                       6, s_drc,
                        -1);
                g_free(s_drc);
+               g_free(s_gain);
        }
 }
 
@@ -535,23 +541,47 @@ audio_widget_changed_cb(GtkWidget *widget, signal_user_data_t *ud)
        ghb_live_reset(ud);
 }
 
+G_MODULE_EXPORT gchar*
+format_drc_cb(GtkScale *scale, gdouble val, signal_user_data_t *ud)
+{
+       if (val < 1.0)
+               return g_strdup_printf("%-7s", "Off");
+       else
+               return g_strdup_printf("%-7.1f", val);
+}
+
 G_MODULE_EXPORT void
 drc_widget_changed_cb(GtkWidget *widget, gdouble val, signal_user_data_t *ud)
 {
        GValue *asettings;
-       GtkLabel *label;
-       gchar *drc;
 
        g_debug("drc_widget_changed_cb ()");
+
        if (block_updates) return;
+       ghb_check_dependency(ud, widget, NULL);
+       asettings = get_selected_asettings(ud);
+       if (asettings != NULL)
+       {
+               ghb_widget_to_setting(asettings, widget);
+               ghb_audio_list_refresh_selected(ud);
+       }
+       ghb_live_reset(ud);
+}
 
-       label = GTK_LABEL(GHB_WIDGET(ud->builder, "drc_label"));
-       if (val < 1.0)
-               drc = g_strdup_printf("Off");
-       else
-               drc = g_strdup_printf("%.1f", val);
-       gtk_label_set_text(label, drc);
-       g_free(drc);
+G_MODULE_EXPORT gchar*
+format_gain_cb(GtkScale *scale, gdouble val, signal_user_data_t *ud)
+{
+       return g_strdup_printf("%ddB", (int)val);
+}
+
+G_MODULE_EXPORT void
+gain_widget_changed_cb(GtkWidget *widget, gdouble val, signal_user_data_t *ud)
+{
+       GValue *asettings;
+
+       g_debug("gain_widget_changed_cb ()");
+
+       if (block_updates) return;
        ghb_check_dependency(ud, widget, NULL);
        asettings = get_selected_asettings(ud);
        if (asettings != NULL)
@@ -591,9 +621,10 @@ add_to_audio_list(signal_user_data_t *ud, GValue *settings)
        GtkListStore *store;
        GtkTreeSelection *selection;
        const gchar *track, *codec, *br, *sr, *mix;
-       gchar *s_drc;
+       gchar *s_drc, *s_gain;
        gint itrack;
        gdouble drc;
+       gdouble gain;
        
        g_debug("add_to_audio_list ()");
        treeview = GTK_TREE_VIEW(GHB_WIDGET(ud->builder, "audio_list"));
@@ -606,6 +637,8 @@ add_to_audio_list(signal_user_data_t *ud, GValue *settings)
        br = ghb_settings_combo_option(settings, "AudioBitrate");
        sr = ghb_settings_combo_option(settings, "AudioSamplerate");
        mix = ghb_settings_combo_option(settings, "AudioMixdown");
+       gain = ghb_settings_get_double(settings, "AudioTrackGain");
+       s_gain = g_strdup_printf("%.fdB", gain);
 
        drc = ghb_settings_get_double(settings, "AudioTrackDRCSlider");
        if (drc < 1.0)
@@ -621,10 +654,12 @@ add_to_audio_list(signal_user_data_t *ud, GValue *settings)
                2, br,
                3, sr,
                4, mix,
-               5, s_drc,
+               5, s_gain,
+               6, s_drc,
                -1);
        gtk_tree_selection_select_iter(selection, &iter);
        g_free(s_drc);
+       g_free(s_gain);
 }
 
 G_MODULE_EXPORT void
@@ -667,6 +702,7 @@ audio_list_selection_changed_cb(GtkTreeSelection *selection, signal_user_data_t
                ghb_ui_update(ud, "AudioSamplerate", ghb_settings_get_value(asettings, "AudioSamplerate"));
                ghb_ui_update(ud, "AudioMixdown", ghb_settings_get_value(asettings, "AudioMixdown"));
                ghb_ui_update(ud, "AudioTrackDRCSlider", ghb_settings_get_value(asettings, "AudioTrackDRCSlider"));
+               ghb_ui_update(ud, "AudioTrackGain", ghb_settings_get_value(asettings, "AudioTrackGain"));
                block_updates = FALSE;
                widget = GHB_WIDGET (ud->builder, "audio_remove");
                gtk_widget_set_sensitive(widget, TRUE);
@@ -726,12 +762,37 @@ audio_add_clicked_cb(GtkWidget *xwidget, signal_user_data_t *ud)
        ghb_settings_take_value(asettings, "AudioSamplerate", ghb_widget_value(widget));
        widget = GHB_WIDGET(ud->builder, "AudioMixdown");
        ghb_settings_take_value(asettings, "AudioMixdown", ghb_widget_value(widget));
+       widget = GHB_WIDGET(ud->builder, "AudioTrackGain");
+       ghb_settings_take_value(asettings, "AudioTrackGain", ghb_widget_value(widget));
        widget = GHB_WIDGET(ud->builder, "AudioTrackDRCSlider");
        ghb_settings_take_value(asettings, "AudioTrackDRCSlider", ghb_widget_value(widget));
 
        ghb_add_audio(ud, asettings);
 }
 
+G_MODULE_EXPORT void
+audio_advanced_clicked_cb(GtkWidget *xwidget, signal_user_data_t *ud)
+{
+       GtkWidget *dialog;
+
+       g_debug("audio_advanced_clicked_cb ()");
+       dialog = GHB_WIDGET(ud->builder, "audio_dialog");
+       if (gtk_widget_get_visible(dialog))
+               gtk_widget_hide(dialog);
+       else
+               gtk_widget_show(dialog);
+}
+
+G_MODULE_EXPORT void
+audio_advanced_ok_cb(GtkWidget *xwidget, signal_user_data_t *ud)
+{
+       GtkWidget *dialog;
+
+       g_debug("audio_advanced_clicked_cb ()");
+       dialog = GHB_WIDGET(ud->builder, "audio_dialog");
+       gtk_widget_hide(dialog);
+}
+
 G_MODULE_EXPORT void
 audio_remove_clicked_cb(GtkWidget *widget, signal_user_data_t *ud)
 {
@@ -788,7 +849,7 @@ ghb_set_audio(signal_user_data_t *ud, GValue *settings)
        gint acodec_code;
 
        GValue *alist;
-       GValue *track, *audio, *acodec, *acodec_actual, *bitrate, *rate, *mix, *drc;
+       GValue *track, *audio, *acodec, *acodec_actual, *bitrate, *rate, *mix, *drc, *gain;
        gint count, ii;
        
        g_debug("set_audio");
@@ -806,6 +867,7 @@ ghb_set_audio(signal_user_data_t *ud, GValue *settings)
                bitrate = ghb_settings_get_value(audio, "AudioBitrate");
                rate = ghb_settings_get_value(audio, "AudioSamplerate");
                mix = ghb_settings_get_value(audio, "AudioMixdown");
+               gain = ghb_settings_get_value(audio, "AudioTrackGain");
                drc = ghb_settings_get_value(audio, "AudioTrackDRCSlider");
                acodec_code = ghb_lookup_combo_int("AudioEncoder", acodec);
 
@@ -820,6 +882,7 @@ ghb_set_audio(signal_user_data_t *ud, GValue *settings)
                        ghb_settings_set_value(settings, "AudioBitrate", bitrate);
                        ghb_settings_set_value(settings, "AudioSamplerate", rate);
                        ghb_settings_set_value(settings, "AudioMixdown", mix);
+                       ghb_settings_set_value(settings, "AudioTrackGain", gain);
                        ghb_settings_set_value(settings, "AudioTrackDRCSlider", drc);
                        ghb_add_audio(ud, settings);
                        ghb_adjust_audio_rate_combos(ud);
index 0d8699c0d69af701334b4b47e20e05fb6dca7b9f..f9b4afac60a7b5e78f0de41b83bf27abbac57d80 100644 (file)
@@ -4587,19 +4587,6 @@ format_deblock_cb(GtkScale *scale, gdouble val, signal_user_data_t *ud)
        }
 }
 
-G_MODULE_EXPORT gchar*
-format_drc_cb(GtkScale *scale, gdouble val, signal_user_data_t *ud)
-{
-       if (val <= 0.0)
-       {
-               return g_strdup_printf("Off");
-       }
-       else
-       {
-               return g_strdup_printf("%.1f", val);
-       }
-}
-
 G_MODULE_EXPORT gchar*
 format_vquality_cb(GtkScale *scale, gdouble val, signal_user_data_t *ud)
 {
index 9c3d1b44ab9a05e8cf50b5069c8deb98824d55e8..f5bb9430008c303185357de975c645b6a584d7d7 100644 (file)
     <property name="page_size">0</property>
     <property name="value">1</property>
   </object>
+  <object class="GtkAdjustment" id="adjustment35">
+    <property name="upper">20</property>
+    <property name="lower">-20</property>
+    <property name="page_increment">1</property>
+    <property name="step_increment">1</property>
+    <property name="page_size">0</property>
+    <property name="value">0.0</property>
+  </object>
   <object class="GtkAdjustment" id="preview_progress_adj">
     <property name="upper">100</property>
     <property name="lower">0</property>
@@ -2052,60 +2060,43 @@ FFMpeg's and Theora's scale is more linear.  These encoders do not have a lossle
                                     <property name="position">1</property>
                                   </packing>
                                 </child>
-                              </object>
-                              <packing>
-                                <property name="expand">False</property>
-                              </packing>
-                            </child>
-                            <child>
-                              <object class="GtkTable" id="table1">
-                                <property name="visible">True</property>
-                                <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
-                                <property name="n_rows">2</property>
-                                <property name="n_columns">7</property>
                                 <child>
-                                  <object class="GtkComboBox" id="AudioTrack">
-                                    <property name="width_request">180</property>
+                                  <object class="GtkLabel" id="labela3">
                                     <property name="visible">True</property>
                                     <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
-                                    <property name="tooltip-text" translatable="yes">List of audio tracks available from your source.</property>
-                                    <signal handler="audio_track_changed_cb" name="changed"/>
-                                  </object>
-                                  <packing>
-                                    <property name="top_attach">1</property>
-                                    <property name="bottom_attach">2</property>
-                                  </packing>
-                                </child>
-                                <child>
-                                  <object class="GtkComboBox" id="AudioEncoder">
-                                    <property name="visible">True</property>
-                                    <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
-                                    <property name="tooltip-text" translatable="yes">Set the audio codec to encode this track with.</property>
-                                    <signal handler="audio_codec_changed_cb" name="changed"/>
+                                    <property name="label" translatable="yes"></property>
                                   </object>
                                   <packing>
-                                    <property name="left_attach">1</property>
-                                    <property name="right_attach">2</property>
-                                    <property name="top_attach">1</property>
-                                    <property name="bottom_attach">2</property>
-                                    <property name="x_options">GTK_FILL</property>
+                                    <property name="expand">True</property>
+                                    <property name="position">2</property>
                                   </packing>
                                 </child>
                                 <child>
-                                  <object class="GtkComboBox" id="AudioSamplerate">
+                                  <object class="GtkButton" id="audio_advanced">
                                     <property name="visible">True</property>
+                                    <property name="can_focus">True</property>
+                                    <property name="receives_default">True</property>
                                     <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
-                                    <property name="tooltip-text" translatable="yes">Set the sample rate of the output audio track.</property>
-                                    <signal handler="audio_widget_changed_cb" name="changed"/>
+                                    <property name="tooltip-text" translatable="yes">Change advanced audio settings.</property>
+                                    <signal handler="audio_advanced_clicked_cb" name="clicked"/>
+                                    <property name="label">Advanced Audio</property>
                                   </object>
                                   <packing>
-                                    <property name="left_attach">3</property>
-                                    <property name="right_attach">4</property>
-                                    <property name="top_attach">1</property>
-                                    <property name="bottom_attach">2</property>
-                                    <property name="x_options">GTK_FILL</property>
+                                    <property name="expand">False</property>
+                                    <property name="position">3</property>
                                   </packing>
                                 </child>
+                              </object>
+                              <packing>
+                                <property name="expand">False</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkTable" id="table1">
+                                <property name="visible">True</property>
+                                <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                                <property name="n_rows">2</property>
+                                <property name="n_columns">4</property>
                                 <child>
                                   <object class="GtkLabel" id="label35">
                                     <property name="visible">True</property>
@@ -2113,6 +2104,10 @@ FFMpeg's and Theora's scale is more linear.  These encoders do not have a lossle
                                     <property name="label" translatable="yes">Track</property>
                                   </object>
                                   <packing>
+                                    <property name="top_attach">0</property>
+                                    <property name="bottom_attach">1</property>
+                                    <property name="left_attach">0</property>
+                                    <property name="right_attach">1</property>
                                     <property name="x_options">GTK_FILL</property>
                                   </packing>
                                 </child>
@@ -2123,6 +2118,8 @@ FFMpeg's and Theora's scale is more linear.  These encoders do not have a lossle
                                     <property name="label" translatable="yes">Codec</property>
                                   </object>
                                   <packing>
+                                    <property name="top_attach">0</property>
+                                    <property name="bottom_attach">1</property>
                                     <property name="left_attach">1</property>
                                     <property name="right_attach">2</property>
                                     <property name="x_options">GTK_FILL</property>
@@ -2137,25 +2134,14 @@ FFMpeg's and Theora's scale is more linear.  These encoders do not have a lossle
                                     <property name="justify">GTK_JUSTIFY_CENTER</property>
                                   </object>
                                   <packing>
+                                    <property name="top_attach">0</property>
+                                    <property name="bottom_attach">1</property>
                                     <property name="left_attach">2</property>
                                     <property name="right_attach">3</property>
                                     <property name="x_options">GTK_FILL</property>
                                     <property name="x_padding">10</property>
                                   </packing>
                                 </child>
-                                <child>
-                                  <object class="GtkLabel" id="label38">
-                                    <property name="visible">True</property>
-                                    <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
-                                    <property name="label" translatable="yes">Sample Rate</property>
-                                    <property name="justify">GTK_JUSTIFY_CENTER</property>
-                                  </object>
-                                  <packing>
-                                    <property name="left_attach">3</property>
-                                    <property name="right_attach">4</property>
-                                    <property name="x_options"/>
-                                  </packing>
-                                </child>
                                 <child>
                                   <object class="GtkLabel" id="label24">
                                     <property name="visible">True</property>
@@ -2163,88 +2149,70 @@ FFMpeg's and Theora's scale is more linear.  These encoders do not have a lossle
                                     <property name="label" translatable="yes">Mix</property>
                                   </object>
                                   <packing>
-                                    <property name="left_attach">4</property>
-                                    <property name="right_attach">5</property>
-                                    <property name="x_options">GTK_FILL</property>
-                                  </packing>
-                                </child>
-                                <child>
-                                  <object class="GtkLabel" id="label39">
-                                    <property name="visible">True</property>
-                                    <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
-                                    <property name="label" translatable="yes">DRC</property>
-                                  </object>
-                                  <packing>
-                                    <property name="left_attach">5</property>
-                                    <property name="right_attach">7</property>
+                                    <property name="top_attach">0</property>
+                                    <property name="bottom_attach">1</property>
+                                    <property name="left_attach">3</property>
+                                    <property name="right_attach">4</property>
                                     <property name="x_options">GTK_FILL</property>
                                   </packing>
                                 </child>
                                 <child>
-                                  <object class="GtkComboBox" id="AudioMixdown">
+                                  <object class="GtkComboBox" id="AudioTrack">
+                                    <property name="width_request">180</property>
                                     <property name="visible">True</property>
                                     <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
-                                    <property name="tooltip-text" translatable="yes">Set the mixdown of the output audio track.</property>
-                                    <signal handler="audio_mix_changed_cb" name="changed"/>
+                                    <property name="tooltip-text" translatable="yes">List of audio tracks available from your source.</property>
+                                    <signal handler="audio_track_changed_cb" name="changed"/>
                                   </object>
                                   <packing>
-                                    <property name="left_attach">4</property>
-                                    <property name="right_attach">5</property>
                                     <property name="top_attach">1</property>
                                     <property name="bottom_attach">2</property>
-                                    <property name="x_options">GTK_FILL</property>
+                                    <property name="left_attach">0</property>
+                                    <property name="right_attach">1</property>
                                   </packing>
                                 </child>
                                 <child>
-                                  <object class="GtkScaleButton" id="AudioTrackDRCSlider">
+                                  <object class="GtkComboBox" id="AudioEncoder">
                                     <property name="visible">True</property>
-                                    <property name="orientation">1</property>
-                                    <property name="icons">audio-volume-muted
-audio-volume-high
-audio-volume-low
-audio-volume-medium</property>
-                                    <property name="adjustment">adjustment28</property>
                                     <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
-                                    <property name="tooltip-markup" translatable="yes">&lt;b&gt;Dynamic Range Compression:&lt;/b&gt; Adjust the dynamic range of the output audio track. 
-
-For source audio that has a wide dynamic range (very loud and very soft sequences), DRC allows you to 'compress' the range by making loud sections softer and soft sections louder.</property>
-                                    <signal handler="drc_widget_changed_cb" name="value_changed"/>
+                                    <property name="tooltip-text" translatable="yes">Set the audio codec to encode this track with.</property>
+                                    <signal handler="audio_codec_changed_cb" name="changed"/>
                                   </object>
                                   <packing>
-                                    <property name="left_attach">5</property>
-                                    <property name="right_attach">6</property>
                                     <property name="top_attach">1</property>
                                     <property name="bottom_attach">2</property>
+                                    <property name="left_attach">1</property>
+                                    <property name="right_attach">2</property>
                                     <property name="x_options">GTK_FILL</property>
                                   </packing>
                                 </child>
                                 <child>
-                                  <object class="GtkLabel" id="drc_label">
+                                  <object class="GtkComboBox" id="AudioBitrate">
                                     <property name="visible">True</property>
-                                    <property name="width-chars">3</property>
                                     <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
-                                    <property name="label" translatable="yes">Off</property>
+                                    <property name="tooltip-text" translatable="yes">Set the bitrate to encode this track with.</property>
+                                    <signal handler="audio_widget_changed_cb" name="changed"/>
                                   </object>
                                   <packing>
-                                    <property name="left_attach">6</property>
-                                    <property name="right_attach">7</property>
                                     <property name="top_attach">1</property>
                                     <property name="bottom_attach">2</property>
+                                    <property name="left_attach">2</property>
+                                    <property name="right_attach">3</property>
                                     <property name="x_options">GTK_FILL</property>
                                   </packing>
                                 </child>
                                 <child>
-                                  <object class="GtkComboBox" id="AudioBitrate">
+                                  <object class="GtkComboBox" id="AudioMixdown">
                                     <property name="visible">True</property>
                                     <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
-                                    <property name="tooltip-text" translatable="yes">Set the bitrate to encode this track with.</property>
-                                    <signal handler="audio_widget_changed_cb" name="changed"/>
+                                    <property name="tooltip-text" translatable="yes">Set the mixdown of the output audio track.</property>
+                                    <signal handler="audio_mix_changed_cb" name="changed"/>
                                   </object>
                                   <packing>
-                                    <property name="left_attach">2</property>
-                                    <property name="right_attach">3</property>
                                     <property name="top_attach">1</property>
                                     <property name="bottom_attach">2</property>
+                                    <property name="left_attach">3</property>
+                                    <property name="right_attach">4</property>
                                     <property name="x_options">GTK_FILL</property>
                                   </packing>
                                 </child>
@@ -3868,6 +3836,179 @@ no-fast-pskip=0:no-dct-decimate=0:cabac=1</property>
     </child>
 
   </object>
+
+  <object class="GtkDialog" id="audio_dialog">
+    <property name="border_width">5</property>
+    <property name="title" translatable="yes">Advanced Audio Settings</property>
+    <property name="modal">False</property>
+    <property name="window_position">center-on-parent</property>
+    <property name="type_hint">dialog</property>
+    <property name="skip_taskbar_hint">True</property>
+    <property name="skip_pager_hint">True</property>
+    <signal name="delete_event" handler="gtk_widget_hide_on_delete"/>
+    <child internal-child="vbox">
+      <object class="GtkVBox" id="dialog-vbox10">
+        <property name="orientation">vertical</property>
+        <property name="visible">True</property>
+        <property name="spacing">2</property>
+        <child>
+          <object class="GtkHBox" id="hbox55">
+            <property name="visible">True</property>
+            <property name="spacing">4</property>
+            <child>
+              <object class="GtkImage" id="image5">
+                <property name="visible">True</property>
+                <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                <property name="icon_name">hb-icon</property>
+                <property name="icon-size">6</property>
+              </object>
+            </child>
+            <child>
+              <object class="GtkTable" id="table14">
+                <property name="visible">True</property>
+                <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                <property name="n_rows">3</property>
+                <property name="n_columns">3</property>
+                <property name="row_spacing">5</property>
+                <child>
+                  <object class="GtkLabel" id="sr_label">
+                    <property name="visible">True</property>
+                    <property name="xalign">1</property>
+                    <property name="label" translatable="yes">Sample Rate:</property>
+                    <property name="use_markup">True</property>
+                  </object>
+                  <packing>
+                                       <property name="top_attach">0</property>
+                                       <property name="bottom_attach">1</property>
+                                       <property name="left_attach">0</property>
+                                       <property name="right_attach">1</property>
+                    <property name="x_options">GTK_FILL</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkComboBox" id="AudioSamplerate">
+                    <property name="visible">True</property>
+                    <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                    <property name="tooltip-text" translatable="yes">Set the sample rate of the output audio track.</property>
+                    <signal handler="audio_widget_changed_cb" name="changed"/>
+                  </object>
+                  <packing>
+                                       <property name="top_attach">0</property>
+                                       <property name="bottom_attach">1</property>
+                                       <property name="left_attach">2</property>
+                                       <property name="right_attach">2</property>
+                    <property name="x_options">GTK_FILL</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkLabel" id="gain_label">
+                    <property name="visible">True</property>
+                    <property name="xalign">1</property>
+                    <property name="label" translatable="yes">Gain:</property>
+                    <property name="use_markup">True</property>
+                  </object>
+                  <packing>
+                                       <property name="top_attach">1</property>
+                                       <property name="bottom_attach">2</property>
+                                       <property name="left_attach">0</property>
+                                       <property name="right_attach">1</property>
+                    <property name="x_options">GTK_FILL</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkHScale" id="AudioTrackGain">
+                    <property name="visible">True</property>
+                    <property name="width-request">200</property>
+                    <property name="orientation">horizontal</property>
+                    <property name="adjustment">adjustment35</property>
+                    <property name="value_pos">right</property>
+                    <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                    <property name="tooltip-markup" translatable="yes">&lt;b&gt;Audio Gain:&lt;/b&gt; Adjust the amplification or attenuation of the output audio track.</property>
+                    <signal handler="gain_widget_changed_cb" name="value_changed"/>
+                    <signal name="format_value" handler="format_gain_cb"/>
+                  </object>
+                  <packing>
+                    <property name="top_attach">1</property>
+                    <property name="bottom_attach">2</property>
+                    <property name="left_attach">1</property>
+                    <property name="right_attach">3</property>
+                    <property name="x_options">GTK_FILL|GTK_EXPAND</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkLabel" id="drc_label">
+                    <property name="visible">True</property>
+                    <property name="xalign">1</property>
+                    <property name="label" translatable="yes">Dynamic Range Compression:</property>
+                    <property name="use_markup">True</property>
+                  </object>
+                  <packing>
+                                       <property name="top_attach">2</property>
+                                       <property name="bottom_attach">3</property>
+                                       <property name="left_attach">0</property>
+                                       <property name="right_attach">1</property>
+                    <property name="x_options">GTK_FILL</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkHScale" id="AudioTrackDRCSlider">
+                    <property name="visible">True</property>
+                    <property name="width-request">100</property>
+                    <property name="orientation">horizontal</property>
+                    <property name="value_pos">right</property>
+                    <property name="adjustment">adjustment28</property>
+                    <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                    <property name="tooltip-markup" translatable="yes">&lt;b&gt;Dynamic Range Compression:&lt;/b&gt; Adjust the dynamic range of the output audio track. 
+
+For source audio that has a wide dynamic range (very loud and very soft sequences), DRC allows you to 'compress' the range by making loud sections softer and soft sections louder.</property>
+                    <signal handler="drc_widget_changed_cb" name="value_changed"/>
+                    <signal name="format_value" handler="format_drc_cb"/>
+                  </object>
+                  <packing>
+                    <property name="top_attach">2</property>
+                    <property name="bottom_attach">3</property>
+                    <property name="left_attach">1</property>
+                    <property name="right_attach">3</property>
+                    <property name="x_options">GTK_FILL|GTK_EXPAND</property>
+                  </packing>
+                </child>
+              </object>
+            </child>
+          </object>
+        </child>
+        <child internal-child="action_area">
+          <object class="GtkHButtonBox" id="dialog-action_area10">
+            <property name="visible">True</property>
+            <property name="layout_style">end</property>
+            <child>
+              <object class="GtkButton" id="advanced_audio_ok">
+                <property name="label" translatable="yes">gtk-ok</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">True</property>
+                <property name="use_stock">True</property>
+                <signal name="clicked" handler="audio_advanced_ok_cb"/>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="pack_type">end</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
+      </object>
+    </child>
+    <action-widgets>
+      <action-widget response="-5">advanced_audio_ok</action-widget>
+    </action-widgets>
+  </object>
+
   <object class="GtkDialog" id="prefs_dialog">
     <property name="border_width">5</property>
     <property name="title" translatable="yes">Preferences</property>
index f6061c5641b96d96e293e530cffe0b7754d6ac88..f453f98d3f14688ec48cfc0cf03556fc95cb6df2 100644 (file)
@@ -4684,6 +4684,9 @@ add_job(hb_handle_t *h, GValue *js, gint unique_id, gint titleindex)
                acodec = ghb_settings_combo_int(asettings, "AudioEncoder");
                audio.out.codec = ghb_select_audio_codec(js, aconfig, acodec);
 
+               audio.out.gain = 
+                       ghb_settings_get_double(asettings, "AudioTrackGain");
+
         audio.out.dynamic_range_compression = 
                        ghb_settings_get_double(asettings, "AudioTrackDRCSlider");
         if (audio.out.dynamic_range_compression < 1.0)
index 51fa9bc18b27d104ea1b49c32f993e55fdaf3e5a..21e293892263cc8a58f3f9ee7a50bdd27bdd1e7f 100644 (file)
                                <integer>1</integer>
                                <key>AudioTrackDescription</key>
                                <string></string>
+                               <key>AudioTrackGain</key>
+                               <real>0</real>
                                <key>AudioTrackDRCSlider</key>
                                <real>0</real>
                                <key>AudioMixdown</key>
index 176f0f489a44094d97fa980a58b2a540fe472de0..7b5f3b6c6a9d362bd97a8adba1b2f8368ba8eb1f 100644 (file)
@@ -333,9 +333,9 @@ bind_audio_tree_model (signal_user_data_t *ud)
        selection = gtk_tree_view_get_selection (treeview);
        // 12 columns in model.  6 are visible, the other 6 are for storing
        // values that I need
-       treestore = gtk_list_store_new(6, G_TYPE_STRING, G_TYPE_STRING, 
+       treestore = gtk_list_store_new(7, G_TYPE_STRING, G_TYPE_STRING, 
                                                                   G_TYPE_STRING, G_TYPE_STRING, 
-                                                                  G_TYPE_STRING, G_TYPE_STRING);
+                                                                  G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING);
        gtk_tree_view_set_model(treeview, GTK_TREE_MODEL(treestore));
 
        cell = gtk_cell_renderer_text_new();
@@ -371,7 +371,12 @@ bind_audio_tree_model (signal_user_data_t *ud)
 
        cell = gtk_cell_renderer_text_new();
        column = gtk_tree_view_column_new_with_attributes(
-                                                                       _("DRC"), cell, "text", 5, NULL);
+                                                                       _("Gain"), cell, "text", 5, NULL);
+    gtk_tree_view_append_column(treeview, GTK_TREE_VIEW_COLUMN(column));
+
+       cell = gtk_cell_renderer_text_new();
+       column = gtk_tree_view_column_new_with_attributes(
+                                                                       _("DRC"), cell, "text", 6, NULL);
     gtk_tree_view_append_column(treeview, GTK_TREE_VIEW_COLUMN(column));
 
        g_signal_connect(selection, "changed", audio_list_selection_changed_cb, ud);
index 2164ab4e7a2c8faee6f0fcf1bd47b3c3e14b9a74..a16b28ca55107fd1fde5dccc03525adda677291a 100644 (file)
@@ -54,6 +54,8 @@ dep_map = (
        DepEntry("AudioEncoderActual", "AudioMixdown", "ac3pass|dtspass", True, False),
        DepEntry("AudioEncoderActual", "AudioTrackDRCSlider", "ac3pass|dtspass", True, False),
        DepEntry("AudioEncoderActual", "drc_label", "ac3pass|dtspass", True, False),
+       DepEntry("AudioEncoderActual", "AudioTrackGain", "ac3pass|dtspass", True, False),
+       DepEntry("AudioEncoderActual", "gain_label", "ac3pass|dtspass", True, False),
        DepEntry("x264_bframes", "x264_bpyramid", "<2", True, False),
        DepEntry("x264_bframes", "x264_direct", "0", True, False),
        DepEntry("x264_bframes", "x264_b_adapt", "0", True, False),
index 7fd6a82dab65e0a39320c3f5d3df37808a574ec8..6b934c14e409134ade4c60160d52cf6be5ed4383 100644 (file)
@@ -523,9 +523,9 @@ audio_list_refresh(signal_user_data_t *ud)
                do
                {
                        const gchar *track, *codec, *br, *sr, *mix;
-                       gchar *s_drc;
+                       gchar *s_drc, *s_gain;
                        gint itrack;
-                       gdouble drc;
+                       gdouble drc, gain;
                        GValue *asettings;
 
                        audio_list = ghb_settings_get_value(ud->settings, "audio_list");
@@ -539,6 +539,8 @@ audio_list_refresh(signal_user_data_t *ud)
                        br = ghb_settings_combo_option(asettings, "AudioBitrate");
                        sr = ghb_settings_combo_option(asettings, "AudioSamplerate");
                        mix = ghb_settings_combo_option(asettings, "AudioMixdown");
+                       gain = ghb_settings_get_double(asettings, "AudioTrackGain");
+                       s_gain = g_strdup_printf("%.fdB", gain);
 
                        drc = ghb_settings_get_double(asettings, "AudioTrackDRCSlider");
                        if (drc < 1.0)
@@ -553,9 +555,11 @@ audio_list_refresh(signal_user_data_t *ud)
                                2, br,
                                3, sr,
                                4, mix,
-                               5, s_drc,
+                               5, s_gain,
+                               6, s_drc,
                                -1);
                        g_free(s_drc);
+                       g_free(s_gain);
                        done = !gtk_tree_model_iter_next(GTK_TREE_MODEL(store), &iter);
                        row++;
                } while (!done);