dev builds
themes manual
device status forums
mailing lists
IRC bugs
dev guide

Rockbox mail archive

Subject: Software mixer

Software mixer

From: Jeff Goode <>
Date: Sun, 22 Nov 2009 14:28:10 -0500

Hi folks,

I'm looking for some guidance here and to get a feel for where
development ought to go. I've played around some with changing the
pcmbuf code to accommodate more than one source playing at a time.
Currently there are two main sources for playback: main codec audio and
voice. Voice is somewhat dependent on the state of codec playback. If
there is no playback, it is sent through pcmbuf as though it was codec
playback. If there is already playback, it is mixed into the codec
audio on the fly. There are a number of limitations to this scheme
because codec audio, and therefore voice, is obviously subject to user
interruption at any time. And if playback is paused, since the PCM DMA
driver is paused, no voice audio can be inserted or played. There are
some workarounds for this, but none is terribly comprehensive.

I proposed that pcmbuf be rewritten to allow multiple input streams to
be queued up independently and non-destructively mixed in real time.
But there was some concern that this would cost memory and CPU time
resources for little gain. I think the benefit vs cost is worth it,
since it would present a much slicker and problem free audio experience
to the user, including such features as independent stream volume
control, interface sound effects, independent pause/playback, etc. It
would cost buffer space, probably about 64K for a mixing buffer, and its
own thread, and therefore a stack. CPU resources would be about the
same, since in the usual case there's only one stream playing, the DMA
would be pointed at that stream, and the mixer thread would sleep.

There's a way to limit memory usage: make DMA chunks smaller. This has
the advantage of needing less memory for buffers, and also decreases
latency for audio mix changes, but has the disadvantage of requiring
more CPU overhead for housekeeping chores between chunks. I don't have
a recommendation one way or the other about that.

I've started and thrown out changes several times working on this
because there was no clear direction on what would be acceptable. I can
either tweak what we have and perhaps play voice during a playback pause
and couple of other things, or go much deeper and run completely
independent, parallel audio streams, with pcmbuf being the only code
segment which handles swcodec audio throughput.

Please let me know what your thoughts are. I'm not comfortable going
forward and putting a lot of effort in without better direction.

Received on 2009-11-22

Page template was last modified "Tue Sep 7 00:00:02 2021" The Rockbox Crew -- Privacy Policy