summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Sevakis <jethead71@rockbox.org>2006-11-26 12:02:47 +0000
committerMichael Sevakis <jethead71@rockbox.org>2006-11-26 12:02:47 +0000
commitbbef13eddfefffa1fbcf82185ed73c04a18d22eb (patch)
treebf7d8a684d5031851185498db8388f60a29be662
parent4049d44b03d4a17cbf2f48f5f1360ac397da5ef5 (diff)
downloadrockbox-bbef13eddfefffa1fbcf82185ed73c04a18d22eb.tar.gz
rockbox-bbef13eddfefffa1fbcf82185ed73c04a18d22eb.zip
SWCODEC: Stop clicks between tracks when resampler is active by only switching the DSP frequency and not resetting the resampler at track boundaries. Will make sure DSP is correctly flushed at dicontinuities but don't hear any problems currently.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11600 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/codecs/a52.c2
-rw-r--r--apps/codecs/aac.c2
-rw-r--r--apps/codecs/adx.c2
-rw-r--r--apps/codecs/aiff.c4
-rw-r--r--apps/codecs/alac.c2
-rw-r--r--apps/codecs/flac.c2
-rw-r--r--apps/codecs/mpa.c2
-rw-r--r--apps/codecs/mpc.c2
-rw-r--r--apps/codecs/shorten.c2
-rw-r--r--apps/codecs/sid.c2
-rw-r--r--apps/codecs/vorbis.c2
-rw-r--r--apps/codecs/wav.c2
-rw-r--r--apps/codecs/wavpack.c2
-rw-r--r--apps/dsp.c6
-rw-r--r--apps/dsp.h1
-rw-r--r--apps/playback.c3
16 files changed, 23 insertions, 15 deletions
diff --git a/apps/codecs/a52.c b/apps/codecs/a52.c
index 3d0c35d7f7..b7190be71b 100644
--- a/apps/codecs/a52.c
+++ b/apps/codecs/a52.c
@@ -154,7 +154,7 @@ next_track:
154 while (!ci->taginfo_ready) 154 while (!ci->taginfo_ready)
155 ci->yield(); 155 ci->yield();
156 156
157 ci->configure(DSP_SET_FREQUENCY, (long *)(ci->id3->frequency)); 157 ci->configure(DSP_SWITCH_FREQUENCY, (long *)(ci->id3->frequency));
158 158
159 /* Intialise the A52 decoder and check for success */ 159 /* Intialise the A52 decoder and check for success */
160 state = a52_init(0); 160 state = a52_init(0);
diff --git a/apps/codecs/aac.c b/apps/codecs/aac.c
index a2248c6437..3c9a6372e9 100644
--- a/apps/codecs/aac.c
+++ b/apps/codecs/aac.c
@@ -90,7 +90,7 @@ next_track:
90 90
91 sound_samples_done = ci->id3->offset; 91 sound_samples_done = ci->id3->offset;
92 92
93 ci->configure(DSP_SET_FREQUENCY, (long *)(rb->id3->frequency)); 93 ci->configure(DSP_SWITCH_FREQUENCY, (long *)(rb->id3->frequency));
94 codec_set_replaygain(rb->id3); 94 codec_set_replaygain(rb->id3);
95 95
96 stream_create(&input_stream,ci); 96 stream_create(&input_stream,ci);
diff --git a/apps/codecs/adx.c b/apps/codecs/adx.c
index 902f3ce06b..803600b23e 100644
--- a/apps/codecs/adx.c
+++ b/apps/codecs/adx.c
@@ -161,7 +161,7 @@ next_track:
161 bufoff = chanstart; 161 bufoff = chanstart;
162 162
163 /* setup pcm buffer format */ 163 /* setup pcm buffer format */
164 ci->configure(DSP_SET_FREQUENCY, (long *)(ci->id3->frequency)); 164 ci->configure(DSP_SWITCH_FREQUENCY, (long *)(ci->id3->frequency));
165 if (channels == 2) { 165 if (channels == 2) {
166 ci->configure(DSP_SET_STEREO_MODE, (long *)STEREO_INTERLEAVED); 166 ci->configure(DSP_SET_STEREO_MODE, (long *)STEREO_INTERLEAVED);
167 } else if (channels == 1) { 167 } else if (channels == 1) {
diff --git a/apps/codecs/aiff.c b/apps/codecs/aiff.c
index 6ca03f1b26..479d405c41 100644
--- a/apps/codecs/aiff.c
+++ b/apps/codecs/aiff.c
@@ -81,6 +81,7 @@ enum codec_status codec_start(struct codec_api *api)
81 ci->memset(iedata, 0, iend - iedata); 81 ci->memset(iedata, 0, iend - iedata);
82#endif 82#endif
83 83
84 ci->configure(DSP_SET_SAMPLE_DEPTH, (long *)28);
84 ci->configure(CODEC_SET_FILEBUF_WATERMARK, (int *)(1024*512)); 85 ci->configure(CODEC_SET_FILEBUF_WATERMARK, (int *)(1024*512));
85 ci->configure(CODEC_SET_FILEBUF_CHUNKSIZE, (int *)(1024*256)); 86 ci->configure(CODEC_SET_FILEBUF_CHUNKSIZE, (int *)(1024*256));
86 87
@@ -182,8 +183,7 @@ next_track:
182 goto done; 183 goto done;
183 } 184 }
184 185
185 ci->configure(DSP_SET_FREQUENCY, (long *)(ci->id3->frequency)); 186 ci->configure(DSP_SWITCH_FREQUENCY, (long *)(ci->id3->frequency));
186 ci->configure(DSP_SET_SAMPLE_DEPTH, (long *)28);
187 187
188 if (num_channels == 2) { 188 if (num_channels == 2) {
189 ci->configure(DSP_SET_STEREO_MODE, (int *)STEREO_INTERLEAVED); 189 ci->configure(DSP_SET_STEREO_MODE, (int *)STEREO_INTERLEAVED);
diff --git a/apps/codecs/alac.c b/apps/codecs/alac.c
index d65cdb7129..13423f4804 100644
--- a/apps/codecs/alac.c
+++ b/apps/codecs/alac.c
@@ -78,7 +78,7 @@ enum codec_status codec_start(struct codec_api* api)
78 while (!*ci->taginfo_ready && !ci->stop_codec) 78 while (!*ci->taginfo_ready && !ci->stop_codec)
79 ci->sleep(1); 79 ci->sleep(1);
80 80
81 ci->configure(DSP_SET_FREQUENCY, (long *)(rb->id3->frequency)); 81 ci->configure(DSP_SWITCH_FREQUENCY, (long *)(rb->id3->frequency));
82 codec_set_replaygain(rb->id3); 82 codec_set_replaygain(rb->id3);
83 83
84 stream_create(&input_stream,ci); 84 stream_create(&input_stream,ci);
diff --git a/apps/codecs/flac.c b/apps/codecs/flac.c
index 9f2405f4f2..4f5f0b1eaa 100644
--- a/apps/codecs/flac.c
+++ b/apps/codecs/flac.c
@@ -470,7 +470,7 @@ enum codec_status codec_start(struct codec_api* api)
470 while (!*ci->taginfo_ready && !ci->stop_codec) 470 while (!*ci->taginfo_ready && !ci->stop_codec)
471 ci->sleep(1); 471 ci->sleep(1);
472 472
473 ci->configure(DSP_SET_FREQUENCY, (long *)(ci->id3->frequency)); 473 ci->configure(DSP_SWITCH_FREQUENCY, (long *)(ci->id3->frequency));
474 codec_set_replaygain(ci->id3); 474 codec_set_replaygain(ci->id3);
475 475
476 if (samplesdone) { 476 if (samplesdone) {
diff --git a/apps/codecs/mpa.c b/apps/codecs/mpa.c
index ff6090e189..94947a9d1c 100644
--- a/apps/codecs/mpa.c
+++ b/apps/codecs/mpa.c
@@ -110,7 +110,7 @@ next_track:
110 while (!*ci->taginfo_ready && !ci->stop_codec) 110 while (!*ci->taginfo_ready && !ci->stop_codec)
111 ci->sleep(1); 111 ci->sleep(1);
112 112
113 ci->configure(DSP_SET_FREQUENCY, (int *)ci->id3->frequency); 113 ci->configure(DSP_SWITCH_FREQUENCY, (int *)ci->id3->frequency);
114 current_frequency = ci->id3->frequency; 114 current_frequency = ci->id3->frequency;
115 codec_set_replaygain(ci->id3); 115 codec_set_replaygain(ci->id3);
116 116
diff --git a/apps/codecs/mpc.c b/apps/codecs/mpc.c
index 821b3ce25e..ad38185fe0 100644
--- a/apps/codecs/mpc.c
+++ b/apps/codecs/mpc.c
@@ -121,7 +121,7 @@ next_track:
121 goto done; 121 goto done;
122 } 122 }
123 frequency = info.sample_freq / 1000; 123 frequency = info.sample_freq / 1000;
124 ci->configure(DSP_SET_FREQUENCY, (long *)(long)info.sample_freq); 124 ci->configure(DSP_SWITCH_FREQUENCY, (long *)(long)info.sample_freq);
125 125
126 /* set playback engine up for correct number of channels */ 126 /* set playback engine up for correct number of channels */
127 /* NOTE: current musepack format only allows for stereo files 127 /* NOTE: current musepack format only allows for stereo files
diff --git a/apps/codecs/shorten.c b/apps/codecs/shorten.c
index a7fc601ae5..b48a91ea17 100644
--- a/apps/codecs/shorten.c
+++ b/apps/codecs/shorten.c
@@ -98,7 +98,7 @@ next_track:
98 } 98 }
99 99
100 ci->id3->frequency = sc.sample_rate; 100 ci->id3->frequency = sc.sample_rate;
101 ci->configure(DSP_SET_FREQUENCY, (long *)(long)(sc.sample_rate)); 101 ci->configure(DSP_SWITCH_FREQUENCY, (long *)(long)(sc.sample_rate));
102 102
103 if (sc.sample_rate) { 103 if (sc.sample_rate) {
104 ci->id3->length = (sc.totalsamples / sc.sample_rate) * 1000; 104 ci->id3->length = (sc.totalsamples / sc.sample_rate) * 1000;
diff --git a/apps/codecs/sid.c b/apps/codecs/sid.c
index c95e44b426..d356da7fee 100644
--- a/apps/codecs/sid.c
+++ b/apps/codecs/sid.c
@@ -1267,7 +1267,7 @@ next_track:
1267 1267
1268 1268
1269 /* Make use of 44.1khz */ 1269 /* Make use of 44.1khz */
1270 ci->configure(DSP_SET_FREQUENCY, (long *)44100); 1270 ci->configure(DSP_SWITCH_FREQUENCY, (long *)44100);
1271 /* Sample depth is 28 bit host endian */ 1271 /* Sample depth is 28 bit host endian */
1272 ci->configure(DSP_SET_SAMPLE_DEPTH, (long *)28); 1272 ci->configure(DSP_SET_SAMPLE_DEPTH, (long *)28);
1273 /* Mono output */ 1273 /* Mono output */
diff --git a/apps/codecs/vorbis.c b/apps/codecs/vorbis.c
index 0475572f19..d08cb0e90d 100644
--- a/apps/codecs/vorbis.c
+++ b/apps/codecs/vorbis.c
@@ -85,7 +85,7 @@ bool vorbis_set_codec_parameters(OggVorbis_File *vf)
85 return false; 85 return false;
86 } 86 }
87 87
88 rb->configure(DSP_SET_FREQUENCY, (int *)rb->id3->frequency); 88 rb->configure(DSP_SWITCH_FREQUENCY, (int *)rb->id3->frequency);
89 codec_set_replaygain(rb->id3); 89 codec_set_replaygain(rb->id3);
90 90
91 if (vi->channels == 2) { 91 if (vi->channels == 2) {
diff --git a/apps/codecs/wav.c b/apps/codecs/wav.c
index ba99b94616..9add1f512a 100644
--- a/apps/codecs/wav.c
+++ b/apps/codecs/wav.c
@@ -397,7 +397,7 @@ next_track:
397 goto done; 397 goto done;
398 } 398 }
399 399
400 ci->configure(DSP_SET_FREQUENCY, (long *)(ci->id3->frequency)); 400 ci->configure(DSP_SWITCH_FREQUENCY, (long *)(ci->id3->frequency));
401 if (channels == 2) { 401 if (channels == 2) {
402 ci->configure(DSP_SET_STEREO_MODE, (long *)STEREO_INTERLEAVED); 402 ci->configure(DSP_SET_STEREO_MODE, (long *)STEREO_INTERLEAVED);
403 } else if (channels == 1) { 403 } else if (channels == 1) {
diff --git a/apps/codecs/wavpack.c b/apps/codecs/wavpack.c
index de815e6b01..65280535e6 100644
--- a/apps/codecs/wavpack.c
+++ b/apps/codecs/wavpack.c
@@ -74,7 +74,7 @@ enum codec_status codec_start(struct codec_api* api)
74 while (!*ci->taginfo_ready && !ci->stop_codec) 74 while (!*ci->taginfo_ready && !ci->stop_codec)
75 ci->sleep(1); 75 ci->sleep(1);
76 76
77 ci->configure(DSP_SET_FREQUENCY, (long *)(ci->id3->frequency)); 77 ci->configure(DSP_SWITCH_FREQUENCY, (long *)(ci->id3->frequency));
78 codec_set_replaygain(ci->id3); 78 codec_set_replaygain(ci->id3);
79 79
80 /* Create a decoder instance */ 80 /* Create a decoder instance */
diff --git a/apps/dsp.c b/apps/dsp.c
index c6d669b16a..b59c391de0 100644
--- a/apps/dsp.c
+++ b/apps/dsp.c
@@ -1055,6 +1055,12 @@ bool dsp_configure(int setting, void *value)
1055 dsp->new_gain = true; 1055 dsp->new_gain = true;
1056 break; 1056 break;
1057 1057
1058 case DSP_FLUSH:
1059 memset(&resample_data[current_codec], 0,
1060 sizeof (struct resample_data));
1061 dither_init();
1062 break;
1063
1058 case DSP_SET_TRACK_GAIN: 1064 case DSP_SET_TRACK_GAIN:
1059 dsp->track_gain = (long) value; 1065 dsp->track_gain = (long) value;
1060 dsp->new_gain = true; 1066 dsp->new_gain = true;
diff --git a/apps/dsp.h b/apps/dsp.h
index 965eb28c5f..1a2b8782f3 100644
--- a/apps/dsp.h
+++ b/apps/dsp.h
@@ -39,6 +39,7 @@ enum {
39 DSP_SET_SAMPLE_DEPTH, 39 DSP_SET_SAMPLE_DEPTH,
40 DSP_SET_STEREO_MODE, 40 DSP_SET_STEREO_MODE,
41 DSP_RESET, 41 DSP_RESET,
42 DSP_FLUSH,
42 DSP_SET_TRACK_GAIN, 43 DSP_SET_TRACK_GAIN,
43 DSP_SET_ALBUM_GAIN, 44 DSP_SET_ALBUM_GAIN,
44 DSP_SET_TRACK_PEAK, 45 DSP_SET_TRACK_PEAK,
diff --git a/apps/playback.c b/apps/playback.c
index 2b08a99a8a..90cedc0299 100644
--- a/apps/playback.c
+++ b/apps/playback.c
@@ -1679,7 +1679,8 @@ static void codec_seek_complete_callback(void)
1679 { 1679 {
1680 /* If this is not a seamless seek, clear the buffer */ 1680 /* If this is not a seamless seek, clear the buffer */
1681 pcmbuf_play_stop(); 1681 pcmbuf_play_stop();
1682 1682 dsp_configure(DSP_FLUSH, NULL);
1683
1683 /* If playback was not 'deliberately' paused, unpause now */ 1684 /* If playback was not 'deliberately' paused, unpause now */
1684 if (!paused) 1685 if (!paused)
1685 pcmbuf_pause(false); 1686 pcmbuf_pause(false);