summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apps/pcmbuf.c28
1 files changed, 16 insertions, 12 deletions
diff --git a/apps/pcmbuf.c b/apps/pcmbuf.c
index 10304903c7..8736fe2ae2 100644
--- a/apps/pcmbuf.c
+++ b/apps/pcmbuf.c
@@ -1095,18 +1095,6 @@ static void pcmbuf_update_volume(void)
1095 mixer_channel_set_amplitude(PCM_MIXER_CHAN_PLAYBACK, vol); 1095 mixer_channel_set_amplitude(PCM_MIXER_CHAN_PLAYBACK, vol);
1096} 1096}
1097 1097
1098/* Quiet-down the channel if 'shhh' is true or else play at normal level */
1099void pcmbuf_soft_mode(bool shhh)
1100{
1101 /* "Hate this" alert (messing with IRQ in app code): Have to block
1102 the tick or improper order could leave volume in soft mode if
1103 fading reads the old value first but updates after us. */
1104 int oldlevel = disable_irq_save();
1105 soft_mode = shhh;
1106 pcmbuf_update_volume();
1107 restore_irq(oldlevel);
1108}
1109
1110/* Tick that does the fade for the playback channel */ 1098/* Tick that does the fade for the playback channel */
1111static void pcmbuf_fade_tick(void) 1099static void pcmbuf_fade_tick(void)
1112{ 1100{
@@ -1169,6 +1157,22 @@ bool pcmbuf_fading(void)
1169 return fade_state != PCM_NOT_FADING; 1157 return fade_state != PCM_NOT_FADING;
1170} 1158}
1171 1159
1160/* Quiet-down the channel if 'shhh' is true or else play at normal level */
1161void pcmbuf_soft_mode(bool shhh)
1162{
1163 /* Have to block the tick or improper order could leave volume in soft
1164 mode if fading reads the old value first but updates after us. */
1165 int res = fade_state != PCM_NOT_FADING ?
1166 tick_remove_task(pcmbuf_fade_tick) : -1;
1167
1168 soft_mode = shhh;
1169 pcmbuf_update_volume();
1170
1171 if (res == 0)
1172 tick_add_task(pcmbuf_fade_tick);
1173}
1174
1175
1172/** Misc */ 1176/** Misc */
1173 1177
1174bool pcmbuf_is_lowdata(void) 1178bool pcmbuf_is_lowdata(void)