Renamed routines and changed comments for clarity.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21309 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Steve Bavin 2009-06-16 07:10:05 +00:00
parent e3cb71d6b1
commit d6ad019af3
4 changed files with 18 additions and 19 deletions

View file

@ -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);
}

View file

@ -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

View file

@ -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;

View file

@ -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;
}