summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Scarratt <mmmm@rockbox.org>2006-11-15 17:29:03 +0000
committerMartin Scarratt <mmmm@rockbox.org>2006-11-15 17:29:03 +0000
commit442c0e663f20dfd64e6d7d818ab13f444804ab5e (patch)
treef6b2945a15f2cd45199b1d775b5f9f521ea8a3a8
parent9270ee6aab0e1868bcd91966ac6c69b7d454dba6 (diff)
Improved replaygain tags for WPS by Ian Webber fs#6223. Shows the current status of the gain rather than what the setting is set to. %?rg<off|track|album|shuffletrack|shufflealbum|notag>. Also, %rg will give the current gain adjustment.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11531 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/gui/gwps-common.c57
-rw-r--r--docs/CREDITS1
2 files changed, 54 insertions, 4 deletions
diff --git a/apps/gui/gwps-common.c b/apps/gui/gwps-common.c
index 212f40f3c0..2e7b7ef09c 100644
--- a/apps/gui/gwps-common.c
+++ b/apps/gui/gwps-common.c
@@ -937,11 +937,60 @@ static char* get_tag(struct wps_data* wps_data,
#if CONFIG_CODEC == SWCODEC
case 'g': /* ReplayGain */
*flags |= WPS_REFRESH_STATIC;
- if(global_settings.replaygain)
- *intval = global_settings.replaygain_type+2;
+ if (global_settings.replaygain == 0)
+ *intval = 1; /* off */
else
- *intval = 1;
- snprintf(buf, buf_size, "%d", *intval);
+ {
+ switch (global_settings.replaygain_type)
+ {
+ case REPLAYGAIN_TRACK: /* track */
+ if (id3->track_gain_string == NULL)
+ *intval = 6; /* no tag */
+ else
+ *intval = 2;
+ break;
+ case REPLAYGAIN_ALBUM: /* album */
+ if (id3->album_gain_string == NULL)
+ *intval = 6; /* no tag */
+ else
+ *intval = 3;
+ break;
+ case REPLAYGAIN_SHUFFLE: /* shuffle */
+ if (global_settings.playlist_shuffle)
+ {
+ if (id3->track_gain_string == NULL)
+ *intval = 6; /* no tag */
+ else
+ *intval = 4; /* shuffle track */
+ }
+ else
+ {
+ if (id3->album_gain_string == NULL)
+ *intval = 6; /* no tag */
+ else
+ *intval = 5; /* shuffle album */
+ }
+ break;
+ default:
+ *intval = 1; /* shoudn't happen, treat as off */
+ break;
+ } /* switch - replay gain type */
+ } /* if - replay gain set */
+ switch (*intval)
+ {
+ case 1:
+ case 6:
+ strncpy(buf, "+0.00 dB", buf_size);
+ break;
+ case 2:
+ case 4:
+ strncpy(buf, id3->track_gain_string, buf_size);
+ break;
+ case 3:
+ case 5:
+ strncpy(buf, id3->album_gain_string, buf_size);
+ break;
+ }
return buf;
#endif
}
diff --git a/docs/CREDITS b/docs/CREDITS
index dc5d091175..e1946ab7f0 100644
--- a/docs/CREDITS
+++ b/docs/CREDITS
@@ -247,3 +247,4 @@ Stéphane Doyen
Austin Appel
Andre Smith
Travis Hyyppa
+Ian Webber