summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorMichael Sevakis <jethead71@rockbox.org>2007-03-11 05:04:48 +0000
committerMichael Sevakis <jethead71@rockbox.org>2007-03-11 05:04:48 +0000
commit5d63776a24cb3de9f5ddbfbfb13ce03e50264c03 (patch)
tree9f8665f020b326e9ffc24799579240a044e35d3c /apps
parenta1a4034b82630bc94bfd37dac4e1c3f30afaccd5 (diff)
downloadrockbox-5d63776a24cb3de9f5ddbfbfb13ce03e50264c03.tar.gz
rockbox-5d63776a24cb3de9f5ddbfbfb13ce03e50264c03.zip
Reenable aynchronous audio init stage. Really just single stage with aynchronous enabling of outputs. Keeps audio_init last so prior init steps can use the audiobuffer in any desired way. Audio will be fully initialized by the time the UI is entered. Playback of voice or audio will be delayed properly until audio hardware is ready.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@12714 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r--apps/playback.c14
-rw-r--r--apps/playback.h1
2 files changed, 12 insertions, 3 deletions
diff --git a/apps/playback.c b/apps/playback.c
index 2ea6e2f004..c3d28110dd 100644
--- a/apps/playback.c
+++ b/apps/playback.c
@@ -3443,6 +3443,11 @@ static bool ata_fillbuffer_callback(void)
3443static void audio_thread(void) 3443static void audio_thread(void)
3444{ 3444{
3445 struct event ev; 3445 struct event ev;
3446
3447 audiohw_postinit();
3448
3449 /* Unlock mutex that init stage locks before creating this thread */
3450 mutex_unlock(&mutex_codecthread);
3446 3451
3447 while (1) 3452 while (1)
3448 { 3453 {
@@ -3604,6 +3609,10 @@ void audio_init(void)
3604 starts running until ready if something yields such as talk_init. */ 3609 starts running until ready if something yields such as talk_init. */
3605#ifdef PLAYBACK_VOICE 3610#ifdef PLAYBACK_VOICE
3606 mutex_init(&mutex_codecthread); 3611 mutex_init(&mutex_codecthread);
3612 /* Take ownership of lock to prevent playback of anything before audio
3613 hardware is initialized - audio thread unlocks it after final init
3614 stage */
3615 mutex_lock(&mutex_codecthread);
3607#endif 3616#endif
3608 queue_init(&audio_queue, true); 3617 queue_init(&audio_queue, true);
3609 queue_enable_queue_send(&audio_queue, &audio_queue_sender_list); 3618 queue_enable_queue_send(&audio_queue, &audio_queue_sender_list);
@@ -3656,6 +3665,7 @@ void audio_init(void)
3656 3665
3657 /* initialize the buffer */ 3666 /* initialize the buffer */
3658 filebuf = audiobuf; /* must be non-NULL for audio_set_crossfade */ 3667 filebuf = audiobuf; /* must be non-NULL for audio_set_crossfade */
3668
3659 /* audio_reset_buffer must to know the size of voice buffer so init 3669 /* audio_reset_buffer must to know the size of voice buffer so init
3660 voice first */ 3670 voice first */
3661 talk_init(); 3671 talk_init();
@@ -3670,9 +3680,9 @@ void audio_init(void)
3670 IF_COP(, CPU, false)); 3680 IF_COP(, CPU, false));
3671 3681
3672 audio_set_crossfade(global_settings.crossfade); 3682 audio_set_crossfade(global_settings.crossfade);
3673 3683
3674 audio_is_initialized = true; 3684 audio_is_initialized = true;
3675 3685
3676 sound_settings_apply(); 3686 sound_settings_apply();
3677 audio_set_buffer_margin(global_settings.buffer_margin); 3687 audio_set_buffer_margin(global_settings.buffer_margin);
3678} /* audio_init */ 3688} /* audio_init */
diff --git a/apps/playback.h b/apps/playback.h
index ccf8b58472..82179f1ee2 100644
--- a/apps/playback.h
+++ b/apps/playback.h
@@ -74,7 +74,6 @@ extern void audio_prev_dir(void);
74#define audio_next_dir() 74#define audio_next_dir()
75#define audio_prev_dir() 75#define audio_prev_dir()
76#endif 76#endif
77void audio_preinit(void);
78 77
79#endif 78#endif
80 79