From ea7992455a9704e2eb6bd6c9b39fabd111a7b997 Mon Sep 17 00:00:00 2001 From: Magnus Holmgren Date: Wed, 15 Nov 2006 20:26:33 +0000 Subject: Make the updated %rg tag match playback behaviour (fall back to track gain if album gain requested but not available). Share the mode decision logic with playback code and simplify the %rg tag handling. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11532 a1c6a512-1295-4272-9138-f99709370657 --- apps/misc.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'apps/misc.c') diff --git a/apps/misc.c b/apps/misc.c index 80c4588..709bc49 100644 --- a/apps/misc.c +++ b/apps/misc.c @@ -802,3 +802,19 @@ int show_logo( void ) return 0; } + +#if CONFIG_CODEC == SWCODEC +int get_replaygain_mode(bool have_track_gain, bool have_album_gain) +{ + int type; + + bool track = ((global_settings.replaygain_type == REPLAYGAIN_TRACK) + || ((global_settings.replaygain_type == REPLAYGAIN_SHUFFLE) + && global_settings.playlist_shuffle)); + + type = (!track && have_album_gain) ? REPLAYGAIN_ALBUM + : have_track_gain ? REPLAYGAIN_TRACK : -1; + + return type; +} +#endif -- cgit v1.1