summaryrefslogtreecommitdiff
path: root/firmware/pcm.c
diff options
context:
space:
mode:
authorMichael Sevakis <jethead71@rockbox.org>2010-06-26 10:07:17 +0000
committerMichael Sevakis <jethead71@rockbox.org>2010-06-26 10:07:17 +0000
commitb15a523870d6aa45b38b92547053beb986b92d9a (patch)
tree8b75fe5f13a3418186cb11c01062ad415490036b /firmware/pcm.c
parentac622c6d673c708d48527db8a189401422a5d03c (diff)
downloadrockbox-b15a523870d6aa45b38b92547053beb986b92d9a.tar.gz
rockbox-b15a523870d6aa45b38b92547053beb986b92d9a.zip
e200v1/c200v1: Implement limited samplerate switching. Rates 24kHz and below are being a bear as far as minor crackling at higher amplitude-- leave them out for the time being since no solution is currently evident. 48, 44, 32 (rec rates 24, 22, 16) seem perfectly fine. I'm betting c200 is ok to include because it uses the same setup as e200.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27139 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/pcm.c')
-rw-r--r--firmware/pcm.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/firmware/pcm.c b/firmware/pcm.c
index 8080823077..72fe23cb16 100644
--- a/firmware/pcm.c
+++ b/firmware/pcm.c
@@ -361,8 +361,24 @@ void pcm_set_frequency(unsigned int samplerate)
361{ 361{
362 logf("pcm_set_frequency"); 362 logf("pcm_set_frequency");
363 363
364 int index = round_value_to_list32(samplerate, hw_freq_sampr, 364 int index;
365 HW_NUM_FREQ, false); 365
366#ifdef CONFIG_SAMPR_TYPES
367 unsigned int type = samplerate & SAMPR_TYPE_MASK;
368 samplerate &= ~SAMPR_TYPE_MASK;
369
370#ifdef SAMPR_TYPE_REC
371 /* For now, supported targets have direct conversion when configured with
372 * CONFIG_SAMPR_TYPES.
373 * Some hypothetical target with independent rates would need slightly
374 * different handling throughout this source. */
375 if (type == SAMPR_TYPE_REC)
376 samplerate = pcm_sampr_type_rec_to_play(samplerate);
377#endif
378#endif /* CONFIG_SAMPR_TYPES */
379
380 index = round_value_to_list32(samplerate, hw_freq_sampr,
381 HW_NUM_FREQ, false);
366 382
367 if (samplerate != hw_freq_sampr[index]) 383 if (samplerate != hw_freq_sampr[index])
368 index = HW_FREQ_DEFAULT; /* Invalid = default */ 384 index = HW_FREQ_DEFAULT; /* Invalid = default */