changeset 942:84693c7f096d trunk

[svn] Use default settings when no valid config exists.
author chainsaw
date Sat, 15 Apr 2006 20:12:29 -0700
parents f923aa230a2a
children 0606d7908abb
files Plugins/Effect/audiocompress/audacious-glue.c
diffstat 1 files changed, 11 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/Plugins/Effect/audiocompress/audacious-glue.c	Sat Apr 15 18:49:50 2006 -0700
+++ b/Plugins/Effect/audiocompress/audacious-glue.c	Sat Apr 15 20:12:29 2006 -0700
@@ -123,12 +123,6 @@
 {
 	ConfigDb *db;
 
-	prefs->anticlip = ANTICLIP;
-	prefs->target = TARGET;
-	prefs->gainmax = GAINMAX;
-	prefs->gainsmooth = GAINSMOOTH;
-	prefs->buckets = BUCKETS;
-
 	db = bmp_cfg_db_open();
 
 	bmp_cfg_db_get_bool(db, "AudioCompress",
@@ -142,9 +136,17 @@
 	bmp_cfg_db_get_int(db, "AudioCompress", "buckets",
 			   &prefs->buckets);
 
-	prefs->dialog = create_prefs_dialog(prefs);
+	bmp_cfg_db_close(db);
 
-	bmp_cfg_db_close(db);
+	if ((prefs->gainmax == 0) && (prefs->gainsmooth == 0) && (prefs->buckets == 0)) {
+		prefs->anticlip = ANTICLIP;
+		prefs->target = TARGET;
+		prefs->gainmax = GAINMAX;
+		prefs->gainsmooth = GAINSMOOTH;
+		prefs->buckets = BUCKETS;
+	}
+
+	prefs->dialog = create_prefs_dialog(prefs);
 }
 
 void freePrefs(CompressorPrefs * prefs)
@@ -160,7 +162,7 @@
 	db = bmp_cfg_db_open();
 
 	bmp_cfg_db_set_bool(db, "AudioCompress", "anticlip",
-				prefs->anticlip);
+			    prefs->anticlip);
 	bmp_cfg_db_set_int(db, "AudioCompress", "target",
 			    prefs->target);
 	bmp_cfg_db_set_int(db, "AudioCompress", "gainmax",