From a2b6703a369f6cdbfec1f150c408dadc877631fb Mon Sep 17 00:00:00 2001 From: Michael Sevakis Date: Wed, 29 Jun 2011 06:37:04 +0000 Subject: Commit FS#12150 - Fully-functional audio mixer - and finally whip old limitations about playback of voice and other sounds when paused. Channels are independent in state and amplitude. Fade on stop/pause is handled by the channel's volume control rather than global volume which means it now works from anywhere. Opens up the possibility of plugin sounds during music playback by merely adding an additional channel enum. If any PCM drivers were not properly modified, see one of the last comments in the task for a description of the simple change that is expected. Some params are tunable in firmware/export/pcm-mixer.h as well. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30097 a1c6a512-1295-4272-9138-f99709370657 --- firmware/target/arm/s5l8700/pcm-s5l8700.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'firmware/target/arm/s5l8700/pcm-s5l8700.c') diff --git a/firmware/target/arm/s5l8700/pcm-s5l8700.c b/firmware/target/arm/s5l8700/pcm-s5l8700.c index 08086c37d8..14c515ec47 100644 --- a/firmware/target/arm/s5l8700/pcm-s5l8700.c +++ b/firmware/target/arm/s5l8700/pcm-s5l8700.c @@ -27,6 +27,7 @@ #include "panic.h" #include "audiohw.h" #include "pcm.h" +#include "pcm-internal.h" #include "pcm_sampr.h" #include "dma-target.h" #include "mmu-arm.h" @@ -100,6 +101,7 @@ void pcm_play_unlock(void) void INT_DMA(void) ICODE_ATTR; void INT_DMA(void) { + bool new_buffer = false; DMACOM0 = 7; while (!(DMACON0 & (1 << 18))) { @@ -112,8 +114,12 @@ void INT_DMA(void) } else { - if (!nextsize) pcm_play_get_more_callback((void**)&nextbuf, &nextsize); - if (!nextsize) break; + if (!nextsize) + { + pcm_play_get_more_callback((void**)&nextbuf, &nextsize); + if (!nextsize) break; + new_buffer = true; + } queuedsize = MIN(sizeof(dblbuf), nextsize / 2); nextsize -= queuedsize; queuedbuf = nextbuf + nextsize; @@ -124,7 +130,14 @@ void INT_DMA(void) clean_dcache(); DMACOM0 = 4; DMACOM0 = 7; + + if (new_buffer) + { + pcm_play_dma_started_callback(); + new_buffer = false; + } } + } void pcm_play_dma_start(const void* addr, size_t size) -- cgit v1.2.3