diff options
author | Michael Sevakis <jethead71@rockbox.org> | 2011-08-25 00:12:19 +0000 |
---|---|---|
committer | Michael Sevakis <jethead71@rockbox.org> | 2011-08-25 00:12:19 +0000 |
commit | 697aa7f4994651233bf5208877d58dbb1cec1974 (patch) | |
tree | a36225af4972c647141bc0aa17267b3a209d7307 | |
parent | 9d4cd7c0bd7b2aabf578a66dd70eb9929e9ec2a3 (diff) | |
download | rockbox-697aa7f4994651233bf5208877d58dbb1cec1974.tar.gz rockbox-697aa7f4994651233bf5208877d58dbb1cec1974.zip |
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
-rw-r--r-- | apps/pcmbuf.c | 28 |
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) 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) |