summaryrefslogtreecommitdiff
path: root/apps/plugins/test_codec.c
diff options
context:
space:
mode:
authorJeffrey Goode <jeffg7@gmail.com>2009-08-18 03:24:45 +0000
committerJeffrey Goode <jeffg7@gmail.com>2009-08-18 03:24:45 +0000
commit2b7ef6b92880249e64639768012266e65f5d14cc (patch)
tree119d27b90177426b8c01da7d3f5a4e1d884a01ee /apps/plugins/test_codec.c
parentf451108fa857fe16f35fa3beb5278e36fed74c67 (diff)
downloadrockbox-2b7ef6b92880249e64639768012266e65f5d14cc.zip
rockbox-2b7ef6b92880249e64639768012266e65f5d14cc.tar.gz
rockbox-2b7ef6b92880249e64639768012266e65f5d14cc.tar.bz2
rockbox-2b7ef6b92880249e64639768012266e65f5d14cc.tar.xz
FS#10199: Adds limiter DSP function
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22394 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins/test_codec.c')
-rw-r--r--apps/plugins/test_codec.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/apps/plugins/test_codec.c b/apps/plugins/test_codec.c
index bae4571..22516ba 100644
--- a/apps/plugins/test_codec.c
+++ b/apps/plugins/test_codec.c
@@ -810,10 +810,34 @@ show_menu:
rb->closedir(dir);
}
+ /* process last samples */
+ if (use_dsp)
+ rb->dsp_flush_limiter_buffer(dspbuffer);
} else {
/* Just test the file */
res = test_track(parameter);
+ /* process last samples */
+ if (use_dsp)
+ {
+ int channels = (wavinfo.stereomode == STEREO_MONO) ? 1 : 2;
+ int count = rb->dsp_flush_limiter_buffer(dspbuffer);
+ if (channels == 1)
+ {
+ unsigned char *s = dspbuffer, *d = dspbuffer;
+ int c = count;
+ while (c-- > 0)
+ {
+ *d++ = *s++;
+ *d++ = *s++;
+ s++;
+ s++;
+ }
+ }
+ if (wavinfo.fd >= 0)
+ rb->write(wavinfo.fd, dspbuffer, count * 2 * channels);
+ }
+
/* Close WAV file (if there was one) */
if (wavinfo.fd >= 0) {
close_wav();