summaryrefslogtreecommitdiff
path: root/apps/dsp.c
diff options
context:
space:
mode:
authorSteve Bavin <pondlife@pondlife.me>2009-06-16 07:10:05 +0000
committerSteve Bavin <pondlife@pondlife.me>2009-06-16 07:10:05 +0000
commitd6ad019af3ebb38a026821f7c34fe1c8818f14e6 (patch)
tree275c174ede94dd27b6c8fd63d0e04097355eefb7 /apps/dsp.c
parente3cb71d6b1f84805e8b92d7397cf63fde01f7b4e (diff)
downloadrockbox-d6ad019af3ebb38a026821f7c34fe1c8818f14e6.tar.gz
rockbox-d6ad019af3ebb38a026821f7c34fe1c8818f14e6.zip
Renamed routines and changed comments for clarity.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21309 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/dsp.c')
-rw-r--r--apps/dsp.c25
1 files changed, 12 insertions, 13 deletions
diff --git a/apps/dsp.c b/apps/dsp.c
index a68b8615f8..297a70d5a9 100644
--- a/apps/dsp.c
+++ b/apps/dsp.c
@@ -270,7 +270,7 @@ static void tdspeed_setup(struct dsp_config *dspc)
270 dspc->tdspeed_active = false; 270 dspc->tdspeed_active = false;
271 if (dspc == &AUDIO_DSP) 271 if (dspc == &AUDIO_DSP)
272 { 272 {
273 if(!dsp_timestretch_enabled()) 273 if(!dsp_timestretch_available())
274 return; 274 return;
275 if (dspc->tdspeed_percent == 0) 275 if (dspc->tdspeed_percent == 0)
276 dspc->tdspeed_percent = 100; 276 dspc->tdspeed_percent = 100;
@@ -285,26 +285,25 @@ static void tdspeed_setup(struct dsp_config *dspc)
285 } 285 }
286} 286}
287 287
288void dsp_timestretch_enable(bool enable) 288void dsp_timestretch_enable(bool enabled)
289{ 289{
290 if (enable) 290 /* Hook to set up timestretch buffer on first call to settings_apply() */
291 if (big_sample_buf_count < 0) /* Only do something on first call */
291 { 292 {
292 /* Set up timestretch buffers on first enable */ 293 if (enabled)
293 if (big_sample_buf_count < 0)
294 { 294 {
295 /* Set up timestretch buffers */
295 big_sample_buf_count = SMALL_SAMPLE_BUF_COUNT * RESAMPLE_RATIO; 296 big_sample_buf_count = SMALL_SAMPLE_BUF_COUNT * RESAMPLE_RATIO;
296 big_sample_buf = small_resample_buf; 297 big_sample_buf = small_resample_buf;
297 big_resample_buf = (int32_t *) buffer_alloc(big_sample_buf_count * RESAMPLE_RATIO * sizeof(int32_t)); 298 big_resample_buf = (int32_t *) buffer_alloc(big_sample_buf_count * RESAMPLE_RATIO * sizeof(int32_t));
298 } 299 }
299 } 300 else
300 else 301 {
301 { 302 /* Not enabled at startup, "big" buffers will never be available */
302 /* If not enabled at startup, buffers will never be available */
303 if (big_sample_buf_count < 0)
304 big_sample_buf_count = 0; 303 big_sample_buf_count = 0;
304 }
305 tdspeed_setup(&AUDIO_DSP);
305 } 306 }
306 global_settings.timestretch_enabled = enable;
307 tdspeed_setup(&AUDIO_DSP);
308} 307}
309 308
310void dsp_set_timestretch(int percent) 309void dsp_set_timestretch(int percent)
@@ -318,7 +317,7 @@ int dsp_get_timestretch()
318 return AUDIO_DSP.tdspeed_percent; 317 return AUDIO_DSP.tdspeed_percent;
319} 318}
320 319
321bool dsp_timestretch_enabled() 320bool dsp_timestretch_available()
322{ 321{
323 return (global_settings.timestretch_enabled && big_sample_buf_count > 0); 322 return (global_settings.timestretch_enabled && big_sample_buf_count > 0);
324} 323}