Remove obsolete init cruft from audio system because of diminished dependencies. All talk/voice dependency in playback.c should be imminently removable.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30401 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
67f5249559
commit
6d3a6f71d1
5 changed files with 25 additions and 63 deletions
|
@ -411,25 +411,6 @@ static bool codec_loop_track_callback(void)
|
||||||
return global_settings.repeat_mode == REPEAT_ONE;
|
return global_settings.repeat_mode == REPEAT_ONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Initialize codec API */
|
|
||||||
void codec_init_codec_api(void)
|
|
||||||
{
|
|
||||||
ci.dsp = (struct dsp_config *)dsp_configure(NULL, DSP_MYDSP,
|
|
||||||
CODEC_IDX_AUDIO);
|
|
||||||
ci.codec_get_buffer = codec_get_buffer_callback;
|
|
||||||
ci.pcmbuf_insert = codec_pcmbuf_insert_callback;
|
|
||||||
ci.set_elapsed = audio_codec_update_elapsed;
|
|
||||||
ci.read_filebuf = codec_filebuf_callback;
|
|
||||||
ci.request_buffer = codec_request_buffer_callback;
|
|
||||||
ci.advance_buffer = codec_advance_buffer_callback;
|
|
||||||
ci.seek_buffer = codec_seek_buffer_callback;
|
|
||||||
ci.seek_complete = codec_seek_complete_callback;
|
|
||||||
ci.set_offset = audio_codec_update_offset;
|
|
||||||
ci.configure = codec_configure_callback;
|
|
||||||
ci.get_command = codec_get_command_callback;
|
|
||||||
ci.loop_track = codec_loop_track_callback;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/** --- CODEC THREAD --- **/
|
/** --- CODEC THREAD --- **/
|
||||||
|
|
||||||
|
@ -626,25 +607,35 @@ static void NORETURN_ATTR codec_thread(void)
|
||||||
|
|
||||||
/** --- Miscellaneous external interfaces -- **/
|
/** --- Miscellaneous external interfaces -- **/
|
||||||
|
|
||||||
/* Create the codec thread and init kernel objects */
|
/* Initialize playback's codec interface */
|
||||||
void make_codec_thread(void)
|
void codec_thread_init(void)
|
||||||
{
|
{
|
||||||
|
/* Init API */
|
||||||
|
ci.dsp = (struct dsp_config *)dsp_configure(NULL, DSP_MYDSP,
|
||||||
|
CODEC_IDX_AUDIO);
|
||||||
|
ci.codec_get_buffer = codec_get_buffer_callback;
|
||||||
|
ci.pcmbuf_insert = codec_pcmbuf_insert_callback;
|
||||||
|
ci.set_elapsed = audio_codec_update_elapsed;
|
||||||
|
ci.read_filebuf = codec_filebuf_callback;
|
||||||
|
ci.request_buffer = codec_request_buffer_callback;
|
||||||
|
ci.advance_buffer = codec_advance_buffer_callback;
|
||||||
|
ci.seek_buffer = codec_seek_buffer_callback;
|
||||||
|
ci.seek_complete = codec_seek_complete_callback;
|
||||||
|
ci.set_offset = audio_codec_update_offset;
|
||||||
|
ci.configure = codec_configure_callback;
|
||||||
|
ci.get_command = codec_get_command_callback;
|
||||||
|
ci.loop_track = codec_loop_track_callback;
|
||||||
|
|
||||||
|
/* Init threading */
|
||||||
queue_init(&codec_queue, false);
|
queue_init(&codec_queue, false);
|
||||||
codec_thread_id = create_thread(
|
codec_thread_id = create_thread(
|
||||||
codec_thread, codec_stack, sizeof(codec_stack),
|
codec_thread, codec_stack, sizeof(codec_stack), 0,
|
||||||
CREATE_THREAD_FROZEN,
|
|
||||||
codec_thread_name IF_PRIO(, PRIORITY_PLAYBACK)
|
codec_thread_name IF_PRIO(, PRIORITY_PLAYBACK)
|
||||||
IF_COP(, CPU));
|
IF_COP(, CPU));
|
||||||
queue_enable_queue_send(&codec_queue, &codec_queue_sender_list,
|
queue_enable_queue_send(&codec_queue, &codec_queue_sender_list,
|
||||||
codec_thread_id);
|
codec_thread_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Unfreeze the codec thread */
|
|
||||||
void codec_thread_resume(void)
|
|
||||||
{
|
|
||||||
thread_thaw(codec_thread_id);
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef HAVE_PRIORITY_SCHEDULING
|
#ifdef HAVE_PRIORITY_SCHEDULING
|
||||||
/* Obtain codec thread's current priority */
|
/* Obtain codec thread's current priority */
|
||||||
int codec_thread_get_priority(void)
|
int codec_thread_get_priority(void)
|
||||||
|
|
|
@ -28,14 +28,12 @@
|
||||||
const char *get_codec_filename(int cod_spec);
|
const char *get_codec_filename(int cod_spec);
|
||||||
|
|
||||||
/* codec thread */
|
/* codec thread */
|
||||||
|
void codec_thread_init(void);
|
||||||
|
|
||||||
/* Audio MUST be stopped before requesting callback! */
|
/* Audio MUST be stopped before requesting callback! */
|
||||||
void codec_thread_do_callback(void (*fn)(void),
|
void codec_thread_do_callback(void (*fn)(void),
|
||||||
unsigned int *codec_thread_id);
|
unsigned int *codec_thread_id);
|
||||||
|
|
||||||
void codec_init_codec_api(void);
|
|
||||||
void make_codec_thread(void);
|
|
||||||
void codec_thread_resume(void);
|
|
||||||
#ifdef HAVE_PRIORITY_SCHEDULING
|
#ifdef HAVE_PRIORITY_SCHEDULING
|
||||||
int codec_thread_get_priority(void);
|
int codec_thread_get_priority(void);
|
||||||
int codec_thread_set_priority(int priority);
|
int codec_thread_set_priority(int priority);
|
||||||
|
|
|
@ -3813,14 +3813,11 @@ void audio_init(void)
|
||||||
|
|
||||||
pcm_init();
|
pcm_init();
|
||||||
|
|
||||||
codec_init_codec_api();
|
codec_thread_init();
|
||||||
|
|
||||||
make_codec_thread();
|
|
||||||
|
|
||||||
/* This thread does buffer, so match its priority */
|
/* This thread does buffer, so match its priority */
|
||||||
audio_thread_id = create_thread(audio_thread, audio_stack,
|
audio_thread_id = create_thread(audio_thread, audio_stack,
|
||||||
sizeof(audio_stack), CREATE_THREAD_FROZEN,
|
sizeof(audio_stack), 0, audio_thread_name
|
||||||
audio_thread_name
|
|
||||||
IF_PRIO(, MIN(PRIORITY_BUFFERING, PRIORITY_USER_INTERFACE))
|
IF_PRIO(, MIN(PRIORITY_BUFFERING, PRIORITY_USER_INTERFACE))
|
||||||
IF_COP(, CPU));
|
IF_COP(, CPU));
|
||||||
|
|
||||||
|
@ -3853,11 +3850,4 @@ void audio_init(void)
|
||||||
#ifdef HAVE_DISK_STORAGE
|
#ifdef HAVE_DISK_STORAGE
|
||||||
audio_set_buffer_margin(global_settings.buffer_margin);
|
audio_set_buffer_margin(global_settings.buffer_margin);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* It's safe to let the threads run now */
|
|
||||||
#ifdef PLAYBACK_VOICE
|
|
||||||
voice_thread_resume();
|
|
||||||
#endif
|
|
||||||
codec_thread_resume();
|
|
||||||
thread_thaw(audio_thread_id);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -217,9 +217,6 @@ void mp3_play_data(const unsigned char* start, int size,
|
||||||
/* Stop current voice clip from playing */
|
/* Stop current voice clip from playing */
|
||||||
void mp3_play_stop(void)
|
void mp3_play_stop(void)
|
||||||
{
|
{
|
||||||
if(!audio_is_thread_ready())
|
|
||||||
return;
|
|
||||||
|
|
||||||
LOGFQUEUE("mp3 >| voice Q_VOICE_STOP");
|
LOGFQUEUE("mp3 >| voice Q_VOICE_STOP");
|
||||||
queue_send(&voice_queue, Q_VOICE_STOP, 0);
|
queue_send(&voice_queue, Q_VOICE_STOP, 0);
|
||||||
}
|
}
|
||||||
|
@ -419,12 +416,6 @@ static void NORETURN_ATTR voice_thread(void)
|
||||||
|
|
||||||
voice_data_init(&td);
|
voice_data_init(&td);
|
||||||
|
|
||||||
/* audio thread will only set this once after it finished the final
|
|
||||||
* audio hardware init so this little construct is safe - even
|
|
||||||
* cross-core. */
|
|
||||||
while (!audio_is_thread_ready())
|
|
||||||
sleep(0);
|
|
||||||
|
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
switch (state)
|
switch (state)
|
||||||
|
@ -449,18 +440,11 @@ void voice_thread_init(void)
|
||||||
queue_init(&voice_queue, false);
|
queue_init(&voice_queue, false);
|
||||||
|
|
||||||
voice_thread_id = create_thread(voice_thread, voice_stack,
|
voice_thread_id = create_thread(voice_thread, voice_stack,
|
||||||
sizeof(voice_stack), CREATE_THREAD_FROZEN,
|
sizeof(voice_stack), 0, voice_thread_name
|
||||||
voice_thread_name IF_PRIO(, PRIORITY_VOICE) IF_COP(, CPU));
|
IF_PRIO(, PRIORITY_VOICE) IF_COP(, CPU));
|
||||||
|
|
||||||
queue_enable_queue_send(&voice_queue, &voice_queue_sender_list,
|
queue_enable_queue_send(&voice_queue, &voice_queue_sender_list,
|
||||||
voice_thread_id);
|
voice_thread_id);
|
||||||
} /* voice_thread_init */
|
|
||||||
|
|
||||||
/* Unfreeze the voice thread */
|
|
||||||
void voice_thread_resume(void)
|
|
||||||
{
|
|
||||||
logf("Thawing voice thread");
|
|
||||||
thread_thaw(voice_thread_id);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_PRIORITY_SCHEDULING
|
#ifdef HAVE_PRIORITY_SCHEDULING
|
||||||
|
|
|
@ -31,7 +31,6 @@ void voice_wait(void);
|
||||||
void voice_stop(void);
|
void voice_stop(void);
|
||||||
|
|
||||||
void voice_thread_init(void);
|
void voice_thread_init(void);
|
||||||
void voice_thread_resume(void);
|
|
||||||
#ifdef HAVE_PRIORITY_SCHEDULING
|
#ifdef HAVE_PRIORITY_SCHEDULING
|
||||||
void voice_thread_set_priority(int priority);
|
void voice_thread_set_priority(int priority);
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue