summaryrefslogtreecommitdiff
path: root/apps/recorder/recording.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/recorder/recording.c')
-rw-r--r--apps/recorder/recording.c32
1 files changed, 1 insertions, 31 deletions
diff --git a/apps/recorder/recording.c b/apps/recorder/recording.c
index 4816b3bad4..7357b469f4 100644
--- a/apps/recorder/recording.c
+++ b/apps/recorder/recording.c
@@ -548,39 +548,9 @@ static void auto_gain_control(int *peak_l, int *peak_r, int *balance)
548} 548}
549#endif /* HAVE_AGC */ 549#endif /* HAVE_AGC */
550 550
551static const char* const fmtstr[] =
552{
553 "%c%d %s", /* no decimals */
554 "%c%d.%d %s ", /* 1 decimal */
555 "%c%d.%02d %s " /* 2 decimals */
556};
557
558static const char factor[] = {1, 10, 100};
559
560static char *fmt_gain(int snd, int val, char *str, int len) 551static char *fmt_gain(int snd, int val, char *str, int len)
561{ 552{
562 int i, d, numdec; 553 format_sound_value(str, len, snd, val);
563 const char *unit;
564 char sign = ' ';
565
566 val = sound_val2phys(snd, val);
567 if(val < 0)
568 {
569 sign = '-';
570 val = -val;
571 }
572 numdec = sound_numdecimals(snd);
573 unit = sound_unit(snd);
574
575 if(numdec)
576 {
577 i = val / factor[numdec];
578 d = val % factor[numdec];
579 snprintf(str, len, fmtstr[numdec], sign, i, d, unit);
580 }
581 else
582 snprintf(str, len, fmtstr[numdec], sign, val, unit);
583
584 return str; 554 return str;
585} 555}
586 556