Rockbox open source high quality audio player as a Music Player Daemon
mpris rockbox mpd libadwaita audio rust zig deno
2
fork

Configure Feed

Select the types of activity you want to include in your feed.

announce_status trackchange bugfix

!Properly remove callback!
don't play voice prompt at startup if something is actively playing

Change-Id: I237d09c1496bc2bed8433dcdaa1469f3d0f2cb10

authored by

William Wilgus and committed by
William Wilgus
0c958d2b 83111eee

+10 -13
+10 -13
apps/plugins/announce_status.c
··· 141 141 { 142 142 (void)id; 143 143 (void)data; 144 - rb->queue_post(&gThread.queue, EV_TRACKCHANGE, 0); 144 + if (gThread.id > 0) 145 + rb->queue_post(&gThread.queue, EV_TRACKCHANGE, 0); 145 146 } 146 147 147 148 /****************** config functions *****************/ ··· 458 459 { 459 460 rb->splash(HZ*2, "Out of memory"); 460 461 gThread.exiting = true; 462 + rb->remove_event(PLAYBACK_EVENT_TRACK_CHANGE, playback_event_callback); 461 463 gThread.id = UINT_MAX; 462 464 return; 463 465 } 464 - 465 466 466 467 /* put the thread's queue in the bcast list */ 467 468 rb->queue_init(&gThread.queue, true); ··· 480 481 if (!gThread.exiting) { 481 482 rb->queue_post(&gThread.queue, EV_EXIT, 0); 482 483 rb->thread_wait(gThread.id); 484 + /* we don't want any more events */ 485 + rb->remove_event(PLAYBACK_EVENT_TRACK_CHANGE, playback_event_callback); 483 486 /* remove the thread's queue from the broadcast list */ 484 487 rb->queue_delete(&gThread.queue); 485 488 gThread.exiting = true; ··· 510 513 511 514 gAnnounce.index = 0; 512 515 gAnnounce.timeout = 0; 513 - 514 516 515 517 rb->splash(HZ / 2, "Announce Status"); 516 518 ··· 520 522 config_set_defaults(); 521 523 configfile_save(CFG_FILE, config, gCfg_sz, CFG_VER); 522 524 523 - if (rb->mixer_channel_status(PCM_MIXER_CHAN_PLAYBACK) == CHANNEL_PLAYING) 524 - { 525 - while (rb->mixer_channel_get_bytes_waiting(PCM_MIXER_CHAN_PLAYBACK) > 0) 526 - rb->sleep(HZ / 10); 527 - } 528 - 529 - rb->talk_id(LANG_HOLD_FOR_SETTINGS, false); 530 - 531 525 rb->splash(HZ, ID2P(LANG_HOLD_FOR_SETTINGS)); 532 526 } 533 527 528 + if (rb->mixer_channel_status(PCM_MIXER_CHAN_PLAYBACK) != CHANNEL_PLAYING) 529 + { 530 + rb->talk_id(LANG_HOLD_FOR_SETTINGS, false); 531 + } 534 532 rb->splash(HZ, ID2P(LANG_HOLD_FOR_SETTINGS)); 535 533 536 534 rb->button_clear_queue(); ··· 567 565 rb->add_event(PLAYBACK_EVENT_TRACK_CHANGE, playback_event_callback); 568 566 569 567 thread_create(); 568 + 570 569 return 0; 571 570 } 572 571 ··· 578 577 { 579 578 /* now go ahead and have fun! */ 580 579 int ret = plugin_main(parameter); 581 - 582 - rb->remove_event(PLAYBACK_EVENT_START_PLAYBACK, playback_event_callback); 583 580 return (ret==0) ? PLUGIN_OK : PLUGIN_ERROR; 584 581 } 585 582