summaryrefslogtreecommitdiff
path: root/apps/plugins/metronome.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/metronome.c')
-rw-r--r--apps/plugins/metronome.c22
1 files changed, 20 insertions, 2 deletions
diff --git a/apps/plugins/metronome.c b/apps/plugins/metronome.c
index 3361ce32bc..712731462a 100644
--- a/apps/plugins/metronome.c
+++ b/apps/plugins/metronome.c
@@ -706,6 +706,9 @@ static signed short sound[] = {
706}; 706};
707 707
708int tock; 708int tock;
709#if CONFIG_CODEC == SWCODEC
710bool need_to_play = false;
711#endif
709 712
710short sndbuf[sizeof(sound)*2]; 713short sndbuf[sizeof(sound)*2];
711 714
@@ -829,7 +832,12 @@ void timer_callback(void)
829 if(minitick >= period){ 832 if(minitick >= period){
830 minitick = 0; 833 minitick = 0;
831 if(!sound_active && !sound_paused && !tap_count) { 834 if(!sound_active && !sound_paused && !tap_count) {
835#if CONFIG_CODEC == SWCODEC
836 /* On SWCODEC we can't call play_tock() directly from an ISR. */
837 need_to_play = true;
838#else
832 play_tock(); 839 play_tock();
840#endif
833 rb->reset_poweroff_timer(); 841 rb->reset_poweroff_timer();
834 } 842 }
835 } 843 }
@@ -855,7 +863,7 @@ void cleanup(void *parameter)
855 863
856void tap(void) 864void tap(void)
857{ 865{
858 if (tap_count == 0) { 866 if (tap_count == 0 || tap_time < tap_count) {
859 tap_time = 0; 867 tap_time = 0;
860 } 868 }
861 else { 869 else {
@@ -918,9 +926,19 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter){
918 while (true){ 926 while (true){
919 reset_tap = true; 927 reset_tap = true;
920 928
929
930#if CONFIG_CODEC == SWCODEC
931 button = pluginlib_getaction(rb,1,plugin_contexts,PLA_ARRAY_COUNT);
932 if (need_to_play)
933 {
934 need_to_play = false;
935 play_tock();
936 }
937#else
921 button = pluginlib_getaction(rb,TIMEOUT_BLOCK, 938 button = pluginlib_getaction(rb,TIMEOUT_BLOCK,
922 plugin_contexts,PLA_ARRAY_COUNT); 939 plugin_contexts,PLA_ARRAY_COUNT);
923 940#endif
941
924 switch (button) { 942 switch (button) {
925 943
926 case METRONOME_QUIT: 944 case METRONOME_QUIT: