1
0
Fork 0
forked from len0rd/rockbox

iriver: audio_init really needs to be called after playlist and tree init; delay initial application of buffer margin and crossfade to solve the settings dependency. This should fix the problem with large values in 'Max files in dir browser'.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@7633 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Magnus Holmgren 2005-10-16 08:01:02 +00:00
parent eb04a53830
commit 62634a323e
2 changed files with 12 additions and 8 deletions

View file

@ -135,7 +135,6 @@ void init(void)
font_init(); font_init();
show_logo(); show_logo();
lang_init(); lang_init();
audio_init();
settings_reset(); settings_reset();
settings_calc_config_sector(); settings_calc_config_sector();
settings_load(SETTINGS_ALL); settings_load(SETTINGS_ALL);
@ -158,6 +157,7 @@ void init(void)
global_settings.mdb_shape, global_settings.mdb_shape,
global_settings.mdb_enable, global_settings.mdb_enable,
global_settings.superbass); global_settings.superbass);
audio_init();
button_clear_queue(); /* Empty the keyboard buffer */ button_clear_queue(); /* Empty the keyboard buffer */
#if CONFIG_CODEC == SWCODEC #if CONFIG_CODEC == SWCODEC
talk_init(); talk_init();
@ -296,11 +296,6 @@ void init(void)
settings_load(SETTINGS_ALL); settings_load(SETTINGS_ALL);
init_dircache(); init_dircache();
/* On software codec platforms we have to init audio before
calling audio_set_buffer_margin(). */
#if (CONFIG_CODEC == SWCODEC)
audio_init();
#endif
settings_apply(); settings_apply();
status_init(); status_init();
@ -323,10 +318,9 @@ void init(void)
global_settings.mdb_shape, global_settings.mdb_shape,
global_settings.mdb_enable, global_settings.mdb_enable,
global_settings.superbass); global_settings.superbass);
audio_init();
#if (CONFIG_CODEC == SWCODEC) #if (CONFIG_CODEC == SWCODEC)
sound_settings_apply(); sound_settings_apply();
#else
audio_init();
#endif #endif
#if defined(IRIVER_H100_SERIES) && !defined(SIMULATOR) #if defined(IRIVER_H100_SERIES) && !defined(SIMULATOR)
pcm_init_recording(); pcm_init_recording();

View file

@ -686,6 +686,9 @@ static void set_filebuf_watermark(int seconds)
if (current_codec == CODEC_IDX_VOICE) if (current_codec == CODEC_IDX_VOICE)
return ; return ;
if (!filebuf)
return; /* Audio buffers not yet set up */
bytes = MAX((int)cur_ti->id3.bitrate * seconds * (1000/8), conf_watermark); bytes = MAX((int)cur_ti->id3.bitrate * seconds * (1000/8), conf_watermark);
bytes = MIN(bytes, filebuflen / 2); bytes = MIN(bytes, filebuflen / 2);
@ -2168,6 +2171,9 @@ void audio_set_crossfade(int type)
static const int lookup[] = {1, 2, 4, 6, 8, 10, 12, 14}; static const int lookup[] = {1, 2, 4, 6, 8, 10, 12, 14};
int seconds = lookup[global_settings.crossfade_duration]; int seconds = lookup[global_settings.crossfade_duration];
if (!filebuf)
return; /* Audio buffers not yet set up */
/* Store the track resume position */ /* Store the track resume position */
if (playing) if (playing)
offset = cur_ti->id3.offset; offset = cur_ti->id3.offset;
@ -2285,6 +2291,10 @@ void audio_init(void)
queue_init(&codec_queue); queue_init(&codec_queue);
queue_init(&voice_codec_queue); queue_init(&voice_codec_queue);
/* Apply relevant settings */
audio_set_buffer_margin(global_settings.buffer_margin);
audio_set_crossfade(global_settings.crossfade);
create_thread(codec_thread, codec_stack, sizeof(codec_stack), create_thread(codec_thread, codec_stack, sizeof(codec_stack),
codec_thread_name); codec_thread_name);
create_thread(voice_codec_thread, voice_codec_stack, create_thread(voice_codec_thread, voice_codec_stack,