mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-12-10 13:45:10 -05:00
Iriver: Added new ReplayGain type: track gain if shuffle mode is active, album gain otherwise. Properly apply ReplayGain settings on config file load. Bumped config version, so save your settings.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@7558 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
9a625ef7ac
commit
4b711c2f72
6 changed files with 38 additions and 14 deletions
14
apps/dsp.c
14
apps/dsp.c
|
|
@ -708,11 +708,16 @@ void dsp_set_replaygain(bool always)
|
||||||
|
|
||||||
if (global_settings.replaygain || global_settings.replaygain_noclip)
|
if (global_settings.replaygain || global_settings.replaygain_noclip)
|
||||||
{
|
{
|
||||||
long peak;
|
bool track_mode
|
||||||
|
= ((global_settings.replaygain_type == REPLAYGAIN_TRACK)
|
||||||
|
|| ((global_settings.replaygain_type == REPLAYGAIN_SHUFFLE)
|
||||||
|
&& global_settings.playlist_shuffle));
|
||||||
|
long peak = (track_mode || !dsp->album_peak)
|
||||||
|
? dsp->track_peak : dsp->album_peak;
|
||||||
|
|
||||||
if (global_settings.replaygain)
|
if (global_settings.replaygain)
|
||||||
{
|
{
|
||||||
gain = (global_settings.replaygain_track || !dsp->album_gain)
|
gain = (track_mode || !dsp->album_gain)
|
||||||
? dsp->track_gain : dsp->album_gain;
|
? dsp->track_gain : dsp->album_gain;
|
||||||
|
|
||||||
if (global_settings.replaygain_preamp)
|
if (global_settings.replaygain_preamp)
|
||||||
|
|
@ -720,13 +725,10 @@ void dsp_set_replaygain(bool always)
|
||||||
long preamp = get_replaygain_int(
|
long preamp = get_replaygain_int(
|
||||||
global_settings.replaygain_preamp * 10);
|
global_settings.replaygain_preamp * 10);
|
||||||
|
|
||||||
gain = (long) ((((int64_t) gain * preamp)) >> 24);
|
gain = (long) (((int64_t) gain * preamp) >> 24);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
peak = (global_settings.replaygain_track || !dsp->album_peak)
|
|
||||||
? dsp->track_peak : dsp->album_peak;
|
|
||||||
|
|
||||||
if (gain == 0)
|
if (gain == 0)
|
||||||
{
|
{
|
||||||
/* So that noclip can work even with no gain information. */
|
/* So that noclip can work even with no gain information. */
|
||||||
|
|
|
||||||
|
|
@ -3292,3 +3292,9 @@ desc: repeat one song
|
||||||
eng: "A-B"
|
eng: "A-B"
|
||||||
voice: "A-B"
|
voice: "A-B"
|
||||||
new:
|
new:
|
||||||
|
|
||||||
|
id: LANG_SHUFFLE_GAIN
|
||||||
|
desc: use track gain if shuffle mode is on, album gain otherwise
|
||||||
|
eng: "Track gain if shuffling"
|
||||||
|
voice: "Track gain if shuffling"
|
||||||
|
new:
|
||||||
|
|
|
||||||
|
|
@ -53,6 +53,9 @@
|
||||||
#ifdef HAVE_MMC
|
#ifdef HAVE_MMC
|
||||||
#include "ata_mmc.h"
|
#include "ata_mmc.h"
|
||||||
#endif
|
#endif
|
||||||
|
#if CONFIG_CODEC == SWCODEC
|
||||||
|
#include "dsp.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_LCD_BITMAP
|
#ifdef HAVE_LCD_BITMAP
|
||||||
#define SCROLLBAR_WIDTH 6
|
#define SCROLLBAR_WIDTH 6
|
||||||
|
|
@ -661,6 +664,8 @@ bool quick_screen(int context, int button)
|
||||||
|
|
||||||
if(audio_status() & AUDIO_STATUS_PLAY)
|
if(audio_status() & AUDIO_STATUS_PLAY)
|
||||||
{
|
{
|
||||||
|
dsp_set_replaygain(true);
|
||||||
|
|
||||||
if (global_settings.playlist_shuffle)
|
if (global_settings.playlist_shuffle)
|
||||||
playlist_randomise(NULL, current_tick, true);
|
playlist_randomise(NULL, current_tick, true);
|
||||||
else
|
else
|
||||||
|
|
|
||||||
|
|
@ -77,9 +77,10 @@ const char rec_base_directory[] = REC_BASE_DIR;
|
||||||
#if CONFIG_CODEC == SWCODEC
|
#if CONFIG_CODEC == SWCODEC
|
||||||
#include "pcmbuf.h"
|
#include "pcmbuf.h"
|
||||||
#include "pcm_playback.h"
|
#include "pcm_playback.h"
|
||||||
|
#include "dsp.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define CONFIG_BLOCK_VERSION 27
|
#define CONFIG_BLOCK_VERSION 28
|
||||||
#define CONFIG_BLOCK_SIZE 512
|
#define CONFIG_BLOCK_SIZE 512
|
||||||
#define RTC_BLOCK_SIZE 44
|
#define RTC_BLOCK_SIZE 44
|
||||||
|
|
||||||
|
|
@ -432,7 +433,8 @@ static const struct bit_entry hd_bits[] =
|
||||||
#if CONFIG_CODEC == SWCODEC
|
#if CONFIG_CODEC == SWCODEC
|
||||||
{2, S_O(crossfade), 0, "crossfade type", "off,crossfade,mix"},
|
{2, S_O(crossfade), 0, "crossfade type", "off,crossfade,mix"},
|
||||||
{1, S_O(replaygain), false, "replaygain", off_on },
|
{1, S_O(replaygain), false, "replaygain", off_on },
|
||||||
{1, S_O(replaygain_track), false, "replaygain type", "track,album" },
|
{2, S_O(replaygain_type), REPLAYGAIN_ALBUM, "replaygain type",
|
||||||
|
"track,album,track shuffle" },
|
||||||
{1, S_O(replaygain_noclip), false, "replaygain noclip", off_on },
|
{1, S_O(replaygain_noclip), false, "replaygain noclip", off_on },
|
||||||
{8 | SIGNED, S_O(replaygain_preamp), 0, "replaygain preamp", NULL },
|
{8 | SIGNED, S_O(replaygain_preamp), 0, "replaygain preamp", NULL },
|
||||||
{2, S_O(beep), 0, "off,weak,moderate,strong", NULL },
|
{2, S_O(beep), 0, "off,weak,moderate,strong", NULL },
|
||||||
|
|
@ -879,6 +881,7 @@ void settings_apply(void)
|
||||||
|
|
||||||
#if CONFIG_CODEC == SWCODEC
|
#if CONFIG_CODEC == SWCODEC
|
||||||
audio_set_crossfade(global_settings.crossfade);
|
audio_set_crossfade(global_settings.crossfade);
|
||||||
|
dsp_set_replaygain(true);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_SPDIF_POWER
|
#ifdef HAVE_SPDIF_POWER
|
||||||
|
|
|
||||||
|
|
@ -333,8 +333,9 @@ struct user_settings
|
||||||
|
|
||||||
#if CONFIG_CODEC == SWCODEC
|
#if CONFIG_CODEC == SWCODEC
|
||||||
bool replaygain; /* enable replaygain */
|
bool replaygain; /* enable replaygain */
|
||||||
bool replaygain_track; /* true for track gain, false for album gain */
|
|
||||||
bool replaygain_noclip; /* scale to prevent clips */
|
bool replaygain_noclip; /* scale to prevent clips */
|
||||||
|
int replaygain_type; /* 0=track gain, 1=album gain, 2=track gain if
|
||||||
|
shuffle is on, album gain otherwise */
|
||||||
int replaygain_preamp; /* scale replaygained tracks by this */
|
int replaygain_preamp; /* scale replaygained tracks by this */
|
||||||
int beep; /* system beep volume when changing tracks etc. */
|
int beep; /* system beep volume when changing tracks etc. */
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -427,4 +428,7 @@ enum { SHOW_ALL, SHOW_SUPPORTED, SHOW_MUSIC, SHOW_PLAYLIST, SHOW_ID3DB,
|
||||||
/* recursive dir insert options */
|
/* recursive dir insert options */
|
||||||
enum { RECURSE_OFF, RECURSE_ON, RECURSE_ASK };
|
enum { RECURSE_OFF, RECURSE_ON, RECURSE_ASK };
|
||||||
|
|
||||||
|
/* replaygain types */
|
||||||
|
enum { REPLAYGAIN_TRACK = 0, REPLAYGAIN_ALBUM, REPLAYGAIN_SHUFFLE };
|
||||||
|
|
||||||
#endif /* __SETTINGS_H__ */
|
#endif /* __SETTINGS_H__ */
|
||||||
|
|
|
||||||
|
|
@ -1184,11 +1184,13 @@ static bool replaygain(void)
|
||||||
|
|
||||||
static bool replaygain_mode(void)
|
static bool replaygain_mode(void)
|
||||||
{
|
{
|
||||||
bool result = set_bool_options(str(LANG_REPLAYGAIN_MODE),
|
static const struct opt_items names[] = {
|
||||||
&global_settings.replaygain_track,
|
{ STR(LANG_TRACK_GAIN) },
|
||||||
STR(LANG_TRACK_GAIN),
|
{ STR(LANG_ALBUM_GAIN) },
|
||||||
STR(LANG_ALBUM_GAIN),
|
{ STR(LANG_SHUFFLE_GAIN) },
|
||||||
NULL);
|
};
|
||||||
|
bool result = set_option(str(LANG_REPLAYGAIN_MODE),
|
||||||
|
&global_settings.replaygain_type, INT, names, 3, NULL);
|
||||||
|
|
||||||
dsp_set_replaygain(true);
|
dsp_set_replaygain(true);
|
||||||
return result;
|
return result;
|
||||||
|
|
@ -1294,6 +1296,8 @@ static bool playback_settings_menu(void)
|
||||||
if ((old_shuffle != global_settings.playlist_shuffle)
|
if ((old_shuffle != global_settings.playlist_shuffle)
|
||||||
&& (audio_status() & AUDIO_STATUS_PLAY))
|
&& (audio_status() & AUDIO_STATUS_PLAY))
|
||||||
{
|
{
|
||||||
|
dsp_set_replaygain(true);
|
||||||
|
|
||||||
if (global_settings.playlist_shuffle)
|
if (global_settings.playlist_shuffle)
|
||||||
{
|
{
|
||||||
playlist_randomise(NULL, current_tick, true);
|
playlist_randomise(NULL, current_tick, true);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue