diff options
author | Michael Sevakis <jethead71@rockbox.org> | 2017-11-21 06:07:13 -0500 |
---|---|---|
committer | Michael Sevakis <jethead71@rockbox.org> | 2017-11-21 06:08:23 -0500 |
commit | 12bc24adbf919dc945928b2dcda74d51d33708f7 (patch) | |
tree | e05c214820dcf1c1058cc0d3fce6323f34afdae2 /apps | |
parent | aced667f48c29a160aa4e5c0a8df037092b28189 (diff) | |
download | rockbox-12bc24adbf919dc945928b2dcda74d51d33708f7.tar.gz rockbox-12bc24adbf919dc945928b2dcda74d51d33708f7.zip |
aced667 forgot about those pesky __PCTOOL__ things.
It was so close to aced666.
Change-Id: I2b952a0704bb2d006db5e3ea4a929db3118cf390
Diffstat (limited to 'apps')
-rw-r--r-- | apps/misc.c | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/apps/misc.c b/apps/misc.c index bfe3e990f5..047098556f 100644 --- a/apps/misc.c +++ b/apps/misc.c | |||
@@ -1004,6 +1004,21 @@ void replaygain_update(void) | |||
1004 | } | 1004 | } |
1005 | #endif /* CONFIG_CODEC == SWCODEC */ | 1005 | #endif /* CONFIG_CODEC == SWCODEC */ |
1006 | 1006 | ||
1007 | /* format a sound value like: -1.05 dB */ | ||
1008 | int format_sound_value(char *buf, size_t size, int snd, int val) | ||
1009 | { | ||
1010 | int numdec = sound_numdecimals(snd); | ||
1011 | const char *unit = sound_unit(snd); | ||
1012 | int physval = sound_val2phys(snd, val); | ||
1013 | |||
1014 | unsigned int factor = ipow(10, numdec); | ||
1015 | unsigned int av = abs(physval); | ||
1016 | unsigned int i = av / factor; | ||
1017 | unsigned int d = av - i*factor; | ||
1018 | return snprintf(buf, size, "%c%u%.*s%.*u %s", " -"[physval < 0], | ||
1019 | i, numdec, ".", numdec, d, unit); | ||
1020 | } | ||
1021 | |||
1007 | #endif /* !defined(__PCTOOL__) */ | 1022 | #endif /* !defined(__PCTOOL__) */ |
1008 | 1023 | ||
1009 | /* Read (up to) a line of text from fd into buffer and return number of bytes | 1024 | /* Read (up to) a line of text from fd into buffer and return number of bytes |
@@ -1253,18 +1268,3 @@ enum current_activity get_current_activity(void) | |||
1253 | } | 1268 | } |
1254 | 1269 | ||
1255 | #endif | 1270 | #endif |
1256 | |||
1257 | /* format a sound value like: -1.05 dB */ | ||
1258 | int format_sound_value(char *buf, size_t size, int snd, int val) | ||
1259 | { | ||
1260 | int numdec = sound_numdecimals(snd); | ||
1261 | const char *unit = sound_unit(snd); | ||
1262 | int physval = sound_val2phys(snd, val); | ||
1263 | |||
1264 | unsigned int factor = ipow(10, numdec); | ||
1265 | unsigned int av = abs(physval); | ||
1266 | unsigned int i = av / factor; | ||
1267 | unsigned int d = av - i*factor; | ||
1268 | return snprintf(buf, size, "%c%u%.*s%.*u %s", " -"[physval < 0], | ||
1269 | i, numdec, ".", numdec, d, unit); | ||
1270 | } | ||