This is the bug/patch tracker for Rockbox. Click here for more information.
Quick links: Bugs · Patches · Rockbox frontpage
FS#11232 - Mix pcm and voice in software
Attached to Project:
Rockbox
Opened by Jeffrey Goode (Blue_Dude) - Friday, 30 April 2010, 22:35 GMT+2
Last edited by Jeffrey Goode (Blue_Dude) - Wednesday, 08 June 2011, 23:22 GMT+2
Opened by Jeffrey Goode (Blue_Dude) - Friday, 30 April 2010, 22:35 GMT+2
Last edited by Jeffrey Goode (Blue_Dude) - Wednesday, 08 June 2011, 23:22 GMT+2
|
DetailsThis is a work in progress. It compiles in the sim but isn't nearly ready for committing yet.
I'm attempting to mix pcm and voice just-in-time for playback. This patch creates two small buffers and shrinks an existing buffer to almost nothing (most is currently wasted anyway). The two new buffers are 1024 sample mixing buffers that are mixed by calls from the voice thread. One is the active playing buffer while the other is on standby being mixed. The correct buffers are fed to the DMA automatically when the mixer is enabled. I've tried to keep the mixer ISR callback that actually feeds the DMA small and light, but it remains to be seen whether it runs fast enough on target without draining the DMA FIFO buffer first. It's possible that some of the callback will have to implemented in ASM or otherwise rewritten. Not yet implemented: Playback pause behavior. After hitting pause while mixing, playback will continue until the currently playing mix buffer finished, to avoid cutting off voice playback, then swap to aux only playback seamlessly. Pause/resume fade. This currently happens in hardware. Making this happen in the callback hasn't been addressed. Making it work in the callback along with the "rewind" feature hasn't been looked at yet either. Others??? |
This task depends upon
Closed by Jeffrey Goode (Blue_Dude)
Wednesday, 08 June 2011, 23:22 GMT+2
Reason for closing: Rejected
Additional comments about closing: Better solution available at FS#12150
Wednesday, 08 June 2011, 23:22 GMT+2
Reason for closing: Rejected
Additional comments about closing: Better solution available at
pcmbuf_beep, aka the keyclick function. It currently mixes-in-place in the pcm buffer, but it ought to write to, or maybe be mixed with, the aux buffer instead.
The purpose of this patch was to intercept the normal DMA playback and redirect it to a very small mixing buffer that would mix playback and voice in real time with very low latency. It would get away from mixing voice into the playback buffer as that would prevent resuming playback after a pause cleanly. Instead, it meant to establish two very small mixing buffers, one active and the other standby. The DMA would point to the active one and the other would be mixing in the background. When the DMA was starved for data, the roles would automatically switch. This causes a lot of DMA interrupts but it would only occur if data and voice were playing at the same time. If no voice was playing, then playback operates normally.
I also renamed voice playback to aux playback, in the hopes that it would open up audio insertion to other types of audio than merely voice assistance, such as custom sound files or game sounds.