changeset 2364:5298b10777b3

peak == 0 mean absence of gain/peak pair
author Eugene Zagidullin <e.asphyx@gmail.com>
date Wed, 06 Feb 2008 05:41:26 +0300
parents 5eb15f6cf71e
children 8326592d3d35
files src/madplug_x/input.c src/madplug_x/plugin.c src/madplug_x/plugin.h src/madplug_x/replaygain.c
diffstat 4 files changed, 16 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- a/src/madplug_x/input.c	Tue Feb 05 09:14:14 2008 +0300
+++ b/src/madplug_x/input.c	Wed Feb 06 05:41:26 2008 +0300
@@ -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_x/plugin.c	Tue Feb 05 09:14:14 2008 +0300
+++ b/src/madplug_x/plugin.c	Wed Feb 06 05:41:26 2008 +0300
@@ -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_x/plugin.h	Tue Feb 05 09:14:14 2008 +0300
+++ b/src/madplug_x/plugin.h	Wed Feb 06 05:41:26 2008 +0300
@@ -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_x/replaygain.c	Tue Feb 05 09:14:14 2008 +0300
+++ b/src/madplug_x/replaygain.c	Wed Feb 06 05:41:26 2008 +0300
@@ -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);