changeset 2392:4ad6e7dfb389

imported 5298b10777b3 by Eugene Zagidullin. - peak == 0 mean absence of gain/peak pair
author Yoshiki Yazawa <yaz@cc.rim.or.jp>
date Fri, 15 Feb 2008 19:15:29 +0900
parents 7d1411f80023
children 6d47059bce36
files src/madplug/input.c src/madplug/plugin.c src/madplug/plugin.h src/madplug/replaygain.c
diffstat 4 files changed, 16 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- a/src/madplug/input.c	Fri Feb 15 19:13:35 2008 +0900
+++ b/src/madplug/input.c	Fri Feb 15 19:15:29 2008 +0900
@@ -88,8 +88,10 @@
     info->filename = g_strdup(url);
 
     // from input_read_replaygain()
-    info->replaygain_album_scale = -1;
-    info->replaygain_track_scale = -1;
+    info->replaygain_track_peak = 0.0;
+    info->replaygain_track_scale = 0.0;
+    info->replaygain_album_peak = 0.0;
+    info->replaygain_album_scale = 0.0;
     info->mp3gain_undo = -77;
     info->mp3gain_minmax = -77;
 
--- a/src/madplug/plugin.c	Fri Feb 15 19:13:35 2008 +0900
+++ b/src/madplug/plugin.c	Fri Feb 15 19:15:29 2008 +0900
@@ -418,6 +418,11 @@
     rg_info.track_peak = info.replaygain_track_peak;
     rg_info.album_gain = info.replaygain_album_scale;
     rg_info.album_peak = info.replaygain_album_peak;
+    AUDDBG("Replay Gain info:\n");
+    AUDDBG("* track gain:          %+f dB\n", rg_info.track_gain);
+    AUDDBG("* track peak:          %f\n",     rg_info.track_peak);
+    AUDDBG("* album gain:          %+f dB\n", rg_info.album_gain);
+    AUDDBG("* album peak:          %f\n",     rg_info.album_peak);
     playback->set_replaygain_info(playback, &rg_info);
 
     g_mutex_lock(pb_mutex);
--- a/src/madplug/plugin.h	Fri Feb 15 19:13:35 2008 +0900
+++ b/src/madplug/plugin.h	Fri Feb 15 19:15:29 2008 +0900
@@ -77,13 +77,12 @@
     gchar *prev_title;           /* used to optimize set_info calls */
 
     /* replay parameters */
-    gboolean has_replaygain;
-    double replaygain_album_scale;  // -1 if not set
+    double replaygain_album_scale;
     double replaygain_track_scale;
     gchar *replaygain_album_str;
     gchar *replaygain_track_str;
-    double replaygain_album_peak;   // -1 if not set
-    double replaygain_track_peak;
+    double replaygain_album_peak; /* 0 if gain/peak pair not set */
+    double replaygain_track_peak; /* 0 if gain/peak pair not set */
     gchar *replaygain_album_peak_str;
     gchar *replaygain_track_peak_str;
     double mp3gain_undo;        // -1 if not set
--- a/src/madplug/replaygain.c	Fri Feb 15 19:13:35 2008 +0900
+++ b/src/madplug/replaygain.c	Fri Feb 15 19:15:29 2008 +0900
@@ -247,12 +247,6 @@
 		free(value);
 	}
 
-	if (file_info->replaygain_track_scale != -1 || file_info->replaygain_album_scale != -1)
-	{
-		file_info->has_replaygain = TRUE;
-		return 1;
-	}
-
 	return 0;
 }
 
@@ -264,9 +258,10 @@
 
     AUDDBG("f: read_replaygain\n");
 
-    file_info->has_replaygain = FALSE;
-    file_info->replaygain_album_scale = -1;
-    file_info->replaygain_track_scale = -1;
+    file_info->replaygain_track_peak = 0.0;
+    file_info->replaygain_track_scale = 0.0;
+    file_info->replaygain_album_peak = 0.0;
+    file_info->replaygain_album_scale = 0.0;
     file_info->mp3gain_undo = -77;
     file_info->mp3gain_minmax = -77;
 
@@ -336,10 +331,6 @@
     }
 #endif
 
-    if (file_info->replaygain_album_scale != -1
-        || file_info->replaygain_track_scale != -1)
-        file_info->has_replaygain = TRUE;
-
     if (file_info->infile)
         aud_vfs_fseek(fp, curpos, SEEK_SET);