Rockbox mail archive
Subject: idea to improve the peak meter reliability
From: Henri DAVID (hdavid_at_mail.com)
Date: 2002-10-23
Hi again,
I had a an idea to make the peak meter more accurate.
i noticed the archos 1.27 peakmeter is way more accurate the the rockbox
one. I think rockbox misses lots of peaks :( (well, the archos 1.27 not that
good either!)
The idea here is to try to avoid cases where peakmeter misses a peak. Not to
miss a peak, we need to read as often as possible the Qpeak value from the
mas. Our eyes and the LCD screen are not that quick, we don't need to update
the screen everytime we read the QPeak value (and then save some CPU
horsepower).
My idea is to read peaks values from the MAS frequently let say 50 times per
second (is this value to high ?? will it drain to much juice?), and update
the peakmeter display only 10 times per second. the peakmeter would the not
display the last read QPeak value but an average of the last 5 five value or
maybe as it is a _PEAK_meter the max of the five last values would be then
more appropriated here.
comments on this ? is this feasible ?
henri
here is an idea of code :
Lines that changed are marked with ">"
--------------------------------
void peak_meter_peek(void) {
#ifdef SIMULATOR
int left = 8000;
int right = 9000;
#else
/* read the peak values */
int left = mas_codec_readreg(peak_meter_src_l);
int right = mas_codec_readreg(peak_meter_src_r);
#endif
/* check for clips
An clip is assumed when two consecutive readouts
of the volume are at full scale. This is proven
to be inaccurate in both ways: it may detect clips
when no clip occurred and it may fail to detect
a real clip. */
if ((left == peak_meter_l) &&
(left == MAX_PEAK - 1)) {
peak_meter_l_clip = true;
peak_meter_clip_timeout_l =
current_tick +
clip_time_out[global_settings.peak_meter_clip_hold];
}
if ((right == peak_meter_r) &&
(right == MAX_PEAK - 1)) {
peak_meter_r_clip = true;
peak_meter_clip_timeout_r =
current_tick +
clip_time_out[global_settings.peak_meter_clip_hold];
}
/* peaks are searched -> we have to find the maximum */
> peak_meter_l = MAX(peak_meter_l,
Max(mas_codec_readreg(peak_meter_src_l),left));
> peak_meter_r = MAX(peak_meter_r,
max(mas_codec_readreg(peak_meter_src_r),right));
#endif
--------------------------------
--------------------------------
void peak_meter_draw(int x, int y, int width, int height) {
/* left and right should be global */
/* int left = 0, right = 0; */
static int last_left = 0, last_right = 0;
int meterwidth = width - 3;
int i;
/* if disabled only draw the peak meter */
if (peak_meter_enabled) {
/* read the volume info from MAS */
/* these functione are called somewhere else in the code. */
/* 50 times per second */
/*left = peak_meter_read_l(); */
/*right = peak_meter_read_r(); */
peak_meter_peek();
[...]
[...]
[...]
for (i = 0; i < 10; i++) {
lcd_invertpixel(x + meterwidth * i / 10, y + height / 2 - 1);
}
last_left = left;
last_right = right;
> peak_meter_l = 0; /* we reset the max values */
> peak_meter_ r = 0; /* we reset the max values */
}
--------------------------------
Page was last modified "Jan 10 2012" The Rockbox Crew
|