summaryrefslogtreecommitdiffstats
path: root/apps/pcmbuf.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/pcmbuf.c
parentf451108fa857fe16f35fa3beb5278e36fed74c67 (diff)
downloadrockbox-2b7ef6b92880249e64639768012266e65f5d14cc.tar.gz
rockbox-2b7ef6b92880249e64639768012266e65f5d14cc.tar.bz2
rockbox-2b7ef6b92880249e64639768012266e65f5d14cc.zip
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/pcmbuf.c')
-rw-r--r--apps/pcmbuf.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/apps/pcmbuf.c b/apps/pcmbuf.c
index 319e3e8044..66a4ed4128 100644
--- a/apps/pcmbuf.c
+++ b/apps/pcmbuf.c
@@ -1170,6 +1170,30 @@ bool pcmbuf_is_crossfade_enabled(void)
* Commit any remaining samples in the PCM buffer for playback. */
void pcmbuf_play_remainder(void)
{
+ pcmbuf_flush_limiter_buffer();
+
if (audiobuffer_fillpos)
pcmbuf_flush_fillpos();
}
+
+/** FLUSH LIMITER BUFFER
+ * Empty the limiter buffer and commit its contents
+ * to the PCM buffer for playback. */
+void pcmbuf_flush_limiter_buffer(void)
+{
+ char *dest;
+ int out_count = LIMITER_BUFFER_SIZE;
+
+ /* create room at the end of the PCM buffer for any
+ samples that may be held back in the limiter buffer */
+ while ((dest = pcmbuf_request_buffer(&out_count)) == NULL)
+ {
+ cancel_cpu_boost();
+ sleep(1);
+ }
+
+ /* flush the limiter buffer into the PCM buffer */
+ out_count = dsp_flush_limiter_buffer(dest);
+ if (out_count > 0)
+ pcmbuf_write_complete(out_count);
+}