summaryrefslogtreecommitdiff
path: root/apps/recorder/peakmeter.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/recorder/peakmeter.c')
-rw-r--r--apps/recorder/peakmeter.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/apps/recorder/peakmeter.c b/apps/recorder/peakmeter.c
index 0f8da98308..58c85b2161 100644
--- a/apps/recorder/peakmeter.c
+++ b/apps/recorder/peakmeter.c
@@ -62,6 +62,10 @@ static int pm_cur_left; /* current values (last peak_meter_peek) */
62static int pm_cur_right; 62static int pm_cur_right;
63static int pm_max_left; /* maximum values between peak meter draws */ 63static int pm_max_left; /* maximum values between peak meter draws */
64static int pm_max_right; 64static int pm_max_right;
65#ifdef HAVE_AGC
66static int pm_peakhold_left; /* max. peak values between peakhold calls */
67static int pm_peakhold_right; /* used for AGC and histogram display */
68#endif
65 69
66/* Clip hold */ 70/* Clip hold */
67static bool pm_clip_left = false; /* when true a clip has occurred */ 71static bool pm_clip_left = false; /* when true a clip has occurred */
@@ -716,6 +720,10 @@ static int peak_meter_read_l(void)
716 by peak_meter_peek since the last call of peak_meter_read_l */ 720 by peak_meter_peek since the last call of peak_meter_read_l */
717 int retval = pm_max_left; 721 int retval = pm_max_left;
718 722
723#ifdef HAVE_AGC
724 /* store max peak value for peak_meter_get_peakhold_x readout */
725 pm_peakhold_left = MAX(pm_max_left, pm_peakhold_left);
726#endif
719#ifdef PM_DEBUG 727#ifdef PM_DEBUG
720 peek_calls = 0; 728 peek_calls = 0;
721#endif 729#endif
@@ -737,6 +745,10 @@ static int peak_meter_read_r(void)
737 by peak_meter_peek since the last call of peak_meter_read_r */ 745 by peak_meter_peek since the last call of peak_meter_read_r */
738 int retval = pm_max_right; 746 int retval = pm_max_right;
739 747
748#ifdef HAVE_AGC
749 /* store max peak value for peak_meter_get_peakhold_x readout */
750 pm_peakhold_right = MAX(pm_max_right, pm_peakhold_right);
751#endif
740#ifdef PM_DEBUG 752#ifdef PM_DEBUG
741 peek_calls = 0; 753 peek_calls = 0;
742#endif 754#endif
@@ -746,6 +758,23 @@ static int peak_meter_read_r(void)
746 return retval; 758 return retval;
747} 759}
748 760
761#ifdef HAVE_AGC
762/**
763 * Reads out the current peak-hold values since the last call.
764 * This is used by the histogram feature in the recording screen.
765 * Values are in the range 0 <= peak_x < MAX_PEAK. MAX_PEAK is typ 32767.
766 */
767extern void peak_meter_get_peakhold(int *peak_left, int *peak_right)
768{
769 if (peak_left)
770 *peak_left = pm_peakhold_left;
771 if (peak_right)
772 *peak_right = pm_peakhold_right;
773 pm_peakhold_left = 0;
774 pm_peakhold_right = 0;
775}
776#endif
777
749/** 778/**
750 * Reset the detected clips. This method is for 779 * Reset the detected clips. This method is for
751 * use by the user interface. 780 * use by the user interface.