summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Sevakis <jethead71@rockbox.org>2007-02-26 17:15:04 +0000
committerMichael Sevakis <jethead71@rockbox.org>2007-02-26 17:15:04 +0000
commit9b9e22731c137ef3f3febde7d4a914e1adfe6253 (patch)
tree4e6f98841be43af0004f97e6d827986279b6ff28
parent94c02493a9f34a686655bd82dedba8c9a78cbc63 (diff)
downloadrockbox-9b9e22731c137ef3f3febde7d4a914e1adfe6253.tar.gz
rockbox-9b9e22731c137ef3f3febde7d4a914e1adfe6253.zip
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
-rw-r--r--apps/codecs/a52.c3
-rw-r--r--apps/codecs/adx.c2
-rw-r--r--apps/codecs/aiff.c2
-rw-r--r--apps/codecs/nsf.c2
-rw-r--r--apps/codecs/shorten.c2
-rw-r--r--apps/codecs/sid.c2
-rw-r--r--apps/codecs/spc.c2
-rw-r--r--apps/codecs/wav.c2
-rw-r--r--apps/dsp.c13
9 files changed, 24 insertions, 6 deletions
diff --git a/apps/codecs/a52.c b/apps/codecs/a52.c
index 23f5067d47..b2229d4c49 100644
--- a/apps/codecs/a52.c
+++ b/apps/codecs/a52.c
@@ -134,8 +134,9 @@ next_track:
134 134
135 while (!ci->taginfo_ready) 135 while (!ci->taginfo_ready)
136 ci->yield(); 136 ci->yield();
137 137
138 ci->configure(DSP_SWITCH_FREQUENCY, ci->id3->frequency); 138 ci->configure(DSP_SWITCH_FREQUENCY, ci->id3->frequency);
139 codec_set_replaygain(ci->id3);
139 140
140 /* Intialise the A52 decoder and check for success */ 141 /* Intialise the A52 decoder and check for success */
141 state = a52_init(0); 142 state = a52_init(0);
diff --git a/apps/codecs/adx.c b/apps/codecs/adx.c
index 19d8110da6..337e07e721 100644
--- a/apps/codecs/adx.c
+++ b/apps/codecs/adx.c
@@ -70,6 +70,8 @@ next_track:
70 /* wait for track info to load */ 70 /* wait for track info to load */
71 while (!*ci->taginfo_ready && !ci->stop_codec) 71 while (!*ci->taginfo_ready && !ci->stop_codec)
72 ci->sleep(1); 72 ci->sleep(1);
73
74 codec_set_replaygain(ci->id3);
73 75
74 /* Read the entire file (or as much as possible) */ 76 /* Read the entire file (or as much as possible) */
75 DEBUGF("ADX: request initial buffer\n"); 77 DEBUGF("ADX: request initial buffer\n");
diff --git a/apps/codecs/aiff.c b/apps/codecs/aiff.c
index 2e92d9353f..7cb471c432 100644
--- a/apps/codecs/aiff.c
+++ b/apps/codecs/aiff.c
@@ -75,6 +75,8 @@ next_track:
75 75
76 while (!*ci->taginfo_ready) 76 while (!*ci->taginfo_ready)
77 ci->yield(); 77 ci->yield();
78
79 codec_set_replaygain(ci->id3);
78 80
79 /* assume the AIFF header is less than 1024 bytes */ 81 /* assume the AIFF header is less than 1024 bytes */
80 buf = ci->request_buffer(&n, 1024); 82 buf = ci->request_buffer(&n, 1024);
diff --git a/apps/codecs/nsf.c b/apps/codecs/nsf.c
index 0ca1275d5e..6f81c6a4bc 100644
--- a/apps/codecs/nsf.c
+++ b/apps/codecs/nsf.c
@@ -4344,6 +4344,8 @@ next_track:
4344 /* wait for track info to load */ 4344 /* wait for track info to load */
4345 while (!*ci->taginfo_ready && !ci->stop_codec) 4345 while (!*ci->taginfo_ready && !ci->stop_codec)
4346 ci->sleep(1); 4346 ci->sleep(1);
4347
4348 codec_set_replaygain(ci->id3);
4347 4349
4348 /* Read the entire file */ 4350 /* Read the entire file */
4349 DEBUGF("NSF: request file\n"); 4351 DEBUGF("NSF: request file\n");
diff --git a/apps/codecs/shorten.c b/apps/codecs/shorten.c
index dbfc272c5a..004a4070bd 100644
--- a/apps/codecs/shorten.c
+++ b/apps/codecs/shorten.c
@@ -61,6 +61,8 @@ next_track:
61 while (!*ci->taginfo_ready) 61 while (!*ci->taginfo_ready)
62 ci->yield(); 62 ci->yield();
63 63
64 codec_set_replaygain(ci->id3);
65
64 /* Shorten decoder initialization */ 66 /* Shorten decoder initialization */
65 ci->memset(&sc, 0, sizeof(ShortenContext)); 67 ci->memset(&sc, 0, sizeof(ShortenContext));
66 68
diff --git a/apps/codecs/sid.c b/apps/codecs/sid.c
index 7c53e8f189..1c98714357 100644
--- a/apps/codecs/sid.c
+++ b/apps/codecs/sid.c
@@ -1226,6 +1226,8 @@ next_track:
1226 1226
1227 while (!*ci->taginfo_ready) 1227 while (!*ci->taginfo_ready)
1228 ci->yield(); 1228 ci->yield();
1229
1230 codec_set_replaygain(ci->id3);
1229 1231
1230 /* Load SID file */ 1232 /* Load SID file */
1231 p = sidfile; 1233 p = sidfile;
diff --git a/apps/codecs/spc.c b/apps/codecs/spc.c
index 8d621dd677..12b236c53d 100644
--- a/apps/codecs/spc.c
+++ b/apps/codecs/spc.c
@@ -829,6 +829,8 @@ enum codec_status codec_main(void)
829 while (!*ci->taginfo_ready && !ci->stop_codec) 829 while (!*ci->taginfo_ready && !ci->stop_codec)
830 ci->sleep(1); 830 ci->sleep(1);
831 831
832 codec_set_replaygain(ci->id3);
833
832 /* Read the entire file */ 834 /* Read the entire file */
833 DEBUGF("SPC: request initial buffer\n"); 835 DEBUGF("SPC: request initial buffer\n");
834 ci->configure(CODEC_SET_FILEBUF_WATERMARK, ci->filesize); 836 ci->configure(CODEC_SET_FILEBUF_WATERMARK, ci->filesize);
diff --git a/apps/codecs/wav.c b/apps/codecs/wav.c
index b4eaaefb64..94099c543d 100644
--- a/apps/codecs/wav.c
+++ b/apps/codecs/wav.c
@@ -237,6 +237,8 @@ next_track:
237 237
238 while (!*ci->taginfo_ready && !ci->stop_codec) 238 while (!*ci->taginfo_ready && !ci->stop_codec)
239 ci->sleep(1); 239 ci->sleep(1);
240
241 codec_set_replaygain(ci->id3);
240 242
241 /* Need to save offset for later use (cleared indirectly by advance_buffer) */ 243 /* Need to save offset for later use (cleared indirectly by advance_buffer) */
242 bytesdone = ci->id3->offset; 244 bytesdone = ci->id3->offset;
diff --git a/apps/dsp.c b/apps/dsp.c
index f306069a87..f10bdfe2a6 100644
--- a/apps/dsp.c
+++ b/apps/dsp.c
@@ -1200,11 +1200,14 @@ bool dsp_configure(int setting, intptr_t value)
1200 void set_gain_var(long *var, long value) 1200 void set_gain_var(long *var, long value)
1201 { 1201 {
1202 /* Voice shouldn't mess with these */ 1202 /* Voice shouldn't mess with these */
1203 if (dsp != audio_dsp) 1203 if (dsp == audio_dsp)
1204 return; 1204 {
1205 1205 *var = value;
1206 *var = value; 1206 /* In case current gain is zero, force at least one call
1207 new_gain = true; 1207 to apply_gain or apply_gain won't pick up on new_gain */
1208 audio_dsp->gain = -1;
1209 new_gain = true;
1210 }
1208 } 1211 }
1209 1212
1210 void update_functions(void) 1213 void update_functions(void)