diff options
author | Peter D'Hoye <peter.dhoye@gmail.com> | 2010-03-03 22:16:08 +0000 |
---|---|---|
committer | Peter D'Hoye <peter.dhoye@gmail.com> | 2010-03-03 22:16:08 +0000 |
commit | be90f74e89978224a169c793d4e688867dc38b41 (patch) | |
tree | dce0af0eb60cd29e421b55a213a3fbfdb993031f /apps/recorder/peakmeter.c | |
parent | 5c80a838e4f6217970998df9d2bef44a9dddc795 (diff) |
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
Diffstat (limited to 'apps/recorder/peakmeter.c')
-rw-r--r-- | apps/recorder/peakmeter.c | 36 |
1 files changed, 20 insertions, 16 deletions
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. |