From be90f74e89978224a169c793d4e688867dc38b41 Mon Sep 17 00:00:00 2001 From: Peter D'Hoye Date: Wed, 3 Mar 2010 22:16:08 +0000 Subject: Histogram display on recording screen. Based on the work of Jvo Studer in FS #5021 but reduced and reworked since the recording screen code changed quite a bit since his patch. For now enabled on iriver h1x0 and h3x0 only. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25007 a1c6a512-1295-4272-9138-f99709370657 --- apps/recorder/peakmeter.c | 36 ++++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 16 deletions(-) (limited to 'apps/recorder/peakmeter.c') diff --git a/apps/recorder/peakmeter.c b/apps/recorder/peakmeter.c index fc68ce4267..8f32a837a7 100644 --- a/apps/recorder/peakmeter.c +++ b/apps/recorder/peakmeter.c @@ -66,7 +66,7 @@ static int pm_cur_left; /* current values (last peak_meter_peek) */ static int pm_cur_right; static int pm_max_left; /* maximum values between peak meter draws */ static int pm_max_right; -#ifdef HAVE_AGC +#if defined(HAVE_AGC) || defined(HAVE_RECORDING_HISTOGRAM) static int pm_peakhold_left; /* max. peak values between peakhold calls */ static int pm_peakhold_right; /* used for AGC and histogram display */ #endif @@ -799,9 +799,16 @@ static int peak_meter_read_l(void) { /* pm_max_left contains the maximum of all peak values that were read by peak_meter_peek since the last call of peak_meter_read_l */ - int retval = pm_max_left; + int retval; + +#if defined(SIMULATOR) && (CONFIG_CODEC != SWCODEC) + srand(current_tick); + pm_max_left = rand()%MAX_PEAK; +#endif -#ifdef HAVE_AGC + retval = pm_max_left; + +#if defined(HAVE_RECORDING_HISTOGRAM) || defined(HAVE_AGC) /* store max peak value for peak_meter_get_peakhold_x readout */ pm_peakhold_left = MAX(pm_max_left, pm_peakhold_left); #endif @@ -812,11 +819,6 @@ static int peak_meter_read_l(void) get fooled by an old maximum value */ pm_max_left = pm_cur_left; -#if defined(SIMULATOR) && (CONFIG_CODEC != SWCODEC) - srand(current_tick); - retval = rand()%MAX_PEAK; -#endif - return retval; } @@ -830,9 +832,16 @@ static int peak_meter_read_r(void) { /* peak_meter_r contains the maximum of all peak values that were read by peak_meter_peek since the last call of peak_meter_read_r */ - int retval = pm_max_right; + int retval; + +#if defined(SIMULATOR) && (CONFIG_CODEC != SWCODEC) + srand(current_tick); + pm_max_right = rand()%MAX_PEAK; +#endif -#ifdef HAVE_AGC + retval = pm_max_right; + +#if defined(HAVE_RECORDING_HISTOGRAM) || defined(HAVE_AGC) /* store max peak value for peak_meter_get_peakhold_x readout */ pm_peakhold_right = MAX(pm_max_right, pm_peakhold_right); #endif @@ -843,15 +852,10 @@ static int peak_meter_read_r(void) get fooled by an old maximum value */ pm_max_right = pm_cur_right; -#if defined(SIMULATOR) && (CONFIG_CODEC != SWCODEC) - srand(current_tick); - retval = rand()%MAX_PEAK; -#endif - return retval; } -#ifdef HAVE_AGC +#if defined(HAVE_AGC) || defined(HAVE_RECORDING_HISTOGRAM) /** * Reads out the current peak-hold values since the last call. * This is used by the histogram feature in the recording screen. -- cgit v1.2.3