mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-12-07 05:35:02 -05:00
announce_status trackchange bugfix
!Properly remove callback! don't play voice prompt at startup if something is actively playing Change-Id: I237d09c1496bc2bed8433dcdaa1469f3d0f2cb10
This commit is contained in:
parent
83111eeece
commit
0c958d2b4a
1 changed files with 10 additions and 13 deletions
|
|
@ -141,7 +141,8 @@ static void playback_event_callback(unsigned short id, void *data)
|
||||||
{
|
{
|
||||||
(void)id;
|
(void)id;
|
||||||
(void)data;
|
(void)data;
|
||||||
rb->queue_post(&gThread.queue, EV_TRACKCHANGE, 0);
|
if (gThread.id > 0)
|
||||||
|
rb->queue_post(&gThread.queue, EV_TRACKCHANGE, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************** config functions *****************/
|
/****************** config functions *****************/
|
||||||
|
|
@ -458,11 +459,11 @@ void thread_create(void)
|
||||||
{
|
{
|
||||||
rb->splash(HZ*2, "Out of memory");
|
rb->splash(HZ*2, "Out of memory");
|
||||||
gThread.exiting = true;
|
gThread.exiting = true;
|
||||||
|
rb->remove_event(PLAYBACK_EVENT_TRACK_CHANGE, playback_event_callback);
|
||||||
gThread.id = UINT_MAX;
|
gThread.id = UINT_MAX;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* put the thread's queue in the bcast list */
|
/* put the thread's queue in the bcast list */
|
||||||
rb->queue_init(&gThread.queue, true);
|
rb->queue_init(&gThread.queue, true);
|
||||||
|
|
||||||
|
|
@ -480,6 +481,8 @@ void thread_quit(void)
|
||||||
if (!gThread.exiting) {
|
if (!gThread.exiting) {
|
||||||
rb->queue_post(&gThread.queue, EV_EXIT, 0);
|
rb->queue_post(&gThread.queue, EV_EXIT, 0);
|
||||||
rb->thread_wait(gThread.id);
|
rb->thread_wait(gThread.id);
|
||||||
|
/* we don't want any more events */
|
||||||
|
rb->remove_event(PLAYBACK_EVENT_TRACK_CHANGE, playback_event_callback);
|
||||||
/* remove the thread's queue from the broadcast list */
|
/* remove the thread's queue from the broadcast list */
|
||||||
rb->queue_delete(&gThread.queue);
|
rb->queue_delete(&gThread.queue);
|
||||||
gThread.exiting = true;
|
gThread.exiting = true;
|
||||||
|
|
@ -511,7 +514,6 @@ int plugin_main(const void* parameter)
|
||||||
gAnnounce.index = 0;
|
gAnnounce.index = 0;
|
||||||
gAnnounce.timeout = 0;
|
gAnnounce.timeout = 0;
|
||||||
|
|
||||||
|
|
||||||
rb->splash(HZ / 2, "Announce Status");
|
rb->splash(HZ / 2, "Announce Status");
|
||||||
|
|
||||||
if (configfile_load(CFG_FILE, config, gCfg_sz, CFG_VER) < 0)
|
if (configfile_load(CFG_FILE, config, gCfg_sz, CFG_VER) < 0)
|
||||||
|
|
@ -520,17 +522,13 @@ int plugin_main(const void* parameter)
|
||||||
config_set_defaults();
|
config_set_defaults();
|
||||||
configfile_save(CFG_FILE, config, gCfg_sz, CFG_VER);
|
configfile_save(CFG_FILE, config, gCfg_sz, CFG_VER);
|
||||||
|
|
||||||
if (rb->mixer_channel_status(PCM_MIXER_CHAN_PLAYBACK) == CHANNEL_PLAYING)
|
|
||||||
{
|
|
||||||
while (rb->mixer_channel_get_bytes_waiting(PCM_MIXER_CHAN_PLAYBACK) > 0)
|
|
||||||
rb->sleep(HZ / 10);
|
|
||||||
}
|
|
||||||
|
|
||||||
rb->talk_id(LANG_HOLD_FOR_SETTINGS, false);
|
|
||||||
|
|
||||||
rb->splash(HZ, ID2P(LANG_HOLD_FOR_SETTINGS));
|
rb->splash(HZ, ID2P(LANG_HOLD_FOR_SETTINGS));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (rb->mixer_channel_status(PCM_MIXER_CHAN_PLAYBACK) != CHANNEL_PLAYING)
|
||||||
|
{
|
||||||
|
rb->talk_id(LANG_HOLD_FOR_SETTINGS, false);
|
||||||
|
}
|
||||||
rb->splash(HZ, ID2P(LANG_HOLD_FOR_SETTINGS));
|
rb->splash(HZ, ID2P(LANG_HOLD_FOR_SETTINGS));
|
||||||
|
|
||||||
rb->button_clear_queue();
|
rb->button_clear_queue();
|
||||||
|
|
@ -567,6 +565,7 @@ int plugin_main(const void* parameter)
|
||||||
rb->add_event(PLAYBACK_EVENT_TRACK_CHANGE, playback_event_callback);
|
rb->add_event(PLAYBACK_EVENT_TRACK_CHANGE, playback_event_callback);
|
||||||
|
|
||||||
thread_create();
|
thread_create();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -578,8 +577,6 @@ enum plugin_status plugin_start(const void* parameter)
|
||||||
{
|
{
|
||||||
/* now go ahead and have fun! */
|
/* now go ahead and have fun! */
|
||||||
int ret = plugin_main(parameter);
|
int ret = plugin_main(parameter);
|
||||||
|
|
||||||
rb->remove_event(PLAYBACK_EVENT_START_PLAYBACK, playback_event_callback);
|
|
||||||
return (ret==0) ? PLUGIN_OK : PLUGIN_ERROR;
|
return (ret==0) ? PLUGIN_OK : PLUGIN_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue