summaryrefslogtreecommitdiff
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
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
-rw-r--r--apps/dsp.c25
-rw-r--r--apps/dsp.h8
-rw-r--r--apps/gui/pitchscreen.c2
-rw-r--r--apps/menus/sound_menu.c2
4 files changed, 18 insertions, 19 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}
diff --git a/apps/dsp.h b/apps/dsp.h
index 5c4211f251..8c23c3053d 100644
--- a/apps/dsp.h
+++ b/apps/dsp.h
@@ -160,13 +160,13 @@ void dsp_set_crossfeed_cross_params(long lf_gain, long hf_gain,
160void dsp_set_eq(bool enable); 160void dsp_set_eq(bool enable);
161void dsp_set_eq_precut(int precut); 161void dsp_set_eq_precut(int precut);
162void dsp_set_eq_coefs(int band); 162void dsp_set_eq_coefs(int band);
163void sound_set_pitch(int r);
164int sound_get_pitch(void);
165int dsp_callback(int msg, intptr_t param);
166void dsp_dither_enable(bool enable); 163void dsp_dither_enable(bool enable);
167void dsp_timestretch_enable(bool enable); 164void dsp_timestretch_enable(bool enable);
165bool dsp_timestretch_available(void);
166void sound_set_pitch(int r);
167int sound_get_pitch(void);
168void dsp_set_timestretch(int percent); 168void dsp_set_timestretch(int percent);
169bool dsp_timestretch_enabled(void);
170int dsp_get_timestretch(void); 169int dsp_get_timestretch(void);
170int dsp_callback(int msg, intptr_t param);
171 171
172#endif 172#endif
diff --git a/apps/gui/pitchscreen.c b/apps/gui/pitchscreen.c
index 5072031652..bbf29489b5 100644
--- a/apps/gui/pitchscreen.c
+++ b/apps/gui/pitchscreen.c
@@ -449,7 +449,7 @@ int gui_syncpitchscreen_run(void)
449 case ACTION_PS_TOGGLE_MODE: 449 case ACTION_PS_TOGGLE_MODE:
450 ++pitch_mode; 450 ++pitch_mode;
451#if CONFIG_CODEC == SWCODEC 451#if CONFIG_CODEC == SWCODEC
452 if (dsp_timestretch_enabled()) 452 if (dsp_timestretch_available())
453 { 453 {
454 if (pitch_mode > PITCH_MODE_TIMESTRETCH) 454 if (pitch_mode > PITCH_MODE_TIMESTRETCH)
455 pitch_mode = PITCH_MODE_ABSOLUTE; 455 pitch_mode = PITCH_MODE_ABSOLUTE;
diff --git a/apps/menus/sound_menu.c b/apps/menus/sound_menu.c
index bfba8171da..1723d9779e 100644
--- a/apps/menus/sound_menu.c
+++ b/apps/menus/sound_menu.c
@@ -94,7 +94,7 @@ static int timestretch_callback(int action,const struct menu_item_ex *this_item)
94 switch (action) 94 switch (action)
95 { 95 {
96 case ACTION_EXIT_MENUITEM: /* on exit */ 96 case ACTION_EXIT_MENUITEM: /* on exit */
97 if (global_settings.timestretch_enabled && !dsp_timestretch_enabled()) 97 if (global_settings.timestretch_enabled && !dsp_timestretch_available())
98 splash(HZ*2, ID2P(LANG_PLEASE_REBOOT)); 98 splash(HZ*2, ID2P(LANG_PLEASE_REBOOT));
99 break; 99 break;
100 } 100 }