summaryrefslogtreecommitdiffstats
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:
while (!ci->taginfo_ready)
ci->yield();
- ci->configure(DSP_SET_FREQUENCY, (long *)(ci->id3->frequency));
+ ci->configure(DSP_SWITCH_FREQUENCY, (long *)(ci->id3->frequency));
/* Intialise the A52 decoder and check for success */
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:
sound_samples_done = ci->id3->offset;
- ci->configure(DSP_SET_FREQUENCY, (long *)(rb->id3->frequency));
+ ci->configure(DSP_SWITCH_FREQUENCY, (long *)(rb->id3->frequency));
codec_set_replaygain(rb->id3);
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:
bufoff = chanstart;
/* setup pcm buffer format */
- ci->configure(DSP_SET_FREQUENCY, (long *)(ci->id3->frequency));
+ ci->configure(DSP_SWITCH_FREQUENCY, (long *)(ci->id3->frequency));
if (channels == 2) {
ci->configure(DSP_SET_STEREO_MODE, (long *)STEREO_INTERLEAVED);
} 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)
ci->memset(iedata, 0, iend - iedata);
#endif
+ ci->configure(DSP_SET_SAMPLE_DEPTH, (long *)28);
ci->configure(CODEC_SET_FILEBUF_WATERMARK, (int *)(1024*512));
ci->configure(CODEC_SET_FILEBUF_CHUNKSIZE, (int *)(1024*256));
@@ -182,8 +183,7 @@ next_track:
goto done;
}
- ci->configure(DSP_SET_FREQUENCY, (long *)(ci->id3->frequency));
- ci->configure(DSP_SET_SAMPLE_DEPTH, (long *)28);
+ ci->configure(DSP_SWITCH_FREQUENCY, (long *)(ci->id3->frequency));
if (num_channels == 2) {
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)
while (!*ci->taginfo_ready && !ci->stop_codec)
ci->sleep(1);
- ci->configure(DSP_SET_FREQUENCY, (long *)(rb->id3->frequency));
+ ci->configure(DSP_SWITCH_FREQUENCY, (long *)(rb->id3->frequency));
codec_set_replaygain(rb->id3);
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)
while (!*ci->taginfo_ready && !ci->stop_codec)
ci->sleep(1);
- ci->configure(DSP_SET_FREQUENCY, (long *)(ci->id3->frequency));
+ ci->configure(DSP_SWITCH_FREQUENCY, (long *)(ci->id3->frequency));
codec_set_replaygain(ci->id3);
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:
while (!*ci->taginfo_ready && !ci->stop_codec)
ci->sleep(1);
- ci->configure(DSP_SET_FREQUENCY, (int *)ci->id3->frequency);
+ ci->configure(DSP_SWITCH_FREQUENCY, (int *)ci->id3->frequency);
current_frequency = ci->id3->frequency;
codec_set_replaygain(ci->id3);
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:
goto done;
}
frequency = info.sample_freq / 1000;
- ci->configure(DSP_SET_FREQUENCY, (long *)(long)info.sample_freq);
+ ci->configure(DSP_SWITCH_FREQUENCY, (long *)(long)info.sample_freq);
/* set playback engine up for correct number of channels */
/* 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:
}
ci->id3->frequency = sc.sample_rate;
- ci->configure(DSP_SET_FREQUENCY, (long *)(long)(sc.sample_rate));
+ ci->configure(DSP_SWITCH_FREQUENCY, (long *)(long)(sc.sample_rate));
if (sc.sample_rate) {
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:
/* Make use of 44.1khz */
- ci->configure(DSP_SET_FREQUENCY, (long *)44100);
+ ci->configure(DSP_SWITCH_FREQUENCY, (long *)44100);
/* Sample depth is 28 bit host endian */
ci->configure(DSP_SET_SAMPLE_DEPTH, (long *)28);
/* 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)
return false;
}
- rb->configure(DSP_SET_FREQUENCY, (int *)rb->id3->frequency);
+ rb->configure(DSP_SWITCH_FREQUENCY, (int *)rb->id3->frequency);
codec_set_replaygain(rb->id3);
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:
goto done;
}
- ci->configure(DSP_SET_FREQUENCY, (long *)(ci->id3->frequency));
+ ci->configure(DSP_SWITCH_FREQUENCY, (long *)(ci->id3->frequency));
if (channels == 2) {
ci->configure(DSP_SET_STEREO_MODE, (long *)STEREO_INTERLEAVED);
} 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)
while (!*ci->taginfo_ready && !ci->stop_codec)
ci->sleep(1);
- ci->configure(DSP_SET_FREQUENCY, (long *)(ci->id3->frequency));
+ ci->configure(DSP_SWITCH_FREQUENCY, (long *)(ci->id3->frequency));
codec_set_replaygain(ci->id3);
/* 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)
dsp->new_gain = true;
break;
+ case DSP_FLUSH:
+ memset(&resample_data[current_codec], 0,
+ sizeof (struct resample_data));
+ dither_init();
+ break;
+
case DSP_SET_TRACK_GAIN:
dsp->track_gain = (long) value;
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 {
DSP_SET_SAMPLE_DEPTH,
DSP_SET_STEREO_MODE,
DSP_RESET,
+ DSP_FLUSH,
DSP_SET_TRACK_GAIN,
DSP_SET_ALBUM_GAIN,
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)
{
/* If this is not a seamless seek, clear the buffer */
pcmbuf_play_stop();
-
+ dsp_configure(DSP_FLUSH, NULL);
+
/* If playback was not 'deliberately' paused, unpause now */
if (!paused)
pcmbuf_pause(false);