1
0
Fork 0
forked from len0rd/rockbox

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; dspc->tdspeed_active = false;
if (dspc == &AUDIO_DSP) if (dspc == &AUDIO_DSP)
{ {
if(!dsp_timestretch_enabled()) if(!dsp_timestretch_available())
return; return;
if (dspc->tdspeed_percent == 0) if (dspc->tdspeed_percent == 0)
dspc->tdspeed_percent = 100; dspc->tdspeed_percent = 100;
@ -285,27 +285,26 @@ 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 (enabled)
if (big_sample_buf_count < 0)
{ {
/* Set up timestretch buffers */
big_sample_buf_count = SMALL_SAMPLE_BUF_COUNT * RESAMPLE_RATIO; big_sample_buf_count = SMALL_SAMPLE_BUF_COUNT * RESAMPLE_RATIO;
big_sample_buf = small_resample_buf; big_sample_buf = small_resample_buf;
big_resample_buf = (int32_t *) buffer_alloc(big_sample_buf_count * RESAMPLE_RATIO * sizeof(int32_t)); big_resample_buf = (int32_t *) buffer_alloc(big_sample_buf_count * RESAMPLE_RATIO * sizeof(int32_t));
} }
}
else else
{ {
/* If not enabled at startup, buffers will never be available */ /* Not enabled at startup, "big" buffers will never be available */
if (big_sample_buf_count < 0)
big_sample_buf_count = 0; big_sample_buf_count = 0;
} }
global_settings.timestretch_enabled = enable;
tdspeed_setup(&AUDIO_DSP); tdspeed_setup(&AUDIO_DSP);
} }
}
void dsp_set_timestretch(int percent) void dsp_set_timestretch(int percent)
{ {
@ -318,7 +317,7 @@ int dsp_get_timestretch()
return AUDIO_DSP.tdspeed_percent; return AUDIO_DSP.tdspeed_percent;
} }
bool dsp_timestretch_enabled() bool dsp_timestretch_available()
{ {
return (global_settings.timestretch_enabled && big_sample_buf_count > 0); 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(bool enable);
void dsp_set_eq_precut(int precut); void dsp_set_eq_precut(int precut);
void dsp_set_eq_coefs(int band); 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_dither_enable(bool enable);
void dsp_timestretch_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); void dsp_set_timestretch(int percent);
bool dsp_timestretch_enabled(void);
int dsp_get_timestretch(void); int dsp_get_timestretch(void);
int dsp_callback(int msg, intptr_t param);
#endif #endif

View file

@ -449,7 +449,7 @@ int gui_syncpitchscreen_run(void)
case ACTION_PS_TOGGLE_MODE: case ACTION_PS_TOGGLE_MODE:
++pitch_mode; ++pitch_mode;
#if CONFIG_CODEC == SWCODEC #if CONFIG_CODEC == SWCODEC
if (dsp_timestretch_enabled()) if (dsp_timestretch_available())
{ {
if (pitch_mode > PITCH_MODE_TIMESTRETCH) if (pitch_mode > PITCH_MODE_TIMESTRETCH)
pitch_mode = PITCH_MODE_ABSOLUTE; 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) switch (action)
{ {
case ACTION_EXIT_MENUITEM: /* on exit */ 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)); splash(HZ*2, ID2P(LANG_PLEASE_REBOOT));
break; break;
} }