[PATCH] Save/load session settings patch

Emmanuel Saracco <[email protected]>
Newsgroups gmane.comp.audio.jamin.devel
Message-ID <[email protected]>
Hi all,

This patch actually fix two issues:

-----
* Issue 1:

	Crossover type is not saved/loaded to/from JAMin session file.

* Solution:

	Save/load crossover type.

-----
* Issue 2:

	Preferences dialog does not really display current session parameters.

* Solution:

	Refresh preference dialog properties at show time.

Tell me if it is ok for you.

Bye

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

_______________________________________________
Jamin-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jamin-devel
jamin-pref-save_restore.patch (text/x-patch, 6.1 KB)
diff -BruNa jamin_orig/src/preferences.c jamin/src/preferences.c
--- jamin_orig/src/preferences.c	2007-07-01 17:33:18.000000000 +0200
+++ jamin/src/preferences.c	2008-02-02 12:15:38.000000000 +0100
@@ -31,6 +31,7 @@
 
 
 #include "preferences.h"
+#include "callbacks.h"
 #include "hdeq.h"
 #include "geq.h"
 #include "main.h"
@@ -57,6 +58,11 @@
 static GdkColor          color[COLORS];
 static int               color_id;
 static GtkComboBox       *l_limiter_combo, *l_SpectrumComboBox, *l_ColorsComboBox;
+static GtkSpinButton     *l_hdeq_lower_gain, *l_hdeq_upper_gain, *l_crossfade_time, 
+                         *l_inmeter_warn, *l_spectrum_freq, *l_rms_time_slice, 
+                         *l_xo_delay_time_low, *l_xo_delay_time_mid;
+static GtkToggleButton   *l_out_meter_peak, *l_out_meter_full, *l_rms_meter_peak, 
+                         *l_rms_meter_full, *l_fft, *l_iir; 
 static gboolean          initialized = FALSE;
 
 
@@ -112,6 +118,22 @@
 
   gtk_combo_box_set_active (l_limiter_combo, process_get_limiter_plugin ());
 
+  l_hdeq_lower_gain = GTK_SPIN_BUTTON (lookup_widget (pref_dialog, "MinGainSpin"));
+  l_hdeq_upper_gain = GTK_SPIN_BUTTON (lookup_widget (pref_dialog, "MaxGainSpin"));
+  l_crossfade_time = GTK_SPIN_BUTTON (lookup_widget (pref_dialog, "CrossfadeTimeSpin"));
+  l_inmeter_warn = GTK_SPIN_BUTTON (lookup_widget (pref_dialog, "warningLevelSpinButton"));
+  l_spectrum_freq = GTK_SPIN_BUTTON (lookup_widget (pref_dialog, "UpdateFrequencySpin"));
+  l_rms_time_slice = GTK_SPIN_BUTTON (lookup_widget (pref_dialog, "rmsTimeValue"));
+  l_xo_delay_time_low = GTK_SPIN_BUTTON (lookup_widget (pref_dialog, "LowDelaySpinButton"));
+  l_xo_delay_time_mid = GTK_SPIN_BUTTON (lookup_widget (pref_dialog, "MidDelaySpinButton"));
+
+  l_out_meter_peak = GTK_TOGGLE_BUTTON (lookup_widget (pref_dialog, "out_meter_peak_button"));
+  l_out_meter_full = GTK_TOGGLE_BUTTON (lookup_widget (pref_dialog, "out_meter_full_button"));
+  l_rms_meter_peak = GTK_TOGGLE_BUTTON (lookup_widget (pref_dialog, "rms_meter_peak_button"));
+  l_rms_meter_full = GTK_TOGGLE_BUTTON (lookup_widget (pref_dialog, "rms_meter_full_button"));
+  l_fft = GTK_TOGGLE_BUTTON (lookup_widget (pref_dialog, "FFTButton"));
+  l_iir = GTK_TOGGLE_BUTTON (lookup_widget (pref_dialog, "IIRButton"));
+
 
   color_dialog = create_colorselectiondialog1 ();
 
@@ -262,6 +284,43 @@
   initialized = TRUE;
 }
 
