forked from len0rd/rockbox
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
This commit is contained in:
parent
4049d44b03
commit
bbef13eddf
16 changed files with 23 additions and 15 deletions
|
@ -154,7 +154,7 @@ next_track:
|
||||||
while (!ci->taginfo_ready)
|
while (!ci->taginfo_ready)
|
||||||
ci->yield();
|
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 */
|
/* Intialise the A52 decoder and check for success */
|
||||||
state = a52_init(0);
|
state = a52_init(0);
|
||||||
|
|
|
@ -90,7 +90,7 @@ next_track:
|
||||||
|
|
||||||
sound_samples_done = ci->id3->offset;
|
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);
|
codec_set_replaygain(rb->id3);
|
||||||
|
|
||||||
stream_create(&input_stream,ci);
|
stream_create(&input_stream,ci);
|
||||||
|
|
|
@ -161,7 +161,7 @@ next_track:
|
||||||
bufoff = chanstart;
|
bufoff = chanstart;
|
||||||
|
|
||||||
/* setup pcm buffer format */
|
/* 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) {
|
if (channels == 2) {
|
||||||
ci->configure(DSP_SET_STEREO_MODE, (long *)STEREO_INTERLEAVED);
|
ci->configure(DSP_SET_STEREO_MODE, (long *)STEREO_INTERLEAVED);
|
||||||
} else if (channels == 1) {
|
} else if (channels == 1) {
|
||||||
|
|
|
@ -81,6 +81,7 @@ enum codec_status codec_start(struct codec_api *api)
|
||||||
ci->memset(iedata, 0, iend - iedata);
|
ci->memset(iedata, 0, iend - iedata);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
ci->configure(DSP_SET_SAMPLE_DEPTH, (long *)28);
|
||||||
ci->configure(CODEC_SET_FILEBUF_WATERMARK, (int *)(1024*512));
|
ci->configure(CODEC_SET_FILEBUF_WATERMARK, (int *)(1024*512));
|
||||||
ci->configure(CODEC_SET_FILEBUF_CHUNKSIZE, (int *)(1024*256));
|
ci->configure(CODEC_SET_FILEBUF_CHUNKSIZE, (int *)(1024*256));
|
||||||
|
|
||||||
|
@ -182,8 +183,7 @@ next_track:
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
ci->configure(DSP_SET_FREQUENCY, (long *)(ci->id3->frequency));
|
ci->configure(DSP_SWITCH_FREQUENCY, (long *)(ci->id3->frequency));
|
||||||
ci->configure(DSP_SET_SAMPLE_DEPTH, (long *)28);
|
|
||||||
|
|
||||||
if (num_channels == 2) {
|
if (num_channels == 2) {
|
||||||
ci->configure(DSP_SET_STEREO_MODE, (int *)STEREO_INTERLEAVED);
|
ci->configure(DSP_SET_STEREO_MODE, (int *)STEREO_INTERLEAVED);
|
||||||
|
|
|
@ -78,7 +78,7 @@ enum codec_status codec_start(struct codec_api* api)
|
||||||
while (!*ci->taginfo_ready && !ci->stop_codec)
|
while (!*ci->taginfo_ready && !ci->stop_codec)
|
||||||
ci->sleep(1);
|
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);
|
codec_set_replaygain(rb->id3);
|
||||||
|
|
||||||
stream_create(&input_stream,ci);
|
stream_create(&input_stream,ci);
|
||||||
|
|
|
@ -470,7 +470,7 @@ enum codec_status codec_start(struct codec_api* api)
|
||||||
while (!*ci->taginfo_ready && !ci->stop_codec)
|
while (!*ci->taginfo_ready && !ci->stop_codec)
|
||||||
ci->sleep(1);
|
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);
|
codec_set_replaygain(ci->id3);
|
||||||
|
|
||||||
if (samplesdone) {
|
if (samplesdone) {
|
||||||
|
|
|
@ -110,7 +110,7 @@ next_track:
|
||||||
while (!*ci->taginfo_ready && !ci->stop_codec)
|
while (!*ci->taginfo_ready && !ci->stop_codec)
|
||||||
ci->sleep(1);
|
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;
|
current_frequency = ci->id3->frequency;
|
||||||
codec_set_replaygain(ci->id3);
|
codec_set_replaygain(ci->id3);
|
||||||
|
|
||||||
|
|
|
@ -121,7 +121,7 @@ next_track:
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
frequency = info.sample_freq / 1000;
|
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 */
|
/* set playback engine up for correct number of channels */
|
||||||
/* NOTE: current musepack format only allows for stereo files
|
/* NOTE: current musepack format only allows for stereo files
|
||||||
|
|
|
@ -98,7 +98,7 @@ next_track:
|
||||||
}
|
}
|
||||||
|
|
||||||
ci->id3->frequency = sc.sample_rate;
|
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) {
|
if (sc.sample_rate) {
|
||||||
ci->id3->length = (sc.totalsamples / sc.sample_rate) * 1000;
|
ci->id3->length = (sc.totalsamples / sc.sample_rate) * 1000;
|
||||||
|
|
|
@ -1267,7 +1267,7 @@ next_track:
|
||||||
|
|
||||||
|
|
||||||
/* Make use of 44.1khz */
|
/* 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 */
|
/* Sample depth is 28 bit host endian */
|
||||||
ci->configure(DSP_SET_SAMPLE_DEPTH, (long *)28);
|
ci->configure(DSP_SET_SAMPLE_DEPTH, (long *)28);
|
||||||
/* Mono output */
|
/* Mono output */
|
||||||
|
|
|
@ -85,7 +85,7 @@ bool vorbis_set_codec_parameters(OggVorbis_File *vf)
|
||||||
return false;
|
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);
|
codec_set_replaygain(rb->id3);
|
||||||
|
|
||||||
if (vi->channels == 2) {
|
if (vi->channels == 2) {
|
||||||
|
|
|
@ -397,7 +397,7 @@ next_track:
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
ci->configure(DSP_SET_FREQUENCY, (long *)(ci->id3->frequency));
|
ci->configure(DSP_SWITCH_FREQUENCY, (long *)(ci->id3->frequency));
|
||||||
if (channels == 2) {
|
if (channels == 2) {
|
||||||
ci->configure(DSP_SET_STEREO_MODE, (long *)STEREO_INTERLEAVED);
|
ci->configure(DSP_SET_STEREO_MODE, (long *)STEREO_INTERLEAVED);
|
||||||
} else if (channels == 1) {
|
} else if (channels == 1) {
|
||||||
|
|
|
@ -74,7 +74,7 @@ enum codec_status codec_start(struct codec_api* api)
|
||||||
while (!*ci->taginfo_ready && !ci->stop_codec)
|
while (!*ci->taginfo_ready && !ci->stop_codec)
|
||||||
ci->sleep(1);
|
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);
|
codec_set_replaygain(ci->id3);
|
||||||
|
|
||||||
/* Create a decoder instance */
|
/* Create a decoder instance */
|
||||||
|
|
|
@ -1055,6 +1055,12 @@ bool dsp_configure(int setting, void *value)
|
||||||
dsp->new_gain = true;
|
dsp->new_gain = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case DSP_FLUSH:
|
||||||
|
memset(&resample_data[current_codec], 0,
|
||||||
|
sizeof (struct resample_data));
|
||||||
|
dither_init();
|
||||||
|
break;
|
||||||
|
|
||||||
case DSP_SET_TRACK_GAIN:
|
case DSP_SET_TRACK_GAIN:
|
||||||
dsp->track_gain = (long) value;
|
dsp->track_gain = (long) value;
|
||||||
dsp->new_gain = true;
|
dsp->new_gain = true;
|
||||||
|
|
|
@ -39,6 +39,7 @@ enum {
|
||||||
DSP_SET_SAMPLE_DEPTH,
|
DSP_SET_SAMPLE_DEPTH,
|
||||||
DSP_SET_STEREO_MODE,
|
DSP_SET_STEREO_MODE,
|
||||||
DSP_RESET,
|
DSP_RESET,
|
||||||
|
DSP_FLUSH,
|
||||||
DSP_SET_TRACK_GAIN,
|
DSP_SET_TRACK_GAIN,
|
||||||
DSP_SET_ALBUM_GAIN,
|
DSP_SET_ALBUM_GAIN,
|
||||||
DSP_SET_TRACK_PEAK,
|
DSP_SET_TRACK_PEAK,
|
||||||
|
|
|
@ -1679,6 +1679,7 @@ static void codec_seek_complete_callback(void)
|
||||||
{
|
{
|
||||||
/* If this is not a seamless seek, clear the buffer */
|
/* If this is not a seamless seek, clear the buffer */
|
||||||
pcmbuf_play_stop();
|
pcmbuf_play_stop();
|
||||||
|
dsp_configure(DSP_FLUSH, NULL);
|
||||||
|
|
||||||
/* If playback was not 'deliberately' paused, unpause now */
|
/* If playback was not 'deliberately' paused, unpause now */
|
||||||
if (!paused)
|
if (!paused)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue