From 99a0598c284471342fcda1fdcba90d4b666bfbb3 Mon Sep 17 00:00:00 2001 From: Jens Arnold Date: Mon, 29 Aug 2005 20:07:17 +0000 Subject: Major peakmeter rework: * Changed set/get functions for dbfs mode to bool type. * Removed performance setting, leaving (slightly adapted) high performance mode only. * Refresh rate is always 20 Hz now. * Readout doesn't do an extra (hidden) peek, should allow for slightly better clip detection. * Brought back high performance peakmeter for recording. Peakmeter stops hogging the CPU when the disk is spinning; this is enough to avoid the performance problem when saving data. * Optimisations, code cleanup and code policeing. * (iriver) Reduced CPU load of peakmeter by not calculating excessive overlaps. ** Bumped config block version, so save your settings before upgrading. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@7415 a1c6a512-1295-4272-9138-f99709370657 --- firmware/pcm_playback.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'firmware/pcm_playback.c') diff --git a/firmware/pcm_playback.c b/firmware/pcm_playback.c index f75ec69857..5597f69bdb 100644 --- a/firmware/pcm_playback.c +++ b/firmware/pcm_playback.c @@ -99,15 +99,15 @@ static void dma_stop(void) /* * This function goes directly into the DMA buffer to calculate the left and - * right peak values. To avoid missing peaks it tries to look forward a full - * refresh period (1/20 sec) although it's always possible that the entire - * period will not be visible. To reduce CPU load it only looks at every - * third sample, and this can be reduced even further if needed (even every - * tenth sample would still be pretty accurate). + * right peak values. To avoid missing peaks it tries to look forward two full + * peek periods (2/HZ sec, 100% overlap), although it's always possible that + * the entire period will not be visible. To reduce CPU load it only looks at + * every third sample, and this can be reduced even further if needed (even + * every tenth sample would still be pretty accurate). */ -#define PEAK_SAMPLES 2205 /* 44100 sample rate / 20 Hz refresh */ -#define PEAK_STRIDE 3 /* every 3rd sample is plenty... */ +#define PEAK_SAMPLES (44100*2/HZ) /* 44100 samples * 2 / 100 Hz tick */ +#define PEAK_STRIDE 3 /* every 3rd sample is plenty... */ void pcm_calculate_peaks(int *left, int *right) { -- cgit v1.2.3