+void pref_set_all_values (void)
+{
+  gtk_spin_button_set_value (l_hdeq_lower_gain, hdeq_get_lower_gain ());
+  gtk_spin_button_set_value (l_hdeq_upper_gain, hdeq_get_upper_gain ());
+  gtk_spin_button_set_value (l_crossfade_time, s_get_crossfade_time ());
+  gtk_spin_button_set_value (l_inmeter_warn, intrim_inmeter_get_warn ());
+  gtk_spin_button_set_value (l_spectrum_freq, get_spectrum_freq ());
+  gtk_spin_button_set_value (l_rms_time_slice, process_get_rms_time_slice ());
+  gtk_spin_button_set_value (l_xo_delay_time_low, process_get_xo_delay_time (XO_LOW));
+  gtk_spin_button_set_value (l_xo_delay_time_mid, process_get_xo_delay_time (XO_MID));
+
+  g_signal_handlers_block_by_func (l_out_meter_peak, on_out_meter_peak_button_clicked, NULL);
+  g_signal_handlers_block_by_func (l_out_meter_full, on_out_meter_full_button_clicked, NULL);
+  g_signal_handlers_block_by_func (l_rms_meter_peak, on_rms_meter_peak_button_clicked, NULL);
+  g_signal_handlers_block_by_func (l_rms_meter_full, on_rms_meter_full_button_clicked, NULL);
+  g_signal_handlers_block_by_func (l_fft, on_FFTButton_clicked, NULL);
+  g_signal_handlers_block_by_func (l_iir, on_IIRButton_clicked, NULL);
+
+
+  gtk_toggle_button_set_active (l_out_meter_peak, intrim_get_out_meter_peak_pref ());
+  gtk_toggle_button_set_active (l_out_meter_full, !intrim_get_out_meter_peak_pref ());
+  gtk_toggle_button_set_active (l_rms_meter_peak, intrim_get_rms_meter_peak_pref ());
+  gtk_toggle_button_set_active (l_rms_meter_full, !intrim_get_rms_meter_peak_pref ());
+  gtk_toggle_button_set_active (l_fft, (process_get_crossover_type () == FFT));
+  gtk_toggle_button_set_active (l_iir, (process_get_crossover_type () == IIR));
+
+  g_signal_handlers_unblock_by_func (l_out_meter_peak, on_out_meter_peak_button_clicked, NULL);
+  g_signal_handlers_unblock_by_func (l_out_meter_full, on_out_meter_full_button_clicked, NULL);
+  g_signal_handlers_unblock_by_func (l_rms_meter_peak, on_rms_meter_peak_button_clicked, NULL);
+  g_signal_handlers_unblock_by_func (l_rms_meter_full, on_rms_meter_full_button_clicked, NULL);
+  g_signal_handlers_unblock_by_func (l_fft, on_FFTButton_clicked, NULL);
+  g_signal_handlers_unblock_by_func (l_iir, on_IIRButton_clicked, NULL);
+  
+  gtk_combo_box_set_active (l_SpectrumComboBox, process_get_spec_mode ());
+  gtk_combo_box_set_active (l_limiter_combo, process_get_limiter_plugin ());
+}
+
 
 GdkColor *get_color (int color_id)
 {
@@ -291,6 +350,7 @@
   if (updown)
     {
       gtk_widget_show (pref_dialog);
+      pref_set_all_values ();
     }
 
 
diff -BruNa jamin_orig/src/state.c jamin/src/state.c
--- jamin_orig/src/state.c	2008-01-31 16:47:38.000000000 +0100
+++ jamin/src/state.c	2008-02-02 12:15:31.000000000 +0100
@@ -103,6 +103,7 @@
     int gang_ra[XO_BANDS];
     int gang_kn[XO_BANDS];
     int gang_ma[XO_BANDS];
+    int iir_xover;
 } xml_global_params;
 
 void state_init()
@@ -563,6 +564,7 @@
     s_save_global_float(doc, "mid delay time", process_get_xo_delay_time(XO_MID));
     s_save_global_int(doc, "mid delay state", process_get_xo_delay_state (XO_MID));
 
+    s_save_global_int (doc, "crossover type", process_get_crossover_type ());
 
     /* record the current gang state of the compressor controls  */
 
@@ -791,6 +793,7 @@
 
     process_set_rms_time_slice (gp.rms_time_slice);
 
+    process_set_crossover_type (gp.iir_xover);
 
     /*  This is the active scene.  */
 
@@ -936,6 +939,9 @@
           gp->xo_delay_state[XO_LOW] = atoi(value);
 	} else if (!strcmp(symbol, "mid delay state")) {
           gp->xo_delay_state[XO_MID] = atoi(value);
+	} else if (!strcmp(symbol, "crossover type")) {
+          gp->iir_xover = atoi(value);
+	} else if (!strcmp(symbol, "mid delay state")) {
 	} else if ((const char *)strstr(symbol, "gang_") == symbol) {
 	    int ind = index ? atoi(index) : -1;
 	    int val = atoi(value);
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.