From 697aa7f4994651233bf5208877d58dbb1cec1974 Mon Sep 17 00:00:00 2001 From: Michael Sevakis Date: Thu, 25 Aug 2011 00:12:19 +0000 Subject: Do sync between pcmbuf volume controls without explicit IRQ masking, which is nicer and also allows pcmbuf.c to compile again as thumb code. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30344 a1c6a512-1295-4272-9138-f99709370657 --- apps/pcmbuf.c | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) (limited to 'apps/pcmbuf.c') 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) mixer_channel_set_amplitude(PCM_MIXER_CHAN_PLAYBACK, vol); } -/* Quiet-down the channel if 'shhh' is true or else play at normal level */ -void pcmbuf_soft_mode(bool shhh) -{ - /* "Hate this" alert (messing with IRQ in app code): Have to block - the tick or improper order could leave volume in soft mode if - fading reads the old value first but updates after us. */ - int oldlevel = disable_irq_save(); - soft_mode = shhh; - pcmbuf_update_volume(); - restore_irq(oldlevel); -} - /* Tick that does the fade for the playback channel */ static void pcmbuf_fade_tick(void) { @@ -1169,6 +1157,22 @@ bool pcmbuf_fading(void) return fade_state != PCM_NOT_FADING; } +/* Quiet-down the channel if 'shhh' is true or else play at normal level */ +void pcmbuf_soft_mode(bool shhh) +{ + /* Have to block the tick or improper order could leave volume in soft + mode if fading reads the old value first but updates after us. */ + int res = fade_state != PCM_NOT_FADING ? + tick_remove_task(pcmbuf_fade_tick) : -1; + + soft_mode = shhh; + pcmbuf_update_volume(); + + if (res == 0) + tick_add_task(pcmbuf_fade_tick); +} + + /** Misc */ bool pcmbuf_is_lowdata(void) -- cgit v1.2.3