SWCODEC: Fix the problem of replaygain not being applied unless the menu is entered. Make all codecs set the replay gain or else formats that do not have replaygain will not set the gain back to default if a file with gain applied proceeded them.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@12498 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Michael Sevakis 2007-02-26 17:15:04 +00:00
parent 94c02493a9
commit 9b9e22731c
9 changed files with 24 additions and 6 deletions

View file

@ -134,8 +134,9 @@ next_track:
while (!ci->taginfo_ready)
ci->yield();
ci->configure(DSP_SWITCH_FREQUENCY, ci->id3->frequency);
codec_set_replaygain(ci->id3);
/* Intialise the A52 decoder and check for success */
state = a52_init(0);

View file

@ -70,6 +70,8 @@ next_track:
/* wait for track info to load */
while (!*ci->taginfo_ready && !ci->stop_codec)
ci->sleep(1);
codec_set_replaygain(ci->id3);
/* Read the entire file (or as much as possible) */
DEBUGF("ADX: request initial buffer\n");

View file

@ -75,6 +75,8 @@ next_track:
while (!*ci->taginfo_ready)
ci->yield();
codec_set_replaygain(ci->id3);
/* assume the AIFF header is less than 1024 bytes */
buf = ci->request_buffer(&n, 1024);

View file

@ -4344,6 +4344,8 @@ next_track:
/* wait for track info to load */
while (!*ci->taginfo_ready && !ci->stop_codec)
ci->sleep(1);
codec_set_replaygain(ci->id3);
/* Read the entire file */
DEBUGF("NSF: request file\n");

View file

@ -61,6 +61,8 @@ next_track:
while (!*ci->taginfo_ready)
ci->yield();
codec_set_replaygain(ci->id3);
/* Shorten decoder initialization */
ci->memset(&sc, 0, sizeof(ShortenContext));

View file

@ -1226,6 +1226,8 @@ next_track:
while (!*ci->taginfo_ready)
ci->yield();
codec_set_replaygain(ci->id3);
/* Load SID file */
p = sidfile;

View file

@ -829,6 +829,8 @@ enum codec_status codec_main(void)
while (!*ci->taginfo_ready && !ci->stop_codec)
ci->sleep(1);
codec_set_replaygain(ci->id3);
/* Read the entire file */
DEBUGF("SPC: request initial buffer\n");
ci->configure(CODEC_SET_FILEBUF_WATERMARK, ci->filesize);

View file

@ -237,6 +237,8 @@ next_track:
while (!*ci->taginfo_ready && !ci->stop_codec)
ci->sleep(1);
codec_set_replaygain(ci->id3);
/* Need to save offset for later use (cleared indirectly by advance_buffer) */
bytesdone = ci->id3->offset;

View file

@ -1200,11 +1200,14 @@ bool dsp_configure(int setting, intptr_t value)
void set_gain_var(long *var, long value)
{
/* Voice shouldn't mess with these */
if (dsp != audio_dsp)
return;
*var = value;
new_gain = true;
if (dsp == audio_dsp)
{
*var = value;
/* In case current gain is zero, force at least one call
to apply_gain or apply_gain won't pick up on new_gain */
audio_dsp->gain = -1;
new_gain = true;
}
}
void update_functions(void)