summaryrefslogtreecommitdiff
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.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)
1170 * Commit any remaining samples in the PCM buffer for playback. */ 1170 * Commit any remaining samples in the PCM buffer for playback. */
1171void pcmbuf_play_remainder(void) 1171void pcmbuf_play_remainder(void)
1172{ 1172{
1173 pcmbuf_flush_limiter_buffer();
1174
1173 if (audiobuffer_fillpos) 1175 if (audiobuffer_fillpos)
1174 pcmbuf_flush_fillpos(); 1176 pcmbuf_flush_fillpos();
1175} 1177}
1178
1179/** FLUSH LIMITER BUFFER
1180 * Empty the limiter buffer and commit its contents
1181 * to the PCM buffer for playback. */
1182void pcmbuf_flush_limiter_buffer(void)
1183{
1184 char *dest;
1185 int out_count = LIMITER_BUFFER_SIZE;
1186
1187 /* create room at the end of the PCM buffer for any
1188 samples that may be held back in the limiter buffer */
1189 while ((dest = pcmbuf_request_buffer(&out_count)) == NULL)
1190 {
1191 cancel_cpu_boost();
1192 sleep(1);
1193 }
1194
1195 /* flush the limiter buffer into the PCM buffer */
1196 out_count = dsp_flush_limiter_buffer(dest);
1197 if (out_count > 0)
1198 pcmbuf_write_complete(out_count);
1199}