From d6ad019af3ebb38a026821f7c34fe1c8818f14e6 Mon Sep 17 00:00:00 2001 From: Steve Bavin Date: Tue, 16 Jun 2009 07:10:05 +0000 Subject: Renamed routines and changed comments for clarity. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21309 a1c6a512-1295-4272-9138-f99709370657 --- apps/dsp.c | 25 ++++++++++++------------- apps/dsp.h | 8 ++++---- apps/gui/pitchscreen.c | 2 +- apps/menus/sound_menu.c | 2 +- 4 files changed, 18 insertions(+), 19 deletions(-) (limited to 'apps') 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) dspc->tdspeed_active = false; if (dspc == &AUDIO_DSP) { - if(!dsp_timestretch_enabled()) + if(!dsp_timestretch_available()) return; if (dspc->tdspeed_percent == 0) dspc->tdspeed_percent = 100; @@ -285,26 +285,25 @@ static void tdspeed_setup(struct dsp_config *dspc) } } -void dsp_timestretch_enable(bool enable) +void dsp_timestretch_enable(bool enabled) { - if (enable) + /* Hook to set up timestretch buffer on first call to settings_apply() */ + if (big_sample_buf_count < 0) /* Only do something on first call */ { - /* Set up timestretch buffers on first enable */ - if (big_sample_buf_count < 0) + if (enabled) { + /* Set up timestretch buffers */ big_sample_buf_count = SMALL_SAMPLE_BUF_COUNT * RESAMPLE_RATIO; big_sample_buf = small_resample_buf; big_resample_buf = (int32_t *) buffer_alloc(big_sample_buf_count * RESAMPLE_RATIO * sizeof(int32_t)); } - } - else - { - /* If not enabled at startup, buffers will never be available */ - if (big_sample_buf_count < 0) + else + { + /* Not enabled at startup, "big" buffers will never be available */ big_sample_buf_count = 0; + } + tdspeed_setup(&AUDIO_DSP); } - global_settings.timestretch_enabled = enable; - tdspeed_setup(&AUDIO_DSP); } void dsp_set_timestretch(int percent) @@ -318,7 +317,7 @@ int dsp_get_timestretch() return AUDIO_DSP.tdspeed_percent; } -bool dsp_timestretch_enabled() +bool dsp_timestretch_available() { return (global_settings.timestretch_enabled && big_sample_buf_count > 0); } 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, void dsp_set_eq(bool enable); void dsp_set_eq_precut(int precut); void dsp_set_eq_coefs(int band); -void sound_set_pitch(int r); -int sound_get_pitch(void); -int dsp_callback(int msg, intptr_t param); void dsp_dither_enable(bool enable); void dsp_timestretch_enable(bool enable); +bool dsp_timestretch_available(void); +void sound_set_pitch(int r); +int sound_get_pitch(void); void dsp_set_timestretch(int percent); -bool dsp_timestretch_enabled(void); int dsp_get_timestretch(void); +int dsp_callback(int msg, intptr_t param); #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) case ACTION_PS_TOGGLE_MODE: ++pitch_mode; #if CONFIG_CODEC == SWCODEC - if (dsp_timestretch_enabled()) + if (dsp_timestretch_available()) { if (pitch_mode > PITCH_MODE_TIMESTRETCH) 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) switch (action) { case ACTION_EXIT_MENUITEM: /* on exit */ - if (global_settings.timestretch_enabled && !dsp_timestretch_enabled()) + if (global_settings.timestretch_enabled && !dsp_timestretch_available()) splash(HZ*2, ID2P(LANG_PLEASE_REBOOT)); break; } -- cgit v1.2.3