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.c33
1 files changed, 17 insertions, 16 deletions
diff --git a/apps/recorder/peakmeter.c b/apps/recorder/peakmeter.c
index fc7c9bc5f5..ce0974a084 100644
--- a/apps/recorder/peakmeter.c
+++ b/apps/recorder/peakmeter.c
@@ -47,7 +47,7 @@
47#if CONFIG_CODEC == SWCODEC 47#if CONFIG_CODEC == SWCODEC
48#include "pcm.h" 48#include "pcm.h"
49 49
50#ifdef HAVE_RECORDING 50#ifdef HAVE_RECORDING
51#include "pcm_record.h" 51#include "pcm_record.h"
52#endif 52#endif
53 53
@@ -265,7 +265,7 @@ int calc_db (int isample)
265 } 265 }
266 } 266 }
267 } 267 }
268 268
269 return n + (m * (long)(isample - istart)) / 100L; 269 return n + (m * (long)(isample - istart)) / 100L;
270} 270}
271 271
@@ -319,13 +319,13 @@ int peak_meter_db2sample(int db)
319 /* range check: db value to big */ 319 /* range check: db value to big */
320 if (max_peak_db + db < 0) { 320 if (max_peak_db + db < 0) {
321 retval = 0; 321 retval = 0;
322 } 322 }
323 323
324 /* range check: db value too small */ 324 /* range check: db value too small */
325 else if (max_peak_db + db >= max_peak_db) { 325 else if (max_peak_db + db >= max_peak_db) {
326 retval = MAX_PEAK -1; 326 retval = MAX_PEAK -1;
327 } 327 }
328 328
329 /* value in range: find the matching linear value */ 329 /* value in range: find the matching linear value */
330 else { 330 else {
331 retval = db_to_sample_bin_search(0, MAX_PEAK, max_peak_db + db); 331 retval = db_to_sample_bin_search(0, MAX_PEAK, max_peak_db + db);
@@ -359,7 +359,7 @@ static void peak_meter_set_min(int newmin)
359 } 359 }
360 360
361 pm_range = peak_meter_range_max - peak_meter_range_min; 361 pm_range = peak_meter_range_max - peak_meter_range_min;
362 362
363 /* Avoid division by zero. */ 363 /* Avoid division by zero. */
364 if (pm_range == 0) { 364 if (pm_range == 0) {
365 pm_range = 1; 365 pm_range = 1;
@@ -586,10 +586,10 @@ void peak_meter_peek(void)
586#if CONFIG_CODEC == SWCODEC 586#if CONFIG_CODEC == SWCODEC
587 if (pm_playback) 587 if (pm_playback)
588 pcm_calculate_peaks(&pm_cur_left, &pm_cur_right); 588 pcm_calculate_peaks(&pm_cur_left, &pm_cur_right);
589#ifdef HAVE_RECORDING 589#ifdef HAVE_RECORDING
590 else 590 else
591 pcm_calculate_rec_peaks(&pm_cur_left, &pm_cur_right); 591 pcm_calculate_rec_peaks(&pm_cur_left, &pm_cur_right);
592#endif 592#endif
593 left = pm_cur_left; 593 left = pm_cur_left;
594 right = pm_cur_right; 594 right = pm_cur_right;
595#else 595#else
@@ -812,7 +812,7 @@ static int peak_meter_read_l(void)
812 /* reset pm_max_left so that subsequent calls of peak_meter_peek don't 812 /* reset pm_max_left so that subsequent calls of peak_meter_peek don't
813 get fooled by an old maximum value */ 813 get fooled by an old maximum value */
814 pm_max_left = pm_cur_left; 814 pm_max_left = pm_cur_left;
815 815
816#if defined(SIMULATOR) && (CONFIG_CODEC != SWCODEC) 816#if defined(SIMULATOR) && (CONFIG_CODEC != SWCODEC)
817 srand(current_tick); 817 srand(current_tick);
818 retval = rand()%MAX_PEAK; 818 retval = rand()%MAX_PEAK;
@@ -1328,8 +1328,8 @@ void peak_meter_draw_trig(int xpos[], int ypos[],
1328} 1328}
1329#endif 1329#endif
1330 1330
1331int peak_meter_draw_get_btn(int action_context, int x, int y[], 1331int peak_meter_draw_get_btn(int action_context, int x[], int y[],
1332 int height, int nb_screens) 1332 int height[], int nb_screens)
1333{ 1333{
1334 int button = BUTTON_NONE; 1334 int button = BUTTON_NONE;
1335 long next_refresh = current_tick; 1335 long next_refresh = current_tick;
@@ -1362,10 +1362,10 @@ int peak_meter_draw_get_btn(int action_context, int x, int y[],
1362 if (TIME_AFTER(current_tick, next_refresh)) { 1362 if (TIME_AFTER(current_tick, next_refresh)) {
1363 for(i = 0; i < nb_screens; i++) 1363 for(i = 0; i < nb_screens; i++)
1364 { 1364 {
1365 peak_meter_screen(&screens[i], x, y[i], height); 1365 peak_meter_screen(&screens[i], x[i], y[i], height[i]);
1366 screens[i].update_viewport_rect(x, y[i], 1366 screens[i].update_viewport_rect(x[i], y[i],
1367 screens[i].getwidth() - x, 1367 screens[i].getwidth() - x[i],
1368 height); 1368 height[i]);
1369 } 1369 }
1370 next_refresh += HZ / PEAK_METER_FPS; 1370 next_refresh += HZ / PEAK_METER_FPS;
1371 dopeek = true; 1371 dopeek = true;
@@ -1430,3 +1430,4 @@ bool peak_meter_histogram(void)
1430} 1430}
1431#endif 1431#endif
1432 1432
1433